Add preliminary power spectrum integration
This commit is contained in:
+21
@@ -17,6 +17,7 @@ if os.environ.get("DISPLAY", "") == "":
|
||||
mpl.use("Agg")
|
||||
import pylab as P
|
||||
from comparator import *
|
||||
import pspec_read
|
||||
|
||||
P.rcParams["image.cmap"] = "plasma"
|
||||
P.rcParams["savefig.dpi"] = 400
|
||||
@@ -634,6 +635,8 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
colors=None,
|
||||
nml_color=None,
|
||||
legend=None,
|
||||
subname_x=None,
|
||||
subname_y=None,
|
||||
**kwargs
|
||||
):
|
||||
|
||||
@@ -643,6 +646,13 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
node_x = self.save.get_node(name_x)
|
||||
node_y = self.save.get_node(name_y)
|
||||
|
||||
if subname_x:
|
||||
hdf5_x = tables.open_file(node_x.read())
|
||||
node_x = hdf5_x.get_node(subname_x)
|
||||
if subname_y:
|
||||
hdf5_y = tables.open_file(node_y.read())
|
||||
node_y = hdf5_y.get_node(subname_y)
|
||||
|
||||
xlabel, xunit_old, xunit = self._ax_label_unit(
|
||||
node_x, xlabel, xunit, xunit_coeff
|
||||
)
|
||||
@@ -772,6 +782,16 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
color=base_line.get_color(),
|
||||
label=fitlabel,
|
||||
)
|
||||
if subname_x:
|
||||
hdf5_x.close()
|
||||
if subname_y:
|
||||
hdf5_y.close()
|
||||
|
||||
def _pspec(self, name, **kwargs):
|
||||
del kwargs["run"]
|
||||
file_pspec = self.save.get_node("/hdf5/pspec").read()
|
||||
num = self.save.root._v_attrs.num
|
||||
getattr(pspec_read, "pspec_" + name)(file_pspec, ".", num, **kwargs)
|
||||
|
||||
def _overlay_fit(self, x, y, yerr=None, kind="linear", label=None, **kwargs):
|
||||
if kind == "linear":
|
||||
@@ -943,6 +963,7 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
partial(self._plot, "/profile/axis", "/profile/rho_prof"),
|
||||
dependencies=["axis", "rho_prof"],
|
||||
),
|
||||
"pspec": PlotRule(self, self._pspec, dependencies={"pspec": None}),
|
||||
}
|
||||
|
||||
averageables = ["coldens", "rho", "T", "Q"]
|
||||
|
||||
Reference in New Issue
Block a user