Skip to content

Instantly share code, notes, and snippets.

@akochepasov
Created April 11, 2020 01:09
Show Gist options
  • Save akochepasov/999829601e631eb9b2cf289b0890c0d4 to your computer and use it in GitHub Desktop.
Save akochepasov/999829601e631eb9b2cf289b0890c0d4 to your computer and use it in GitHub Desktop.
Frequency heatmap creation
# Creating heatmap (slower)
dbins = np.linspace(0.0, 1.0, 51)
m = np.zeros((len(dbins), len(x_axis)))
m2 = np.zeros((len(dbins), len(x_axis)))
for r in res:
rd = np.digitize(r, dbins)
for i, d in enumerate(rd):
m[d, i] += 1
# Creating heatmap (faster)
dbins = np.linspace(0.0, 1.0, 51)
m2 = np.zeros((len(dbins), len(x_axis)))
for i, x in enumerate(x_axis):
h = np.histogram(res[:, j], dbins)[0]
m2[1:, i] += h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment