Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions SOAP/particle_selection/aperture_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,24 @@ def TotalSNIaRate(self) -> unyt.unyt_quantity:
self.star_mask_ap
].sum()

@lazy_property
def ExSituFraction(self) -> unyt.unyt_quantity:
"""
Mass fraction of bound stars that formed in a different subhalo.
"""
if self.Nstar == 0:
return None

group_nr = self.get_dataset("PartType4/GroupNr_bound")[self.star_mask_all][
self.star_mask_ap
]
birth_group_nr = self.get_dataset("PartType4/BirthHaloCatalogueIndex")[
self.star_mask_all
][self.star_mask_ap]
ex_situ = group_nr != birth_group_nr

return self.star_mass_fraction[ex_situ].sum()

@lazy_property
def bh_mask_all(self) -> NDArray[bool]:
"""
Expand Down Expand Up @@ -3788,6 +3806,7 @@ class ApertureProperties(HaloProperty):
"stellar_age_mw": False,
"stellar_age_lw": False,
"TotalSNIaRate": False,
"ExSituFraction": False,
"HydrogenMass": False,
"HeliumMass": False,
"MolecularHydrogenMass": False,
Expand Down
18 changes: 17 additions & 1 deletion SOAP/property_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,22 @@ class PropertyTable:
output_physical=True,
a_scale_exponent=0,
),
"ExSituFraction": Property(
name="ExSituFraction",
shape=1,
dtype=np.float32,
unit="dimensionless",
description="Mass fraction of bound stars that formed in a different subhalo",
lossy_compression_filter="FMantissa9",
dmo_property=True,
particle_properties=[
"PartType4/Masses",
"PartType4/BirthHaloCatalogueIndex",
"PartType4/GroupNr_bound",
],
output_physical=True,
a_scale_exponent=0,
),
"Mgas": Property(
name="GasMass",
shape=1,
Expand Down Expand Up @@ -5134,7 +5150,7 @@ def generate_tex_files(self, output_dir: str):
# standalone table file footer
tailstr = "\\end{document}"

# generate the auxilary documentation files
# generate the auxiliary documentation files
with open(f"{output_dir}/timestamp.tex", "w") as ofile:
ofile.write(get_version_string())
with open(f"{output_dir}/table.tex", "w") as ofile:
Expand Down
Loading