by siyucosmo

siyucosmo / ML-Recon
124 Stars 28 Forks Last release: Not found MIT License 55 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:



ML project to predict Nbody simulation output from initial condition. Both input and output are particle displacement fields.

File descriptions:

    : main excute files
    : code to fulfill periodic boundary padding
    : how to load data + test/analysis
  • model/
    : Best trained model
  • configs/config_unet.json
    : most of the hyperparameters
  • Unet/
    : architecture
    : plot the result

To run the code:

python --config_file_path configs/config_unet.json


./ -c configs/config_unet.json


  1. Input raw data should be in the format of

    (y is in range of (0,1000,1) and x is controled by
    ). The shape of the data in each file should be
    , where the first coloumn is density, the second to forth coloumn is (\phix, \phiy,\phi_z) for ZA, the fifth to seventh column is for 2LPT, and the eighth to tenth is for fastPM. (Yu provides simulation files and each file contains 1000 simulations. I stored the 1000 simulations in each file into separate files. The reason why I did this is because GPU doesn't have enough memory to store all the files. Thus I only provide the name and the path to each files.)
  2. The output of the model is in the shape of

    stores the predicted fastPM simulations from uNet model and
    stores the corresponding real simulations.
  3. The best trained model is stored in

    . All the tests (pancake, cosmology, etc) should be tested on this model. You should only change the following parameters in
    to do different tests:
    • base_data_path
      : tell where the input (LPT/ZA) is stored.
    • output_path
      : where do you want to store the output
  4. The ZA/2LPT/fastPM data Yu provides are all stored in the following directory on Nersc:

  5. I have wrote code
    to do all the plots. You can use it as a reference.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.