All Projects → profjsb → deepCR

profjsb / deepCR

Licence: BSD-3-Clause license
Deep Learning Based Cosmic Ray Removal for Astronomical Images

Programming Languages

python
139335 projects - #7 most used programming language
TeX
3793 projects

Projects that are alternatives of or similar to deepCR

Galsim
The modular galaxy image simulation toolkit. Documentation:
Stars: ✭ 138 (+331.25%)
Mutual labels:  astronomy
Gaiasky
Mirror of Gaia Sky repository hosted on Gitlab: https://gitlab.com/langurmonkey/gaiasky
Stars: ✭ 162 (+406.25%)
Mutual labels:  astronomy
Taotie
饕餮:A curated collection of resources for astrophysical research
Stars: ✭ 224 (+600%)
Mutual labels:  astronomy
Astroberry Server
Astroberry Server is a ready to use system for Raspberry Pi for controlling all your astronomy equipment
Stars: ✭ 141 (+340.63%)
Mutual labels:  astronomy
Cosmonium
3D astronomy and space exploration program.
Stars: ✭ 153 (+378.13%)
Mutual labels:  astronomy
Astropy Tutorials
Tutorials for the Astropy Project
Stars: ✭ 174 (+443.75%)
Mutual labels:  astronomy
Poppy
Physical Optics Propagation in Python
Stars: ✭ 135 (+321.88%)
Mutual labels:  astronomy
Lightkurve
A friendly package for Kepler & TESS time series analysis in Python.
Stars: ✭ 232 (+625%)
Mutual labels:  astronomy
Celerite
Scalable 1D Gaussian Processes in C++, Python, and Julia
Stars: ✭ 155 (+384.38%)
Mutual labels:  astronomy
Topography atlas of space
Code and instructions for making topographic maps of planets and moons
Stars: ✭ 187 (+484.38%)
Mutual labels:  astronomy
Celeste.jl
Scalable inference for a generative model of astronomical images
Stars: ✭ 142 (+343.75%)
Mutual labels:  astronomy
Photutils
Astropy package for source detection and photometry. Maintainers: @larrybradley and @bsipocz
Stars: ✭ 150 (+368.75%)
Mutual labels:  astronomy
Pycbc
Core package to analyze gravitational-wave data, find signals, and study their parameters. This package was used in the first direct detection of gravitational waves (GW150914), and is used in the ongoing analysis of LIGO/Virgo data.
Stars: ✭ 177 (+453.13%)
Mutual labels:  astronomy
Starnet
StarNet
Stars: ✭ 141 (+340.63%)
Mutual labels:  astronomy
Allsky
A Raspberry Pi operated Wireless Allsky Camera
Stars: ✭ 225 (+603.13%)
Mutual labels:  astronomy
Galpy
Galactic Dynamics in python
Stars: ✭ 134 (+318.75%)
Mutual labels:  astronomy
Asdf
ASDF (Advanced Scientific Data Format) is a next generation interchange format for scientific data
Stars: ✭ 162 (+406.25%)
Mutual labels:  astronomy
Astropy
Repository for the Astropy core package
Stars: ✭ 2,933 (+9065.63%)
Mutual labels:  astronomy
Stellarium
Stellarium is a free GPL software which renders realistic skies in real time with OpenGL. It is available for Linux/Unix, Windows and macOS. With Stellarium, you really see what you can see with your eyes, binoculars or a small telescope.
Stars: ✭ 3,010 (+9306.25%)
Mutual labels:  astronomy
Galaxy Image Classifier Tensorflow
Classify whether an image is of a Spiral or an Elliptical Galaxy using Transfer Learning (Tensorflow)
Stars: ✭ 179 (+459.38%)
Mutual labels:  astronomy

Build Status codecov Documentation Status DOI arXiv

deepCR: Deep Learning Based Cosmic Ray Removal for Astronomical Images

Identify and remove cosmic rays from astronomical images using trained convolutional neural networks.

This package is implements the method described in the paper:

deepCR: Cosmic Ray Rejection with Deep Learning
Keming Zhang & Joshua Bloom 2020
Published in the Astrophysical Journal
arXiv:1907.09500

If you use this package, please cite the paper above and consider including a link to this repository.

Documentation and tutorials

Currently available models

Installation

pip install deepCR

Or you can install from source:

git clone https://github.com/profjsb/deepCR.git
cd deepCR/
pip install .

Quick Start

Quick download of a HST ACS/WFC image

wget -O jdba2sooq_flc.fits https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/jdba2sooq_flc.fits

With Python >=3.5:

For smaller sized images (smaller than ~1Mpix)

from deepCR import deepCR
from astropy.io import fits
image = fits.getdata("jdba2sooq_flc.fits")[:512,:512]

# create an instance of deepCR with specified model configuration
mdl = deepCR(mask="ACS-WFC-F606W-2-32",
	     inpaint="ACS-WFC-F606W-2-32",
             device="CPU")

# apply to input image
mask, cleaned_image = mdl.clean(image, threshold = 0.5)
# best threshold is highest value that generate mask covering full extent of CR
# choose threshold by visualizing outputs.

# if you only need CR mask you may skip image inpainting and save time
mask = mdl.clean(image, threshold = 0.5, inpaint=False)

# if you want probabilistic cosmic ray mask instead of binary mask
prob_mask = mdl.clean(image, binary=False)

There's also the option to segment your input image into smaller pieces (default: 256-by-256) and process the individual piece seperately before stitching them back together. This enables multi-process parallelism and saves memory.

Segment-and-stitching is enabled by n_jobs>1, which specified the number of processes to utilize. n_jobs=-1 is the number of available virtual cores on your machine and is optimized for time when your torch is not intel MKL optimized (see below for more details).

image = fits.getdata("jdba2sooq_flc.fits")
mask, cleaned_image = mdl.clean(image, threshold = 0.5, n_jobs=-1)

If your torch is intel MKL optimized, it's not necessary to open up many processes and one process should utilize half of the CPUs available. Monitor CPU usage -- if CPU usage for single process is > 100% it means intel MKL is in place. In this case, ** n_jobs<=4** is advised.

For single process segment-and-stitching, you need to manually enable segment = True because the default n_jobs=1 assumes segment = False.

image = fits.getdata("jdba2sooq_flc.fits")
mask, cleaned_image = mdl.clean(image, threshold = 0.5, segment = True)

Note that this won't speed things up if you're using GPU!

Contributing

We are very interested in getting bug fixes, new functionality, and new trained models from the community (especially for ground-based imaging and spectroscopy). Please fork this repo and issue a PR with your changes. It will be especially helpful if you add some tests for your changes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].