Giter Site home page Giter Site logo

dpiras / leap_of_lognormal Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 25 KB

N-body simulations from cheap lognormal random fields

Home Page: https://arxiv.org/abs/2205.07898

Python 100.00%
deep-learning lognormal-mocks machine-learning simulation wgan-gp

leap_of_lognormal's Introduction

Leap of lognormal: expensive $N$-body simulations from cheap lognormal fields

This repository contains some of the code to reproduce the results in Piras et al., "Fast and realistic large-scale structure from machine-learning-augmented random field simulations". In short, we use a deep learning algorithm to map cheap lognormal random fields to more realistic $N$-body simulations. The dataset of highly-correlated pairs of cheap and expensive simulations is obtained from the Quijote simulation suite.

Content description

In the single folder scripts, we provide a few scripts that can be used to reproduce most of the results in the paper. Note that to run them you will need the data byproduct that we generated for this paper, and/or the Quijote simulations themselves. The scripts are not meant to be run "as is". Get in touch if you need help with any of this.

We provide the following scripts:

  • create_pairs: create the pairs used to train the model.
  • fit: train the model. Also uses utils.py, models.py and train_functions.py.
  • validate_best_model: select the best epoch model based on the perfomance on validation data. Also uses models.py and test_single_epoch.py.
  • final_performance: apply the best model on test data and obtain the final dataset. Note this does not perform the summary statistics evaluation or figure generation, which is not present in this repository. Also uses models.py and test_single_epoch.py.

More information can be found inside each script. For anything that is unclear or missing, get in touch with Davide Piras or raise an issue. Similarly, since no trained model is currently provided, do get in touch if you are interested in using a particular pre-trained model โ€” we will be happy to help!

Requirements

To run the scripts, beyond the usual numpy, scipy, tensorflow and matplotlib, you will also need:

  • CLASS: you can refer to these instructions; only the Python wrapper is used.
  • nbodykit: you can refer to these instructions.
  • PKLibrary: this comes from Pylians3, for which you can refer to these instructions. This is only used in the reduced bispectrum calculation.
  • PiInTheSky and healpy: this is only for the bispectra calculation. The code is not currently publicly available, so you will need to contact Davide Piras for this, or remove the parts of the code where bispectra are calculated (namely the validation part). healpy can be installed following these instructions.

Contributing and contacts

Feel free to contact Davide Piras at [email protected], or raise an issue here, in case you want to access training data or need help with the code.

Citation

If you work with this code or some data byproducts, please cite our paper (and the Quijote one):

@article{Piras23,
 author = {Piras, Davide and Joachimi, Benjamin and Villaescusa-Navarro, Francisco},
 title = "{Fast and realistic large-scale structure 
           from machine-learning-augmented random field simulations}",
 journal = {Monthly Notices of the Royal Astronomical Society},
 volume = {520},
 number = {1},
 pages = {668-683},
 year = {2023},
 month = {01},
 issn = {0035-8711},
 doi = {10.1093/mnras/stad052},
 url = {https://doi.org/10.1093/mnras/stad052},
 eprint = {https://academic.oup.com/mnras/article-pdf/520/1/668/49032061/stad052.pdf},
}

leap_of_lognormal's People

Contributors

dpiras avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  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.