@@ -842,7 +842,12 @@ def registration_number(
842
842
843
843
if field_path [:2 ] == "n_" :
844
844
unit = unyt .dimensionless
845
- switch = {"bh" : "Black Hole" , "gas" : "Gas" , "star" : "Star" , "interloper" : "Interloper" }
845
+ switch = {
846
+ "bh" : "Black Hole" ,
847
+ "gas" : "Gas" ,
848
+ "star" : "Star" ,
849
+ "interloper" : "Interloper" ,
850
+ }
846
851
snake_case = field_path [2 :]
847
852
full_name = f"Number of { switch .get (snake_case , 'Unknown' )} Particles"
848
853
@@ -857,6 +862,43 @@ def registration_number(
857
862
return unit , full_name , snake_case
858
863
859
864
865
+ def registration_gas_species_masses (
866
+ field_path : str , unit_system : VelociraptorUnits
867
+ ) -> (unyt .Unit , str , str ):
868
+ """
869
+ Registers the HI masses in apertures.
870
+ """
871
+
872
+ unit = unit_system .mass
873
+
874
+ # Capture aperture size
875
+ match_string = (
876
+ "Aperture_([a-zA-Z]*)_index_0_aperture_total_gas_([0-9]*)_kpc"
877
+ )
878
+ regex = cached_regex (match_string )
879
+
880
+ match = regex .match (field_path )
881
+
882
+ if match :
883
+ long_species = match .group (1 )
884
+ aperture_size = match .group (2 )
885
+
886
+ try :
887
+ short_species = {
888
+ "AtomicHydrogenMasses" : "HI" ,
889
+ "MolecularHydrogenMasses" : "H2" ,
890
+ }[long_species ]
891
+ except KeyError :
892
+ raise RegistrationDoesNotMatchError
893
+
894
+ full_name = f"{ short_species } gas mass ({ aperture_size } kpc)"
895
+ snake_case = f"{ short_species } _mass_{ aperture_size } _kpc"
896
+
897
+ return unit , full_name , snake_case
898
+ else :
899
+ raise RegistrationDoesNotMatchError
900
+
901
+
860
902
def registration_hydrogen_phase_fractions (
861
903
field_path : str , unit_system : VelociraptorUnits
862
904
) -> (unyt .Unit , str , str ):
@@ -1124,6 +1166,7 @@ def registration_spherical_overdensities(
1124
1166
"stellar_birth_densities" ,
1125
1167
"snii_thermal_feedback_densities" ,
1126
1168
"species_fractions" ,
1169
+ "gas_species_masses" ,
1127
1170
"fail_all" ,
1128
1171
]
1129
1172
}
0 commit comments