1
1
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
2
- # Last modified by David J Turner (turne540@msu.edu) 14 /07/2025, 08:55 . Copyright (c) The Contributors
2
+ # Last modified by David J Turner (turne540@msu.edu) 18 /07/2025, 10:21 . Copyright (c) The Contributors
3
3
4
4
from typing import List
5
5
@@ -524,7 +524,7 @@ def _get_overdens_rad_checks(self, rad_name: str) -> Quantity:
524
524
rad = gcs .get_radius (rad_name , 'kpc' )
525
525
# Result could be None, if the radius wasn't set for that clusters, have to account for that
526
526
if rad is None :
527
- rads .append (np .NaN )
527
+ rads .append (np .nan )
528
528
else :
529
529
rads .append (rad )
530
530
@@ -688,24 +688,24 @@ def Tx(self, telescope: str, outer_radius: Union[str, Quantity] = 'r500', model:
688
688
# If the measured temperature is 64keV I know that's a failure condition of the XSPEC fit,
689
689
# so its set to NaN
690
690
if quality_checks and gcs_temp [0 ] > 25 :
691
- gcs_temp = np .array ([np .NaN , np .NaN , np .NaN ])
691
+ gcs_temp = np .array ([np .nan , np .nan , np .nan ])
692
692
warn ("A temperature of {m}keV was measured for {s}, anything over 30keV considered a failed "
693
693
"fit by XGA" .format (s = gcs .name , m = gcs_temp ), stacklevel = 2 )
694
694
elif quality_checks and gcs_temp .min () < 0 :
695
- gcs_temp = np .array ([np .NaN , np .NaN , np .NaN ])
695
+ gcs_temp = np .array ([np .nan , np .nan , np .nan ])
696
696
warn ("A negative value was detected in the temperature array for {s}, this is considered a failed "
697
697
"measurement" .format (s = gcs .name ), stacklevel = 2 )
698
698
elif quality_checks and ((gcs_temp [0 ] - gcs_temp [1 ]) <= 0 ):
699
- gcs_temp = np .array ([np .NaN , np .NaN , np .NaN ])
699
+ gcs_temp = np .array ([np .nan , np .nan , np .nan ])
700
700
warn ("The temperature value - the lower error goes below zero for {s}, this makes the temperature"
701
701
" hard to use for scaling relations as values are often logged." .format (s = gcs .name ),
702
702
stacklevel = 2 )
703
703
elif quality_checks and ((gcs_temp [1 ] / gcs_temp [2 ]) > 3 or (gcs_temp [1 ] / gcs_temp [2 ]) < 0.33 ):
704
- gcs_temp = np .array ([np .NaN , np .NaN , np .NaN ])
704
+ gcs_temp = np .array ([np .nan , np .nan , np .nan ])
705
705
warn ("One of the temperature uncertainty values for {s} is more than three times larger than "
706
706
"the other, this means the fit quality is suspect." .format (s = gcs .name ), stacklevel = 2 )
707
707
elif quality_checks and ((gcs_temp [0 ] - gcs_temp [1 :].mean ()) < 0 ):
708
- gcs_temp = np .array ([np .NaN , np .NaN , np .NaN ])
708
+ gcs_temp = np .array ([np .nan , np .nan , np .nan ])
709
709
warn ("The temperature value - the average error goes below zero for {s}, this makes the "
710
710
"temperature hard to use for scaling relations as values are often logged" .format (s = gcs .name ),
711
711
stacklevel = 2 )
@@ -716,7 +716,7 @@ def Tx(self, telescope: str, outer_radius: Union[str, Quantity] = 'r500', model:
716
716
# If any of the possible errors are thrown, we print the error as a warning and replace
717
717
# that entry with a NaN
718
718
warn (str (err ), stacklevel = 2 )
719
- temps .append (np .array ([np .NaN , np .NaN , np .NaN ]))
719
+ temps .append (np .array ([np .nan , np .nan , np .nan ]))
720
720
721
721
# Turn the list of 3 element arrays into an Nx3 array which is then turned into an astropy Quantity
722
722
temps = Quantity (np .array (temps ), 'keV' )
@@ -820,29 +820,29 @@ def gas_mass(self, rad_name: str, telescope: str, dens_model: str, method: str,
820
820
try :
821
821
cur_gmass = dens_profs .gas_mass (dens_model , gas_mass_rad )[0 ]
822
822
if quality_checks and (cur_gmass [1 ] > cur_gmass [0 ] or cur_gmass [2 ] > cur_gmass [0 ]):
823
- gms .append ([np .NaN , np .NaN , np .NaN ])
823
+ gms .append ([np .nan , np .nan , np .nan ])
824
824
elif quality_checks and cur_gmass [0 ] < Quantity (1e+9 , 'Msun' ):
825
- gms .append ([np .NaN , np .NaN , np .NaN ])
825
+ gms .append ([np .nan , np .nan , np .nan ])
826
826
warn ("{s}'s gas mass is less than 1e+12 solar masses" , stacklevel = 2 )
827
827
elif quality_checks and cur_gmass [0 ] > Quantity (1e+16 , 'Msun' ):
828
- gms .append ([np .NaN , np .NaN , np .NaN ])
828
+ gms .append ([np .nan , np .nan , np .nan ])
829
829
warn ("{s}'s gas mass is greater than 1e+16 solar masses" , stacklevel = 2 )
830
830
else :
831
831
gms .append (cur_gmass .value )
832
832
except ModelNotAssociatedError :
833
- gms .append ([np .NaN , np .NaN , np .NaN ])
833
+ gms .append ([np .nan , np .nan , np .nan ])
834
834
except ValueError :
835
- gms .append ([np .NaN , np .NaN , np .NaN ])
835
+ gms .append ([np .nan , np .nan , np .nan ])
836
836
warn ("{s}'s gas mass is negative" , stacklevel = 2 )
837
837
838
838
else :
839
839
warn ("Somehow there multiple matches for {s}'s density profile, this is the developer's "
840
840
"fault." .format (s = gcs .name ), stacklevel = 2 )
841
- gms .append ([np .NaN , np .NaN , np .NaN ])
841
+ gms .append ([np .nan , np .nan , np .nan ])
842
842
843
843
except NoProductAvailableError :
844
844
# If no dens_prof has been run or something goes wrong then NaNs are added
845
- gms .append ([np .NaN , np .NaN , np .NaN ])
845
+ gms .append ([np .nan , np .nan , np .nan ])
846
846
warn ("{s} doesn't have a density profile associated, please look at "
847
847
"sourcetools.density." .format (s = gcs .name ), stacklevel = 2 )
848
848
@@ -902,23 +902,23 @@ def hydrostatic_mass(self, rad_name: str, telescope: str, temp_model_name: str =
902
902
try :
903
903
cur_mass = mass_profs .mass (actual_rad )[0 ]
904
904
if quality_checks and (cur_mass [1 ] > cur_mass [0 ] or cur_mass [2 ] > cur_mass [0 ]):
905
- ms .append ([np .NaN , np .NaN , np .NaN ])
905
+ ms .append ([np .nan , np .nan , np .nan ])
906
906
warn ("{s}'s mass uncertainties are larger than the mass value." , stacklevel = 2 )
907
907
elif quality_checks and cur_mass [0 ] < Quantity (1e+12 , 'Msun' ):
908
- ms .append ([np .NaN , np .NaN , np .NaN ])
908
+ ms .append ([np .nan , np .nan , np .nan ])
909
909
warn ("{s}'s mass is less than 1e+12 solar masses" , stacklevel = 2 )
910
910
elif quality_checks and cur_mass [0 ] > Quantity (1e+16 , 'Msun' ):
911
- ms .append ([np .NaN , np .NaN , np .NaN ])
911
+ ms .append ([np .nan , np .nan , np .nan ])
912
912
warn ("{s}'s mass is greater than 1e+16 solar masses" , stacklevel = 2 )
913
913
else :
914
914
ms .append (cur_mass .value )
915
915
except ValueError :
916
916
warn ("{s}'s mass is negative" , stacklevel = 2 )
917
- ms .append ([np .NaN , np .NaN , np .NaN ])
917
+ ms .append ([np .nan , np .nan , np .nan ])
918
918
919
919
except NoProductAvailableError :
920
920
# If no dens_prof has been run or something goes wrong then NaNs are added
921
- ms .append ([np .NaN , np .NaN , np .NaN ])
921
+ ms .append ([np .nan , np .nan , np .nan ])
922
922
warn ("{s} doesn't have a matching hydrostatic mass profile associated" .format (s = gcs .name ),
923
923
stacklevel = 2 )
924
924
@@ -989,11 +989,11 @@ def calc_overdensity_radii(self, delta: int, telescope: str, temp_model_name: st
989
989
"didn't bracket the requested overdensity radius. See the docs of overdensity_radius "
990
990
"method of HydrostaticMass for more info." .format (s = gcs .name ), stacklevel = 2 )
991
991
992
- rs .append (np .NaN )
992
+ rs .append (np .nan )
993
993
994
994
except NoProductAvailableError :
995
995
# If no dens_prof has been run or something goes wrong then NaNs are added
996
- rs .append (np .NaN )
996
+ rs .append (np .nan )
997
997
warn ("{s} doesn't have a matching hydrostatic mass profile associated" .format (s = gcs .name ),
998
998
stacklevel = 2 )
999
999
0 commit comments