Coder Social home page Coder Social logo

epaillas / barry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from samreay/barry

0.0 0.0 0.0 533.97 MB

BAO Model Fitting Made Easy

Home Page: https://barry.readthedocs.io/en/latest/

License: MIT License

Shell 0.07% Python 18.62% Jupyter Notebook 81.31%

barry's Introduction

Barry

Documentation online here

Modular BAO fitting code.

Setup

  1. Ensure that you have a named conda environment of at least Python 3.7
  2. Clone this project onto both your local computer and a cluster computer
  3. Have all dependencies installed: pip install -r requirements.txt
  4. Update config.yml to include the name of your environment for activation on the HPC
  5. Run any of the python files in barry.config.
    1. If you run on your local computer (ie python test.py), it will run the first MCMC run only to verify it works.
    2. 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)
    3. Once all jobs have finished, copy the output from the plots folder ie barry.config.plots.mocks to your local computer
    4. 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)

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.

Barry Paper

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 4
  • configs/xi_avg.py: Generates Figures 2 and 9
  • configs/pk_individual.py: Generates Figure 3 and 5
  • configs/ding_baoextractor.py: Generates Figure 6
  • configs/noda_spt_vs_halofit.py: Generates Figure 7
  • configs/noda_avg.py: Generates Figure 8
  • configs/noda_range_lower_investigation.py: Determines impact of shifting mink in extractor
  • configs/noda_range_upper_investigation.py: Determines impact of shifting second k anchor in extractor
  • configs/noda_recon_covariance_investigation.py: Determine correctness of analytic covariance matrix for Noda.
  • configs/xi_individual.py: Generates Figure 10
  • investigations/get_consensus_measurement_individual: Generates Figures 11 and 13
  • configs/pk_vs_xi_individual.py: Generates Figure 12

In-built tests

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.

Adding new datasets

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.

Adding new models

Simply create a new class, following the examples outlined in barry.models.

barry's People

Contributors

cullanhowlett avatar samreay avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.