various update

This commit is contained in:
Noe Brucy
2024-03-22 15:06:07 +01:00
parent 006cbca80f
commit ca984eac44
5 changed files with 154 additions and 61 deletions
+11 -9
View File
@@ -99,7 +99,7 @@ def quiver(ax, map_h, map_v, extent, key_v=None, lognorm=False, label="", **kwar
hh, vv = gethv(map_h, map_v, extent)
# get norm information
norm_v = np.sqrt(map_h ** 2 + map_v ** 2)
norm_v = np.sqrt(map_h**2 + map_v**2)
max_v = np.max(norm_v)
min_v = np.min(norm_v)
@@ -456,7 +456,7 @@ class Plotter(Aggregator, BaseProcessor):
run=run,
**kwargs,
)
if movie:
filenames[run].append(plot_filename)
@@ -968,8 +968,10 @@ class Plotter(Aggregator, BaseProcessor):
if sinks:
try:
self.current_processor.sinks()
data = pd.DataFrame(self.current_processor.get_value("/datasets/sinks"))
self.current_processor.load_sinks_rule()
data = pd.DataFrame(
self.current_processor.get_value("/datasets/load_sinks_rule")
)
part_pos = data[["x", "y", "z"]].values
unit_length /= self.current_processor.lbox
except KeyError:
@@ -1435,7 +1437,7 @@ class Plotter(Aggregator, BaseProcessor):
self.logger.warning(
"Errorbar may be meaningless when ytransform is used"
)
# Offset to start x when y in over a given value
if wait_until_over is not None:
offset = np.argmax(y > wait_until_over)
@@ -1480,7 +1482,7 @@ class Plotter(Aggregator, BaseProcessor):
(a, b, rho, _map_rule, stderr) = linregress(np.log10(x), np.log10(y))
self.logger.info(
"Power law fit y = x^({}) * {} with R^2 = {} and error is {}".format(
a, 10 ** b, rho, stderr
a, 10**b, rho, stderr
)
)
else:
@@ -1504,12 +1506,12 @@ class Plotter(Aggregator, BaseProcessor):
residual = errfunc(c, np.log10(x), np.log10(y), yerr / y)
self.logger.info(
"Power law fit y = x^({}) * {} with residual {}".format(
a, 10 ** b, residual
a, 10**b, residual
)
)
if label is None:
label = r"Power-law fit with index {:.1f}".format(a)
plt.plot(x, (10 ** b) * x ** a, label=label, **kwargs)
plt.plot(x, (10**b) * x**a, label=label, **kwargs)
def _gen_from_log(self, logrule, name_y, name_x="time", description="Generated"):
if name_x == "time":
@@ -1723,7 +1725,7 @@ class Plotter(Aggregator, BaseProcessor):
"/series/sinks_from_log/time",
"/series/sinks_from_log/ssm",
xunit=U.Myr,
yunit=U.Msun / U.pc ** 2,
yunit=U.Msun / U.pc**2,
),
"Mass of the sinks as a function of time divided by surface",
kind="run",