@@ -1443,6 +1443,45 @@ def registration_spherical_overdensities(
1443
1443
return unit , full_name , snake_case
1444
1444
else :
1445
1445
raise RegistrationDoesNotMatchError
1446
+
1447
+
1448
+ def registration_element_masses_in_stars (
1449
+ field_path : str , unit_system : VelociraptorUnits
1450
+ ) -> (unyt .Unit , str , str ):
1451
+ """
1452
+ Registers element masses contained in stars
1453
+ """
1454
+
1455
+ unit = unit_system .mass
1456
+
1457
+ # Capture aperture size
1458
+ match_string = "Aperture_([a-zA-Z]*)Masses_aperture_total_star_([0-9]*)_kpc"
1459
+ regex = cached_regex (match_string )
1460
+ match = regex .match (field_path )
1461
+
1462
+ if match :
1463
+ element = match .group (1 )
1464
+ aperture_size = match .group (2 )
1465
+
1466
+ try :
1467
+ field = {
1468
+ "Oxygen" : "Total Oxygen mass in stars" ,
1469
+ "Magnesium" : "Total Magnesium mass in stars" ,
1470
+ "Iron" : "Total Iron mass in stars" ,
1471
+ }[element ]
1472
+ except KeyError :
1473
+ raise RegistrationDoesNotMatchError
1474
+
1475
+ full_name = f"{ field } computed in apertures of size ({ aperture_size } kpc)"
1476
+
1477
+ snake_case = f"{ element .lower ()} _mass_{ aperture_size } _kpc"
1478
+
1479
+ return unit , full_name , snake_case
1480
+ else :
1481
+ raise RegistrationDoesNotMatchError
1482
+
1483
+ return
1484
+
1446
1485
1447
1486
# TODO
1448
1487
# lambda_B
@@ -1503,6 +1542,7 @@ def registration_spherical_overdensities(
1503
1542
"cold_dense_gas_properties" ,
1504
1543
"log_element_ratios_times_masses" ,
1505
1544
"lin_element_ratios_times_masses" ,
1545
+ "element_masses_in_stars" ,
1506
1546
"fail_all" ,
1507
1547
]
1508
1548
}
0 commit comments