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
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 usesutils.py
,models.py
andtrain_functions.py
.validate_best_model
: select the best epoch model based on the perfomance on validation data. Also usesmodels.py
andtest_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 usesmodels.py
andtest_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!
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
andhealpy
: 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.
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.
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},
}