No project description provided
Project description
deepCR: Deep Learning Based Cosmic Ray Removal for Astronomical Images
Identify and remove cosmic rays from astronomical images using trained convolutional neural networks. Currently supports Hubble Space Telescope ACS-WFC and WFC3-UVIS cameras.
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
Currently Available Models
ACS-WFC: Kwon, Zhang & Bloom 2021
WFC3-UVIS: Chen et al. 2024
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 and a WFC3/UVIS image
wget -O jdba2sooq_flc.fits https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/jdba2sooq_flc.fits
wget -O ietx1ab1q_flc.fits https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/ietx1ab1q_flc.fits
from deepCR import deepCR
from astropy.io import fits
image = fits.getdata("jdba2sooq_flc.fits")[:512,:512]
# Create an instance of deepCR for ACS-WFC
mdl = deepCR(mask="ACS-WFC")
# mdl = deepCR(mask="WFC3-UVIS") for WFC3-UVIS
# Apply the model
mask = mdl.clean(image, threshold = 0.5)
# 0.5 threshold usually works for ACS/WFC
# 0.1-0.2 for WFC3/UVIS (see Chen et al. 2024)
# Probabilistic mask could be helpful in determining threshold
prob_mask = mdl.clean(image, binary=False)
# Optional inpainting with median filtering
mask, cleaned_image = mdl.clean(image, threshold = 0.5, inpaint=True)
For larger images you may want to enable mdl.clean(..., segment=True, patch=512)
option to prevent memory
overflow. This option segment your input image into small squares of 512 by 512 for input into the model,
where the CR masks are stitched back together. In this case,
you may also enable multiprocessing by specifying n_jobs>1
. 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file deepCR-0.3.1.tar.gz
.
File metadata
- Download URL: deepCR-0.3.1.tar.gz
- Upload date:
- Size: 6.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae38876514e8a44e5e96ee7edf6609a4baf25bc5c442363628b162d46f982e94 |
|
MD5 | 12a92401823bf4b2d1e10dc1f403992e |
|
BLAKE2b-256 | cf6d6e0cc05a40596101dc421b9d19172c0a482eb2eec01390af4e47a193898f |