Created
December 7, 2017 20:34
-
-
Save fjaviersanchez/ee3fe852d9b8fac1366bf4c2123955b5 to your computer and use it in GitHub Desktop.
small function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute_stats(x,y,z,bins,cut=[]): | |
b1, binx, biny, _ = binned_statistic_2d(x[cut],y[cut],z[cut],statistic='sum',bins=bins) | |
c1, binx, biny, _ = binned_statistic_2d(x[cut],y[cut],z[cut],statistic='count',bins=bins) | |
b2, binx, biny, _ = binned_statistic_2d(x[cut],y[cut],z[cut]**2,statistic='sum',bins=bins) | |
bin_center = 0.5*(bin_edges[1:]+bin_edges[:-1]) | |
return b1, c1, b2, bin_center |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment