This commit is contained in:
Noe Brucy
2023-05-05 19:31:41 +02:00
parent 320fecf805
commit 037ddad596

View File

@@ -332,9 +332,9 @@ class Galsec:
spacing between two y bins
"""
for fluid in self.fluids:
x_bin = np.trunc(self.data[fluid]["pos"][:, 0] / delta_x)
y_bin = np.trunc(self.data[fluid]["pos"][:, 0] / delta_y)
z_bin = np.trunc(self.data[fluid]["pos"][:, 0] / delta_z)
x_bin = np.trunc(self.data[fluid]["position"][:, 0] / delta_x)
y_bin = np.trunc(self.data[fluid]["position"][:, 0] / delta_y)
z_bin = np.trunc(self.data[fluid]["position"][:, 0] / delta_z)
self.data[fluid]["x_bin"] = x_bin
self.data[fluid]["y_bin"] = y_bin
self.data[fluid]["z_bin"] = z_bin
@@ -407,7 +407,7 @@ class Galsec:
zmin: Quantity[u.kpc] = -0.5 * u.kpc,
zmax: Quantity[u.kpc] = 0.5 * u.kpc,
):
"""Compute the aggration of quantities in sectors bins
"""Compute the aggration of quantities in cartesian bins
Parameters
----------
@@ -419,7 +419,7 @@ class Galsec:
self.cartesian_binning(delta_x, delta_y, delta_z)
self.grouped_data = {}
self.sectors = {}
self.grid = {}
for fluid in self.fluids:
if fluid == "gas":
@@ -431,7 +431,7 @@ class Galsec:
& (self.data[fluid]["position"][:, 2] < zmax)
]
self.grouped_data[fluid] = filtered_data.group_by(["x_bin", "y_bin", "z_bin"])
self.sectors[fluid] = hstack(
self.grid[fluid] = hstack(
[
self.grouped_data[fluid]["x_bin", "y_bin", "z_bin"].groups.aggregate(
np.fmin
@@ -441,17 +441,17 @@ class Galsec:
),
]
)
self.sectors[fluid].rename_column("x_bin", "x")
self.sectors[fluid].rename_column("y_bin", "y")
self.sectors[fluid].rename_column("z_bin", "z")
self.grid[fluid].rename_column("x_bin", "x")
self.grid[fluid].rename_column("y_bin", "y")
self.grid[fluid].rename_column("z_bin", "z")
self.sectors["stars"]["sfr"] = (
np.zeros(len(self.sectors["stars"]["mass"])) * u.Msun / u.year
self.grid["stars"]["sfr"] = (
np.zeros(len(self.grid["stars"]["mass"])) * u.Msun / u.year
)
for i, group in enumerate(self.grouped_data["stars"].groups):
self.sectors["stars"]["sfr"][i] = get_sfr(group, self.time)
self.grid["stars"]["sfr"][i] = get_sfr(group, self.time)
self.sectors["stars"]["sfr"][i] = get_sfr(group, self.time)
self.grid["stars"]["sfr"][i] = get_sfr(group, self.time)
def ring_analysis(