[plotter] change kind name. For kind=comp, do only one plot ;)

This commit is contained in:
Noe Brucy
2021-01-31 17:25:28 +01:00
parent 8befb9ba37
commit 7aa08c1394
2 changed files with 17 additions and 16 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ class Rule:
description="", description="",
group="", group="",
dependencies=[], dependencies=[],
kind="classic", kind="snapshot",
unit=U.none, unit=U.none,
): ):
self.postproc = postproc self.postproc = postproc
+16 -15
View File
@@ -299,8 +299,10 @@ class Plotter(Aggregator, BaseProcessor):
datafiles = [] datafiles = []
# Several plots # Several plots
if rule.kind == "classic" or rule.kind == "cells": if rule.kind == "snapshot" or rule.kind == "cells":
run_num = [(run, num) for run in runs for num in nums[run]] run_num = [(run, num) for run in runs for num in nums[run]]
elif rule.kind == "comp":
run_num = [(None, None)]
else: else:
run_num = [(run, None) for run in runs] run_num = [(run, None) for run in runs]
@@ -325,7 +327,7 @@ class Plotter(Aggregator, BaseProcessor):
self.pp[run][num].load_cells() self.pp[run][num].load_cells()
self.pp[run][num].unload_cells() self.pp[run][num].unload_cells()
save = tables.open_file(self.pp[run][num].cells_filename) save = tables.open_file(self.pp[run][num].cells_filename)
elif rule.kind == "classic": elif rule.kind == "snapshot":
save = tables.open_file(self.pp[run][num].filename) save = tables.open_file(self.pp[run][num].filename)
else: else:
save = tables.open_file(self.comp.filename, "r") save = tables.open_file(self.comp.filename, "r")
@@ -1219,7 +1221,7 @@ class Plotter(Aggregator, BaseProcessor):
"/series/" + logrule + "/" + name_y, "/series/" + logrule + "/" + name_y,
), ),
description=description, description=description,
kind="series", kind="run",
dependencies=[logrule], dependencies=[logrule],
) )
@@ -1228,7 +1230,6 @@ class Plotter(Aggregator, BaseProcessor):
This is where rules are defined This is where rules are defined
""" """
self.rules = { self.rules = {
# Generic rules
"plot": PlotRule( "plot": PlotRule(
self, lambda arg, **kwargs: self._plot(*arg, **kwargs), kind="comp" self, lambda arg, **kwargs: self._plot(*arg, **kwargs), kind="comp"
), ),
@@ -1490,7 +1491,7 @@ class Plotter(Aggregator, BaseProcessor):
yunit=U.Msun, yunit=U.Msun,
), ),
"Mass of the sinks as a function of time", "Mass of the sinks as a function of time",
kind="series", kind="run",
dependencies=["sinks_from_log"], dependencies=["sinks_from_log"],
), ),
"ssm": PlotRule( "ssm": PlotRule(
@@ -1503,7 +1504,7 @@ class Plotter(Aggregator, BaseProcessor):
yunit=U.Msun / U.pc ** 2, yunit=U.Msun / U.pc ** 2,
), ),
"Mass of the sinks as a function of time divided by surface", "Mass of the sinks as a function of time divided by surface",
kind="series", kind="run",
dependencies=["ssm"], dependencies=["ssm"],
), ),
"assfr": PlotRule( "assfr": PlotRule(
@@ -1516,7 +1517,7 @@ class Plotter(Aggregator, BaseProcessor):
xunit=U.Myr, xunit=U.Myr,
yunit=U.ssfr, yunit=U.ssfr,
), ),
kind="series", kind="run",
dependencies=["sfr_from_log"], dependencies=["sfr_from_log"],
), ),
"issfr": PlotRule( "issfr": PlotRule(
@@ -1529,7 +1530,7 @@ class Plotter(Aggregator, BaseProcessor):
xunit=U.Myr, xunit=U.Myr,
yunit=U.ssfr, yunit=U.ssfr,
), ),
kind="series", kind="run",
dependencies=["issfr"], dependencies=["issfr"],
), ),
"turb_rms": PlotRule( "turb_rms": PlotRule(
@@ -1541,7 +1542,7 @@ class Plotter(Aggregator, BaseProcessor):
xunit=U.Myr, xunit=U.Myr,
), ),
"Turbulent RMS", "Turbulent RMS",
kind="series", kind="run",
dependencies=["rms_from_log"], dependencies=["rms_from_log"],
), ),
"turb_energy": PlotRule( "turb_energy": PlotRule(
@@ -1553,7 +1554,7 @@ class Plotter(Aggregator, BaseProcessor):
xunit=U.Myr, xunit=U.Myr,
), ),
"Turbulent energy", "Turbulent energy",
kind="series", kind="run",
dependencies=["rms_from_log"], dependencies=["rms_from_log"],
), ),
"turb_power": PlotRule( "turb_power": PlotRule(
@@ -1565,7 +1566,7 @@ class Plotter(Aggregator, BaseProcessor):
xunit=U.Myr, xunit=U.Myr,
), ),
"Turbulent power", "Turbulent power",
kind="series", kind="run",
dependencies=["turb_power"], dependencies=["turb_power"],
), ),
"sigma": PlotRule( "sigma": PlotRule(
@@ -1579,7 +1580,7 @@ class Plotter(Aggregator, BaseProcessor):
yunit=U.km_s, yunit=U.km_s,
), ),
"Velocity dispersion", "Velocity dispersion",
kind="series", kind="run",
dependencies=["time_sigma"], dependencies=["time_sigma"],
), ),
"mwa_B_int": PlotRule( "mwa_B_int": PlotRule(
@@ -1592,7 +1593,7 @@ class Plotter(Aggregator, BaseProcessor):
yunit=U.uG, yunit=U.uG,
), ),
"Magnetic intensity average", "Magnetic intensity average",
kind="series", kind="run",
dependencies=["time_mwa_B_int"], dependencies=["time_mwa_B_int"],
), ),
"mass": PlotRule( "mass": PlotRule(
@@ -1605,7 +1606,7 @@ class Plotter(Aggregator, BaseProcessor):
yunit=U.Msun, yunit=U.Msun,
), ),
"Total mass in the box", "Total mass in the box",
kind="series", kind="run",
dependencies=["time_mass"], dependencies=["time_mass"],
), ),
"max_fluct_coldens": PlotRule( "max_fluct_coldens": PlotRule(
@@ -1618,7 +1619,7 @@ class Plotter(Aggregator, BaseProcessor):
xunit=U.Myr, xunit=U.Myr,
), ),
"Maximal fluctuation of the column density against time", "Maximal fluctuation of the column density against time",
kind="series", kind="run",
dependencies={"time_max_fluct_coldens": "z"}, dependencies={"time_max_fluct_coldens": "z"},
), ),
} }