black (still without mortimer)

This commit is contained in:
Noe Brucy
2023-01-30 12:12:14 +01:00
parent 8c3db9b7cb
commit 1a8db42d29
11 changed files with 474 additions and 99 deletions
+7 -2
View File
@@ -1,2 +1,7 @@
from .turbox import get_pspec, get_pspec_slope, build_suite, apply_rule_pdf, span_resolution
from .turbox import (
get_pspec,
get_pspec_slope,
build_suite,
apply_rule_pdf,
span_resolution,
)
+3 -3
View File
@@ -81,14 +81,14 @@ def get_pspec_slope(pp, field: str, resol: int, plotdebug: bool = False):
f"Fit results in get_slope({field}, {resol}): slope:{results.slope:.2f}"
+ f", b:{results.intercept:.2f}, R2:{results.rvalue**2:.2f}"
)
if results.rvalue ** 2 < 0.8:
if results.rvalue**2 < 0.8:
pp.logger.warning(
f"Bad fit in get_slope({field}, {resol}) with {logkmin} <= logk < {logkmax}"
)
pp.logger.warning(f"log(k) is \n {logk[mask]}")
pp.logger.warning(f"log(power) is \n {logpower[mask]}")
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):
@@ -155,7 +155,7 @@ def build_suite(pl, redo=False, cs0=0.28834810480560674):
)
)
df["sigma"] = list(map(lambda l: np.mean(l), df["sigma_all"].values))
df["sigma"] = list(map(lambda sig_list: np.mean(sig_list), df["sigma_all"].values))
df["Mach"] = df["sigma"] / cs0
df["turnover"] = (df["L"] * U.pc.express(U.km) / (2 * df["sigma"])) * U.s.express(
U.Myr