[postprocessor] use nanmean for radial averages
This commit is contained in:
+4
-3
@@ -1005,12 +1005,13 @@ class PostProcessor(HDF5Container):
|
|||||||
# mean of all the cells in the bin
|
# mean of all the cells in the bin
|
||||||
mean_bin = np.zeros(len(radial_bins) - 1)
|
mean_bin = np.zeros(len(radial_bins) - 1)
|
||||||
for j in range(len(radial_bins) - 1):
|
for j in range(len(radial_bins) - 1):
|
||||||
|
mask_bin = bins_on_map == j
|
||||||
if mass_weighted:
|
if mass_weighted:
|
||||||
weight = coldens[bins_on_map == j]
|
weight = coldens[mask_bin]
|
||||||
mean_bin[j] = np.mean(dmap[bins_on_map == j] * weight)
|
mean_bin[j] = np.nanmean(dmap[mask_bin] * weight)
|
||||||
mean_bin[j] = mean_bin[j] / np.mean(weight)
|
mean_bin[j] = mean_bin[j] / np.mean(weight)
|
||||||
else:
|
else:
|
||||||
mean_bin[j] = np.mean(dmap[bins_on_map == j])
|
mean_bin[j] = np.nanmean(dmap[mask_bin])
|
||||||
return mean_bin
|
return mean_bin
|
||||||
|
|
||||||
def _rad_avg_map(self, name, ax_los="z", mass_weighted=False):
|
def _rad_avg_map(self, name, ax_los="z", mass_weighted=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user