Skip to content

Commit c84c6b9

Browse files
authored
Merge pull request #47 from SWIFTSIM/add_snii_birth_density_plots
Add registration for the field "SNII thermal feedback density"
2 parents acbd0b2 + 566b27e commit c84c6b9

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

velociraptor/catalogue/registration.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def registration_fail_all(
3232
information that is available from the velociraptor catalogue
3333
3434
Return signature:
35-
35+
3636
+ field_units: the units that correspond to field_path.
3737
+ name: A fancy (possibly LaTeX'd) name for the field.
3838
+ snake_case: A correct snake_case name for the field.
@@ -954,6 +954,39 @@ def registration_stellar_birth_densities(
954954
return
955955

956956

957+
def registration_snii_thermal_feedback_densities(
958+
field_path: str, unit_system: VelociraptorUnits
959+
) -> (unyt.Unit, str, str):
960+
"""
961+
SNII thermal feedback density registrations.
962+
"""
963+
964+
if (
965+
not field_path[:14] == "DensitiesAtLastSupernovaEvent"
966+
and field_path[-4:] == "gas"
967+
):
968+
raise RegistrationDoesNotMatchError
969+
970+
unit = unit_system.mass / unit_system.length ** 3
971+
972+
# Need to do a regex search (average, min, max)
973+
match_string = "DensitiesAtLastSupernovaEvent_([a-z]+)_gas"
974+
regex = cached_regex(match_string)
975+
match = regex.match(field_path)
976+
977+
if match:
978+
minmax = match.group(1)
979+
980+
full_name = f"SNII Thermal Feedback Density ({minmax})"
981+
snake_case = minmax.lower()
982+
983+
return unit, full_name, snake_case
984+
else:
985+
raise RegistrationDoesNotMatchError
986+
987+
return
988+
989+
957990
def registration_species_fractions(
958991
field_path: str, unit_system: VelociraptorUnits
959992
) -> (unyt.Unit, str, str):
@@ -1089,6 +1122,7 @@ def registration_spherical_overdensities(
10891122
"hydrogen_phase_fractions",
10901123
"black_hole_masses",
10911124
"stellar_birth_densities",
1125+
"snii_thermal_feedback_densities",
10921126
"species_fractions",
10931127
"fail_all",
10941128
]

0 commit comments

Comments
 (0)