This branch implements everything needed to inject primordial black holes (PBHs) into the .h5 file that will be used by calc_events.
Synthetic.py Changes:
_add_pbh:_
This function takes the .h5 file that is output by perform_pop_syn, creates everything needed for the injected PBHs, then combines the PBH data with the data from the previous .h5 file into a new .h5 file.
This function does the following:
The .h5 file without PBHs is read in (this is the product of perform_pop_syn). Latitude bins and longitude bins are stored. Maximum ID values are determined, so that we know where to start with the PBH ID's.
An NFW profile is used to determine how many PBHs there are within the field of view.
A cylinder with a length of 2*r_max and an area of the field of view is created.
PBHs are populated into this cylinder.
The cylinder gets masked, giving us only the PBHs that exist in the observable light cone.
The Maxwellian velocity distribution is calculated for each radius.
One value is randomly sampled, and assigned as the rms velocity (then converted to vx, vy, and vz).
All other values needed are assigned to each PBH: magnitudes, pop_id, etc.
A new .h5 file is created that consists of all of the data from the original .h5 file (without PBHs. From perform_pop_syn), combined with all of the new PBH information for the current field.
Run.py Changes:
Created an optional add_argument statement for the PBH config file.
Added a segment that instructs what to do if a pbh_config file is given.
Added a synthetic.add_pbh section to run if pbh_config_filename is not None.
Added a section that will append "_pbh" to files generated if add_pbh is being run.
_generate_pbh_config_file:_
Generates a config file with the parameters that are needed for the add_pbh function.
Other files added:
pbh_config.yaml
Has all of the default parameters needed for the add_pbh function.
These files contain radius and velocity columns for different values of the MW inner slope. These are used to calculate the different velocity distributions depending on what inner slope value you use. The inner slope values and distributions are defined in https://iopscience.iop.org/article/10.1088/1475-7516/2018/09/040/pdf
I started commenting on some of this pull request, but I know @Kerianne28 is doing a ton of work to incorporate the new PBH sampling method, so I think I will wait until she is done with that to comment further.
This branch implements everything needed to inject primordial black holes (PBHs) into the .h5 file that will be used by
calc_events
.Synthetic.py Changes:
_
add_pbh
:_ This function takes the .h5 file that is output byperform_pop_syn
, creates everything needed for the injected PBHs, then combines the PBH data with the data from the previous .h5 file into a new .h5 file.This function does the following:
The .h5 file without PBHs is read in (this is the product of
perform_pop_syn
). Latitude bins and longitude bins are stored. Maximum ID values are determined, so that we know where to start with the PBH ID's.An NFW profile is used to determine how many PBHs there are within the field of view.
A cylinder with a length of 2*r_max and an area of the field of view is created.
PBHs are populated into this cylinder.
The cylinder gets masked, giving us only the PBHs that exist in the observable light cone.
The Maxwellian velocity distribution is calculated for each radius.
One value is randomly sampled, and assigned as the rms velocity (then converted to vx, vy, and vz).
All other values needed are assigned to each PBH: magnitudes, pop_id, etc.
A new .h5 file is created that consists of all of the data from the original .h5 file (without PBHs. From
perform_pop_syn
), combined with all of the new PBH information for the current field.Run.py Changes:
Created an optional
add_argument
statement for the PBH config file.Added a segment that instructs what to do if a pbh_config file is given.
Added a
synthetic.add_pbh
section to run ifpbh_config_filename
is not None.Added a section that will append "_pbh" to files generated if add_pbh is being run.
_
generate_pbh_config_file
:_add_pbh
function.Other files added:
pbh_config.yaml
radial_velocity_profile_middle.csv radial_velocity_profile_shallow.csv radial_velocity_profile_steep.csv