Giter VIP home page Giter VIP logo

lukeli0425 / galaxy-deconv Goto Github PK

View Code? Open in Web Editor NEW
47.0 4.0 4.0 5.02 GB

Official code for Galaxy Image Deconvolution for Weak Gravitational Lensing with Unrolled Plug-and-Play ADMM

Home Page: https://lukeli0425.github.io/Galaxy_Deconv/

License: MIT License

Python 4.43% Jupyter Notebook 95.57%
astronomy computer-vision deconvolution deep-learning galaxy image-processing pytorch-implementation

galaxy-deconv's Introduction

Galaxy Image Deconvolution for Weak Gravitational Lensing with Unrolled Plug-and-Play ADMM

Tianao Li1, Emma Alexander2
1Tsinghua University, 2Northwestern University
Monthly Notices of the Royal Astronomical Society: Letters

Official code for Galaxy Image Deconvolution for Weak Gravitational Lensing with Unrolled Plug-and-Play ADMM.

Pipeline Figure

Grid Plot


Running the Project

To clone this project, run:

git clone https://github.com/Lukeli0425/Galaxy-Deconv.git

Create a virtual environment and download the required packages:

pip install -r requirements.txt

If you want to train the models with Shape Constraint, please install AlphaTransform.

Download our simulated galaxy dataset from Google Drive.

To train the models, run train.py and choose parameters and loss function for your training, for instance:

python train.py --model Unrolled_ADMM --n_iters 8 --n_epochs 50 --loss MultiScale --lr 1e-4

Test the algorithms from the perspectives of time and performance with test.py. Uncomment the methods to be tested in the code and specify the number of galaxies you want to use in the test dataset:

python test.py --n_gal 10000

Similarly, you can test the robustness of the algorithms to systematic errors in PSF with test_psf.py:

python test_psf.py --n_gal 10000

All the test results will be automatically saved in the results folder.


Using the model on your own data

We saved our models trained on our LSST dataset (see saved_models). We also provide a tutorial for using the suggested model on your data, see tutorials/deconv.ipynb for details.


Simulating your own dataset and Retraining

We simulated our dataset with the modular galaxy image simulation toolkit Galsim and the COSMOS Real Galaxy Dataset. To us our image simulation pipeline, one need to first download the COSMOS data here or download with Galsim:

galsim_download_cosmos -s 23.5

Run generate_data.py to simulate your own dataset under different settings (remember to change the path to your COSMOS data). Simulate your dataset for deconvolution task by running

python generate_data.py --task Deconv --n_train 40000

We provide the dataset generation code for denoising task. The denoising dataset is used in our ablation studies (see figures/ablation.ipynb) to train the plugin denoiser in ADMMNet. Simulate your dataset for denoising task by running

python generate_data.py --task Denoise --n_train 40000

We provide a detailed tutorial for image simulation (see tutorials/image_simulation.ipynb), where you can find out how to set up your simulations.

You can train the models on your dataset.


Recreating our figures

The figures folder holds the figures in this paper and the files that created them (see figures/README.md). To recreate the figures with your own results, you can use the given files and follow the instructions we provide.


Citation

@article{li2023galaxy,
  title={Galaxy image deconvolution for weak gravitational lensing with unrolled plug-and-play ADMM},
  author={Li, Tianao and Alexander, Emma},
  journal={Monthly Notices of the Royal Astronomical Society: Letters},
  volume={522},
  number={1},
  pages={L31--L35},
  year={2023},
  publisher={Oxford University Press}
}

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.