Halo Analysis Module¶
Tools for analysing IGrM and halo properties. Assume any necessary basic quantities is already prepared as the derived arrays of the snapshot.
- XIGrM.halo_analysis.correct_pos(pos, boxsize)[source]¶
Correct the position of patricles crossing the box periodical boundary.
- XIGrM.halo_analysis.get_union(catalogue, list)[source]¶
Calculate the union of the particles listed in the list.
- Parameters
- cataloguepynbody.halo.HaloCatalogue
- list
List of halos in the catalogue to get union.
- class XIGrM.halo_analysis.halo_props(halocatalogue, datatype, field={'L': ['x', 'x_cont', 'xb', 'xb_cont', 'x_corr', 'xb_corr'], 'M': ['vir', '200', '500', '2500', 'star200', 'gas200', 'bar200', 'ism200', 'cold200', 'igrm200', 'star500', 'gas500', 'bar500', 'ism500', 'cold500', 'igrm500', 'total_star', 'self_star', 'total_sfgas', 'self_sfgas'], 'R': ['vir', '200', '500', '2500'], 'S': ['500', '2500'], 'T': ['x', 'x_cont', 'xb', 'xb_corr', 'mass', 'spec', 'spec_corr', 'x_corr', 'x_corr_cont', 'mass_corr', 'spec500', 'spec2500'], 'ne': ['500', '2500'], 'nh': ['500', '2500']}, field_units={'L': 'erg s**-1', 'M': 'Msol', 'R': 'kpc', 'S': 'keV cm**2', 'T': 'keV', 'ne': 'cm**-3', 'nh': 'cm**-3'}, host_id_of_top_level=0, verbose=True)[source]¶
Bases:
object
Systematically analyse the halo X-ray properties based on other modules.
- Attributes
- datatypestr
A copy of the input type of simulation data.
- catalogue_originalpynbody.halo.HaloCatalogue
The input halo catalogue.
- lengthlength of the input catalogue.
- host_id_of_top_level
How catalogue record “hostHalo” for those halos without a host halo. Default is 0.
- errorlistlist
Record when the host halo ID of a certain subhalo is not recorded in the catalogue (weird but will happen in ahf sometimes).
- rho_crit
Critical density of the current snapshot in Msol kpc**-3.
- ovdens
Virial overdensity factor \(\Delta_{vir}\) of the current snapshot.
- dictastropy.table.Table
A copy of the halo.properties dictionary but in a table form to make future reference more convenient.
- haloid
List of halo_id given by property dictionary.
- IDlist
Table of halo_id and corresponding #ID given in the property dictionary.
- hostid
List of the halo_id of the host halo of each halo (originally recorded in the property dictionary in the form of #ID).
- new_cataloguedict
The new catalogue which includes all the subhalo particles in its host halo. The keys of the dictionary are the indexes of halos in catalogue_original.
- prop
Table of quantities corresponding to input field.
- host_list
List of host halos.
- tophost
halo_ids of the top-level host halo for each halo.
- childrenlist of sets
Each set corresponds to the one-level down children of each halo.
- galaxy_list
List of all galaxies (as long as n_star > 0).
- lumi_galaxy_list
List of all luminous galaxies (self_m_star > galaxy_low_limit).
- galaxieslist of sets
Each set corresponds to the embeded galaxies of each halo. All the subhalos will not be considered and will have an empty set. And for host halos it will include all the galaxies within it, including the galaxies actually embedded in the subhalo (i.e., the children of subhalo).
- lumi_galaxies
Each set corresponds to the embeded luminous galaxies of each halo. Same as galaxies, only care about host halo and include all the luminous galaxies within.
- n_lgal
Number of total luminous galaxies embedded in each halo. Again, only care about host halos and the galaxies within subhalos (i.e., subhalos themselves) will also be taken into account.
- group_list
halo_id of the halo identified as group in the catalogue.
- calcu_entropy(cal_file, n_par=9, halo_id_list=[], calcu_field=['500', '2500'], thickness=0.05, volume_type='full', temp_cut='5e5 K', nh_cut='0.13 cm**-3', additional_filt=None)[source]¶
Calculate all entropy within a thin spherical shell centered at halo.
- Parameters
- cal_file
Calibration file used for calculating Tspec.
- n_parint
Number of particles the shell must contain, below which entropy will not be calculated.
- halo_id_list
List of halo_ids to calculate entropies. If set to empty list, then will use self.group_list.
- calcu_field
Radii of the thin shell to calculate entropies.
- thicknessfloat
Thickness Devided by radius of the spherical shell, i.e., the shell will be R~(1+thickness)*R.
- volumestr
Volume used for calculating average electron number density. ‘gas’ means only using the sum over the volumes of all hot diffuse gas particles. ‘full’ means to use 4*pi*R^2*dR.
- temp_cut
Temperature limit above which gas particles are considered as hot.
- nh_cut
nh limit above which gas particles are considered as star forming.
- additional_filt
Any additional filter used to constrain the hot diffuse gas we are investigating.
- calcu_metallicity(halo_id_list=[], elements=['H', 'O', 'Si', 'Fe'], radii=['500'], temp_cut='5e5 K', nh_cut='0.13 cm**-3', additional_filt=None, weight_types=['mass', 'Lx'], metal_idx=None)[source]¶
- calcu_radii_masses(halo_id_list=[], rdict=None, precision=0.01, rmax=None)[source]¶
Calculate radii (Rvir, R200, etc) and corresponding masses.
- Parameters
- halo_id_list
List of halo_ids to calculate radii and masses. If set to empty list, then will use self.group_list.
- rdictdict
names and values for overdensity factors. Default is: {‘vir’: self.ovdens, ‘200’: 200, ‘500’: 500, ‘2500’: 2500}
- precisionfloat
Precision for calculate radius. See get_index() in calculate_R.py documentation for detail.
- rmax
Maximum value for the shrinking sphere method. See get_index() in calculate_R.py documentation for detail.
- calcu_specific_masses(halo_id_list=[], calcu_field=['200', '500'], temp_cut='5e5 K', nh_cut='0.13 cm**-3')[source]¶
Calculate some specific masses, such as baryon, IGrM, etc.
- Parameters
- halo_id_list
List of halo_ids to calculate masses. If set to empty list, then will use self.group_list.
- calcu_field
Radii to calculate specific masses within.
- temp_cut
Temperature limit above which gas particles are considered as hot.
- nh_cut
nh limit above which gas particles are considered as star forming.
- calcu_temp_lumi(cal_file, halo_id_list=[], core_corr_factor=0.15, calcu_field='500', temp_cut='5e5 K', nh_cut='0.13 cm**-3', additional_filt=None)[source]¶
Calculate all the temperatures and luminosities listed in temp_field and luminosity_field.
- Parameters
- cal_file
Calibration file used for calculating Tspec.
- halo_id_list
List of halo_ids to calculate temperatures and luminosities. If set to empty list, then will use self.group_list.
- core_corr_factor
Inner radius for calculating core-corrected temperatures. Gas particles within (core_corr_factor*R, R) will be used for calculation.
- calcu_field
Radius to calculate temperatures and luminosities within. Must be in radius_field. Default: R_500.
- temp_cut
Temperature limit above which gas particles are considered as hot.
- nh_cut
nh limit above which gas particles are considered as star forming.
- additional_filt
Any additional filter used to constrain the hot diffuse gas we are investigating.
- calcu_tspec(cal_file, halo_id_list=[], core_corr_factor=0.15, calcu_field='500', temp_cut='5e5 K', nh_cut='0.13 cm**-3', additional_filt=None)[source]¶
Calculate spectroscopic temperatures based on Douglas’s pytspec module.
- Parameters
- cal_file
Calibration file used for calculating Tspec.
- halo_id_list
List of halo_ids to calculate temperatures and luminosities. If set to empty list, then will use self.group_list.
- core_corr_factor
Inner radius for calculating core-corrected temperatures. Gas particles within (core_corr_factor*R, R) will be used for calculation.
- calcu_field
Radius to calculate temperatures and luminosities within. Must be in radius_field. Default: R_500.
- temp_cut
Temperature limit above which gas particles are considered as hot.
- nh_cut
nh limit above which gas particles are considered as star forming.
- additional_filt
Any additional filter used to constrain the hot diffuse gas we are investigating.
- calcu_tx_lx(halo_id_list=[], core_corr_factor=0.15, calcu_field='500', temp_cut='5e5 K', nh_cut='0.13 cm**-3', additional_filt=None)[source]¶
Calculate X-ray luminosities and emission weighted temperatures listed in temp_field and luminosity_field.
- Parameters
- halo_id_list
List of halo_ids to calculate temperatures on. If set to empty list, then will use self.group_list.
- core_corr_factor
Inner radius for calculating core-corrected temperatures. Gas particles within (core_corr_factor*R, R) will be used for calculation.
- calcu_field
Radius to calculate temperatures and luminosities within. Must be in radius_field. Default: R_500.
- temp_cut
Temperature limit above which gas particles are considered as hot.
- nh_cut
nh limit above which gas particles are considered as star forming.
- additional_filt
Any additional filter used to constrain the hot diffuse gas we are investigating.
- get_center()[source]¶
Calculate the center of the halos if an ahfcatalogue is provided, then will automatically load the results in ahf. Otherwise it will try to calculate the center coordinates via gravitional potential or center of mass.
Notes
Due to a bug in pynbody, calculating center of mass will lead to an incorrect result for the halos crossing the periodical boundary of the simulation box. Make sure pynbody has fixed it before you use.
- get_children()[source]¶
Generate list of children (subhalos) for each halo. Subhalo itself can also have children. And this list will not contain “grandchildren” (i.e., the children of children).
- get_galaxy(g_low_limit, mode='only stellar')[source]¶
Generate list of galaxies for each host halo. The subsubhalo will also be included in the hosthalo galaxy list. And it won’t generate list for the subhalos even if there are galaxies within.
- Parameters
- g_low_limitpynbody.array.SimArray
Limit above which galaxies will be identified as luminous galaxies.
- get_group_list(N_galaxy)[source]¶
halo_id of the halo identified as group in the catalogue.
- Parameters
- N_galaxyint
Number of luminous galaxies above which host halos are considered as groups.
- get_new_catalogue(include_)[source]¶
Generate a new catalogue based on catalogue_original, the new catalogue will include all the subhalo particles in its host halo.
- Parameters
- include_bool
If True, then will include all the subhalo particles. Otherwise will just be a copy of catalogue_original.
- init_relationship(galaxy_low_limit, include_sub=False, galaxy_mode='only stellar', N_galaxy=3)[source]¶
Get basic information regarding groups, hosts, children, etc.
- Parameters
- galaxy_low_limitpynbody.array.SimArray
Required by get_galaxy(). Limit above which galaxies will be identified as luminous galaxies.
- include_sub
Whether or not to include all the subhalo particles when generating the new catalogue. See get_new_catalogue() for details.
- N_galaxyint
Required by get_group_list(). Number of luminous galaxies above which host halos are considered as groups.
- savedata(filename, field=None, halo_id_list=[], units=None)[source]¶
Save the data in hdf5 format. Will save halo_id_list (key: ‘halo_id’) and the quantities listed in field.
- Parameters
- filename
Filename of the hdf5 file.
- field
Type of information to save.
- halo_id_list
List of halo_ids to save.If set to empty list, then will use self.group_list.
- units
Convert the data into specified inits and save.