[postprocessor] [refactoring] Add radial_centers rule (issue #8)
This commit is contained in:
+20
-3
@@ -926,6 +926,11 @@ class PostProcessor(HDF5Container):
|
|||||||
rad_bins = np.concatenate(([0.0], rad_bins, [rad_of_box]))
|
rad_bins = np.concatenate(([0.0], rad_bins, [rad_of_box]))
|
||||||
return rad_bins
|
return rad_bins
|
||||||
|
|
||||||
|
def _radial_centers(self, ax_los="z"):
|
||||||
|
radial_bins = self.save.get_node("/radial/radial_bins_" + ax_los).read()
|
||||||
|
bin_centers = 0.5 * (radial_bins[1:] + radial_bins[:-1])
|
||||||
|
return bin_centers
|
||||||
|
|
||||||
def _rr(self, ax_los="z"):
|
def _rr(self, ax_los="z"):
|
||||||
"""
|
"""
|
||||||
Computes the radius from the center
|
Computes the radius from the center
|
||||||
@@ -1483,7 +1488,19 @@ class PostProcessor(HDF5Container):
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
# Helpers
|
# Helpers
|
||||||
"radial_bins": Rule(self, self._radial_bins, "Radial bins", "/radial"),
|
"radial_bins": Rule(
|
||||||
|
self,
|
||||||
|
self._radial_bins,
|
||||||
|
"Radial bins",
|
||||||
|
"/radial",
|
||||||
|
),
|
||||||
|
"radial_centers": Rule(
|
||||||
|
self,
|
||||||
|
self._radial_centers,
|
||||||
|
"Centers of radial bins",
|
||||||
|
"/radial",
|
||||||
|
dependencies=["radial_bins"],
|
||||||
|
),
|
||||||
"rr": Rule(self, self._rr, "Coordinate map", "/maps"),
|
"rr": Rule(self, self._rr, "Coordinate map", "/maps"),
|
||||||
"bins_on_map": Rule(
|
"bins_on_map": Rule(
|
||||||
self,
|
self,
|
||||||
@@ -1634,7 +1651,7 @@ class PostProcessor(HDF5Container):
|
|||||||
partial(self._rad_avg, name),
|
partial(self._rad_avg, name),
|
||||||
"Azimuthal average of {}".format(name),
|
"Azimuthal average of {}".format(name),
|
||||||
"/radial",
|
"/radial",
|
||||||
dependencies=["radial_bins", "bins_on_map", name],
|
dependencies=["radial_centers", "bins_on_map", name],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.rules["avg_map_" + name] = Rule(
|
self.rules["avg_map_" + name] = Rule(
|
||||||
@@ -1642,7 +1659,7 @@ class PostProcessor(HDF5Container):
|
|||||||
partial(self._rad_avg_map, name),
|
partial(self._rad_avg_map, name),
|
||||||
"Interpolated map of azimuthal average of {}".format(name),
|
"Interpolated map of azimuthal average of {}".format(name),
|
||||||
"/maps",
|
"/maps",
|
||||||
dependencies=["radial_bins", "bins_on_map", "rr", "rad_avg_" + name],
|
dependencies=["radial_centers", "bins_on_map", "rad_avg_" + name],
|
||||||
)
|
)
|
||||||
self.rules["fluct_" + name] = Rule(
|
self.rules["fluct_" + name] = Rule(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user