@@ -809,7 +809,7 @@ def saveHeaderToCatalog(
809809 def extractMainHalo (
810810 self ,
811811 save_meta = False ,
812- orient_stars = True , ## which angular momentum axis to orient along
812+ orient_component = 'cold_gas' , ## which angular momentum axis to orient along
813813 overwrite_full_snaps_with_rotated_versions = False ,
814814 free_mem = True , ## delete the full snapshot from RAM
815815 extract_DM = True , ## do we want the DM particles?
@@ -828,15 +828,12 @@ def extractMainHalo(
828828 force_phi_TB = None -- force orientation
829829 """
830830
831- if orient_stars :
832- group_name = 'star_extract'
833- else :
834- group_name = 'gas_extract'
831+ group_name = f"{ orient_component } _extract"
835832
836833 @metadata_cache (
837834 group_name ,
838835 ['sub_radius' ,
839- 'orient_stars ' ,
836+ 'orient_component ' ,
840837 'theta_TB' ,
841838 'phi_TB' ,
842839 'rvir' ,
@@ -847,7 +844,7 @@ def extractMainHalo(
847844 loud = loud )
848845 def extract_halo_inner (
849846 self ,
850- orient_stars = True ,
847+ orient_component = 'cold_gas' ,
851848 radius = None ,
852849 use_saved_subsnapshots = True ,
853850 force = False ,
@@ -863,19 +860,20 @@ def extract_halo_inner(
863860 self .star_snap ['Masses' ],
864861 n = 4 )
865862
866- if radius is None :
867- radius = self .rvir ## radius of the sub-snapshot
863+ ## calculate the stellar half-mass radius to have--
864+ ## some analyses require 5rstar_half
865+ if self .rstar_half is None : self .get_rstar_half (
866+ save_meta = save_meta ,
867+ force_from_file = True ,
868+ loud = False ,
869+ within_radius = 0.2 * self .rvir )
868870
869- ## manually calcualte rstar half using the star particles
870- ## rather than relying on the output of AHF
871- if self .rstar_half is None : self .get_rstar_half (
872- save_meta = save_meta ,
873- force_from_file = True ,
874- loud = False )
871+ if radius is None : radius = self .rvir ## radius of the sub-snapshot
875872
876- ## radius to calculate angular momentum
877- ## to orient on
878- orient_radius = 5 * self .rstar_half
873+ ## radius to calculate angular momentum to orient on
874+ #orient_radius = 5*self.rstar_half
875+ ## switched on 1/16/2023 for paper 3, also orient on cold_gas
876+ orient_radius = 0.1 * self .rvir
879877
880878 ## if this is not the first time extract_halo_inner has been
881879 ## called these properties may or may not exist
@@ -1005,7 +1003,7 @@ def extract_halo_inner(
10051003 orient_radius , ## radius to orient on
10061004 scom = self .scom ,
10071005 dark_snap = which_dark_snap , ## dark_snap = None will ignore dark matter particles
1008- orient_stars = orient_stars ,
1006+ orient_component = orient_component ,
10091007 force_theta_TB = force_theta_TB ,
10101008 force_phi_TB = force_phi_TB ,
10111009 loud = loud )
@@ -1022,7 +1020,7 @@ def extract_halo_inner(
10221020 self .sub_radius = orient_radius
10231021 ## denote whether the most recent extraction was
10241022 ## oriented on stars or gas
1025- self .orient_stars = orient_stars
1023+ self .orient_component = orient_component
10261024
10271025 if compute_stellar_hsml and 'SmoothingLength' not in self .sub_star_snap :
10281026 already_saved = False
@@ -1042,7 +1040,7 @@ def extract_halo_inner(
10421040
10431041
10441042 return (self .sub_radius ,
1045- self .orient_stars ,
1043+ self .orient_component ,
10461044 self .sub_snap ['theta_TB' ],
10471045 self .sub_snap ['phi_TB' ],
10481046 self .rvir ,
@@ -1051,7 +1049,7 @@ def extract_halo_inner(
10511049
10521050 return_value = extract_halo_inner (
10531051 self ,
1054- orient_stars = orient_stars ,
1052+ orient_component = orient_component ,
10551053 ** kwargs )
10561054
10571055 ## this should happen by default when you do an extraction but if you are
@@ -1103,10 +1101,10 @@ def get_rstar_half(self,
11031101 loud = loud ,
11041102 assert_cached = assert_cached ,
11051103 force_from_file = force_from_file )
1106- def compute_rstar_half (self ):
1104+ def compute_rstar_half (self , within_radius = None ):
11071105 self .load_stars ()
1108- return self .calculate_half_mass_radius (),
1109- return compute_rstar_half (self )
1106+ return self .calculate_half_mass_radius (within_radius = within_radius ),
1107+ return compute_rstar_half (self , ** kwargs )
11101108
11111109 def get_HSML (
11121110 self ,
@@ -1266,10 +1264,10 @@ def overwrite_full_snaps_with_rotated_versions(self,extract_DM):
12661264 snaps += [self .dark_snap ]
12671265
12681266 ## get the extraction parameters
1269- theta_TB ,phi_TB ,scom ,vscom ,orient_stars = (
1267+ theta_TB ,phi_TB ,scom ,vscom ,orient_component = (
12701268 self .sub_snap ['theta_TB' ],self .sub_snap ['phi_TB' ],
12711269 self .sub_snap ['scom' ],self .sub_snap ['vscom' ],
1272- self .sub_snap ['orient_stars ' ])
1270+ self .sub_snap ['orient_component ' ])
12731271
12741272 ## if snaps doesn't have dark snap then zipped will stop at [0,4]
12751273 for ptype ,snap in zip ([0 ,4 ,1 ],snaps ):
@@ -1279,7 +1277,7 @@ def overwrite_full_snaps_with_rotated_versions(self,extract_DM):
12791277 snap ,
12801278 scom ,vscom ,
12811279 theta_TB ,phi_TB ,
1282- orient_stars )
1280+ orient_component )
12831281
12841282 ## snapdict holds ptype -> "snap"/"star_snap"/"dark_snap"
12851283 setattr (self ,snap_dict [ptype ],snap )
0 commit comments