Contour correction + unit uG

This commit is contained in:
Noe Brucy
2020-07-27 15:15:48 +02:00
parent 755831ce0b
commit 013aab911e
3 changed files with 12 additions and 42 deletions
-38
View File
@@ -1,38 +0,0 @@
from plotter import *
# Turb
in_dir = "/home/nbrucy/simus/ismfeed/turb"
out_dir = "/home/nbrucy/visus/ismfeed/turb"
nml_key = ["turb_params/turb_rms", "turb_params/comp_frac"]
cond1_5 = [("cloud_params/dens0", "=", 1.5), ("turb_params/turb_rms", "!=", 72000)]
cond6 = ("cloud_params/dens0", "=", 6)
nproc = 15
pl = Plotter(
in_dir,
namelist_cond=cond1_5,
in_nums="all",
sort_run_by=nml_key,
path_out=out_dir,
tag="sfr_turb",
)
pl6 = Plotter(
in_dir,
namelist_cond=cond6,
in_nums="all",
sort_run_by=nml_key,
path_out=out_dir,
tag="sfr_turb_n6",
)
pl.pp_params.process.num_process = nproc
pl6.pp_params.process.num_process = nproc
for plotter in [pl, pl6]:
plotter.process(["sigma"])
plotter.process(["coldens_l", "rho_v"], ["x, y, z"])
+7 -4
View File
@@ -500,6 +500,7 @@ class Plotter(Aggregator, BaseProcessor):
lw=None,
lvl_th=None,
lvl_max_lbl=np.inf,
lvl_offset=0,
lbl_fmt="%g",
**kwargs,
):
@@ -532,10 +533,13 @@ class Plotter(Aggregator, BaseProcessor):
levels=lvl_array,
**kwargs,
)
# used levels
lvls = np.array(cont.levels) + lvl_offset
cont.levels = lvls
P.clabel(
cont,
lvl_array[lvl_array < lvl_max_lbl],
lvls[np.array(lvls) < lvl_max_lbl],
inline=1,
fontsize=8.0,
fmt=lbl_fmt,
@@ -550,6 +554,7 @@ class Plotter(Aggregator, BaseProcessor):
im_extent,
"levels",
lbl_fmt="%1d",
lvl_offset=1,
lvl_th=8,
lvl_max_lbl=11,
**kwargs,
@@ -669,7 +674,6 @@ class Plotter(Aggregator, BaseProcessor):
if ytransform is not None:
mean_bin = ytransform(mean_bin)
P.grid()
P.xlabel(r"$r$")
if xlog:
@@ -788,7 +792,6 @@ class Plotter(Aggregator, BaseProcessor):
P.step(centers, values, where="mid", color=color, label=label, **kwargs)
else:
raise ValueError("kind must be 'bar' or 'step'")
P.grid()
if not label is None:
P.xlabel(xlabel)
@@ -834,7 +837,7 @@ class Plotter(Aggregator, BaseProcessor):
runs=None,
yerr_kind="std",
sigma_err=2.0,
grid=True,
grid=False,
put_time=False,
time_unit=cst.Myr,
colors=None,
+5
View File
@@ -75,3 +75,8 @@ cst.ssfrG = cst.create_unit(
descr="Surfacic SFR",
latex="M$_{\odot}$.Gyr$^{-1}$.pc$^{-2}$",
)
cst.uG = cst.create_unit(
"μG", base_unit=1e-10 * cst.T, descr="Micro Gauss", latex="$\mu\mathrm{G}$"
)