Modular BAO fitting code.
- Ensure that you have a named conda environment of at least Python 3.7
- Clone this project onto both your local computer and a cluster computer
- Have all dependencies installed:
pip install -r requirements.txt
- Update
config.yml
to include the name of your environment for activation on the HPC - Run any of the python files in
barry.config
.- If you run on your local computer (ie
python test.py
), it will run the first MCMC run only to verify it works. - If you run on a cluster, it will create a slurm job script and send out all needed runs (if you have something other than slurm, let me know)
- Once all jobs have finished, copy the output from the plots folder ie
barry.config.plots.mocks
to your local computer - Run the same python script and it will load in the data and create the plots. (Alternatively, run
python yourjob.py -1
and it will do the plotting on the HPC)
- If you run on your local computer (ie
Tests are included in the tests directory. Run them using pytest, pytest -v .
in the top level directory (where this readme is).
Note that by default, we assume that the HPC system being used is slurm. If it is not, raise an issue and we'll get something working.
Note the internal differentiation; the configs
directory is used when performing fits and submitting jobs, whilst
the investigations
directory is when performing investigations or tests locally.
configs/pk_avg.py
: Generates Figures 1 and 4configs/xi_avg.py
: Generates Figures 2 and 9configs/pk_individual.py
: Generates Figure 3 and 5configs/ding_baoextractor.py
: Generates Figure 6configs/noda_spt_vs_halofit.py
: Generates Figure 7configs/noda_avg.py
: Generates Figure 8configs/noda_range_lower_investigation.py
: Determines impact of shifting mink in extractorconfigs/noda_range_upper_investigation.py
: Determines impact of shifting second k anchor in extractorconfigs/noda_recon_covariance_investigation.py
: Determine correctness of analytic covariance matrix for Noda.configs/xi_individual.py
: Generates Figure 10investigations/get_consensus_measurement_individual
: Generates Figures 11 and 13configs/pk_vs_xi_individual.py
: Generates Figure 12
In the tests
directory, we have three files:
test_datasets.py
: Will attempt to instantiate all concrete implementations of the Dataset class, ensure they have valid cosmology, and valid keys in the dictionary structure of the data.test_models.py
: Will attempt to instantiate all concrete implementations of the Model class, and then ensures that the likelihood generated at the default parameter values for the SDSS DR12 z=0.61 NGC dataset returns a finite number. Using random samples in the allowed prior range, 100 points are also randomly evaluated to ensure all return finite values.test_pk2xi.py
: Validates that both the current FT and Gaussian integration methods of doing the Spherical Hankel Transform give good results.
For examples on python codes that have digested previous datasets, look into barry/data/sdss_dr12_pk_zbin0p61/pickle.py
.
What gets saved is a dictionary with cosmology defined inside the dataset. Pre and post-recon mocks are separated out, and for the power spectrum data we need winfit and winpk files which define the window function, in the style as produced by Cullan Howlett. If you want to add a new dataset but need some help, just raise an issue or send us an email.
Assuming you get the pickle made, you just need a wrapper class defining the default usage (k range, etc). See
barry.datasets.dataset_power_spectrum.py
for examples - you can copy and paste and change the pickle name.
Also, after loading in a dataset, which will have its own smoothing scale, redshift and cosmology, you should pre-generate
all the data every model will need. This can be done simply by running python generate.py
in the barry
folder. This will
load all datasets to figure out how many unique cosmologies there are, run (locally) the CAMB pregeneration, and then
load all models, firing off a slurm MPI script to generate anything required as per the pregenerate
method in the Model class.
Simply create a new class, following the examples outlined in barry.models
.