[turbox] bug of unmached runs
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
from .turbox import (
|
from .turbox import (
|
||||||
get_pspec,
|
get_pspec,
|
||||||
get_pspec_slope,
|
get_pspec_slope,
|
||||||
build_suite,
|
build_turbox_data,
|
||||||
apply_rule_pdf,
|
apply_rule_pdf,
|
||||||
span_resolution,
|
span_resolution,
|
||||||
)
|
)
|
||||||
|
|||||||
+21
-23
@@ -91,7 +91,7 @@ def get_pspec_slope(pp, field: str, resol: int, plotdebug: bool = False):
|
|||||||
return results.slope, results.intercept, results.rvalue**2
|
return results.slope, results.intercept, results.rvalue**2
|
||||||
|
|
||||||
|
|
||||||
def build_suite(pl, redo=False, cs0=0.28834810480560674):
|
def build_turbox_data(pl, redo=False, cs0=0.28834810480560674):
|
||||||
"""Compute an array of parameter for each run in the Plotter pl
|
"""Compute an array of parameter for each run in the Plotter pl
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -132,35 +132,33 @@ def build_suite(pl, redo=False, cs0=0.28834810480560674):
|
|||||||
pl.study.avg_time_sigma("z", overwrite_dep=False)
|
pl.study.avg_time_sigma("z", overwrite_dep=False)
|
||||||
pl.study.time(overwrite=True)
|
pl.study.time(overwrite=True)
|
||||||
|
|
||||||
|
df["time"] = np.empty(len(pl.runs), dtype=list)
|
||||||
|
time = pl.study.get_value("/series/time", unit=U.Myr)
|
||||||
|
for run in pl.runs:
|
||||||
|
time[run] = list(time[run].T[0])
|
||||||
|
df["time"][run] = time[run]
|
||||||
|
print(run, time[run])
|
||||||
|
|
||||||
|
sigma1d = []
|
||||||
for ax in ["x", "y", "z"]:
|
for ax in ["x", "y", "z"]:
|
||||||
df[f"sigma_{ax}"] = np.array(
|
sigma_ax = pl.study.get_value(f"/series/time_sigma_{ax}", unit=U.km_s)
|
||||||
list(
|
for run in sigma_ax:
|
||||||
map(
|
sigma_ax[run] = sigma_ax[run].T[0]
|
||||||
lambda x: x.T[0],
|
sigma1d.append(sigma_ax)
|
||||||
[
|
|
||||||
pl.study.get_value(f"/series/time_sigma_{ax}", unit=U.km_s)[run]
|
|
||||||
for run in pl.runs
|
|
||||||
],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
df["sigma_all"] = df["sigma_x"] ** 2 + df["sigma_y"] ** 2 + df["sigma_z"] ** 2
|
sigma3d = {}
|
||||||
df["sigma_all"] = list(map(np.sqrt, df["sigma_all"].values))
|
for run in pl.runs:
|
||||||
df["Mach_all"] = list(map(lambda v: v / cs0, df["sigma_all"].values))
|
sigma3d[run] = np.sum([sigma1d_i[run]**2 for sigma1d_i in sigma1d], axis=0)
|
||||||
df["time"] = list(
|
sigma3d[run] = list(map(np.sqrt, sigma3d[run]))
|
||||||
map(
|
|
||||||
lambda x: x.T[0],
|
|
||||||
[pl.study.get_value("/series/time", unit=U.Myr)[run] for run in pl.runs],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
df["sigma"] = list(map(lambda sig_list: np.mean(sig_list), df["sigma_all"].values))
|
df["sigma"] = np.zeros(len(pl.runs))
|
||||||
|
for run in pl.runs:
|
||||||
|
df["sigma"][run] = np.mean(sigma3d[run])
|
||||||
df["Mach"] = df["sigma"] / cs0
|
df["Mach"] = df["sigma"] / cs0
|
||||||
df["turnover"] = (df["L"] * U.pc.express(U.km) / (2 * df["sigma"])) * U.s.express(
|
df["turnover"] = (df["L"] * U.pc.express(U.km) / (2 * df["sigma"])) * U.s.express(
|
||||||
U.Myr
|
U.Myr
|
||||||
)
|
)
|
||||||
|
pl.turbox = df
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user