Skip to content

Instantly share code, notes, and snippets.

@jonashaag
Created July 13, 2020 10:12
Show Gist options
  • Save jonashaag/3352f2dac090380f5117cf22314f460a to your computer and use it in GitHub Desktop.
Save jonashaag/3352f2dac090380f5117cf22314f460a to your computer and use it in GitHub Desktop.
def bin_freqs(x, nbins):
return (
x.T.reshape((-1, int(x.shape[0] / nbins))).mean(axis=-1).reshape((-1, nbins)).T
)
def compact_freqs(x):
return np.vstack(
(
x[:16],
bin_freqs(x[16:32], 16),
bin_freqs(x[32:64], 16),
bin_freqs(x[64:128], 16),
bin_freqs(x[128:256], 16),
bin_freqs(x[256:512], 16),
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment