Skip to content

Commit f4536b1

Browse files
authored
Merge pull request #91 from Fonotec/master
Include the SNIa rates inside the aperatures in the library
2 parents 2205042 + 32d0b8d commit f4536b1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

velociraptor/catalogue/registration.py

+26
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,31 @@ def registration_element_masses_in_stars(
15231523
return
15241524

15251525

1526+
def registration_snia_rates(
1527+
field_path: str, unit_system: VelociraptorUnits
1528+
) -> (unyt.Unit, str, str):
1529+
"""
1530+
Registers the SNIa rates within apertures
1531+
"""
1532+
1533+
unit = unit_system.velocity / unit_system.length
1534+
# Capture aperture size
1535+
match_string = "Aperture_SNIaRates_aperture_total_star_([0-9]*)_kpc"
1536+
regex = cached_regex(match_string)
1537+
1538+
match = regex.match(field_path)
1539+
1540+
if match:
1541+
aperture_size = match.group(1)
1542+
1543+
full_name = f"SNIa rate ({aperture_size} kpc)"
1544+
snake_case = f"snia_rates_{aperture_size}_kpc"
1545+
1546+
return unit, full_name, snake_case
1547+
else:
1548+
raise RegistrationDoesNotMatchError
1549+
1550+
15261551
# TODO
15271552
# lambda_B
15281553
# q
@@ -1545,6 +1570,7 @@ def registration_element_masses_in_stars(
15451570
global_registration_functions = {
15461571
k: globals()[f"registration_{k}"]
15471572
for k in [
1573+
"snia_rates",
15481574
"metallicity",
15491575
"ids",
15501576
"energies",

0 commit comments

Comments
 (0)