Package: cosmic-conn
Cosmic-CoNNA Cosmic Ray Detection Deep Learning Framework, Dataset, and ToolkitGithub•Documentation•PyPI Release•LCO CR Dataset•Publication[New] Demo video for interactive CR mask visualization and editingAboutCosmic-CoNN is an end-to-end solution to help tackle the cosmic ray (CR) detection problem in CCD-captured astronomical images. It includes a deep-learning framework, high-performance CR detection models, a new dataset, and a suite of tools to use to the models, shown in the figure above:LCO CR dataset, a large, diverse cosmic ray dataset that consists of over 4,500 scientific images fromLas Cumbres Observatory(LCO) global telescope network's 23 instruments. CRs are labeled accurately and consistently across many diverse observations from various instruments. To the best of our knowledge, this is the largest dataset of its kind.A PyTorch deep-learning framework that trains generic, robust CR detection models for ground- and space-based imaging data, as well as spectroscopic observations.A suite of tools including console commands, a web app, and Python APIs to make deep-learning models easily accessible to astronomers.Visual inspection of Cosmic-CoNNCR detection results. Detecting CRs in a Gemini GMOS-N 1×1 binning image with our genericground-imagingmodel. The model was trained entirely on LCO data yet all visible CRs in the image stamp are correctly detected regardless of their shapes or sizes.The Cosmic-CoNNNRESmodel detects CRs over the spectrum robustly on a LCO NRES spectroscopic image. The horizontal bands in the left image are the spectroscopic orders, which are left out of the CR mask.PublicationThis repository is part of our Cosmic-CoNN research paper. Our methods and a thorough evaluation of models' performance are available in the paper. If you used the Cosmic-CoNN or the LCO CR dataset for your research, please cite our paper:arXiv:2106.14922,NASA ADSPlease also cite the LCO CR dataset if you used the Cosmic-CoNNground_imagingmodel or the data in your research:Xu, Chengyuan, McCully, Curtis, Dong, Boning, Howell, D. Andrew, & Sen, Pradeep. (2021). Cosmic-CoNN LCO CR Dataset (Version 0.1.0) [Data set]. Zenodo.http://doi.org/10.5281/zenodo.5034763InstallationWe recently added optional dependencies install for pip.We recommend installing Cosmic-CoNN in a new virtual environment, see the step-by-stepinstallation guide. To get a ~10x speed-up with GPU acceleration, seeInstall for a CUDA-enabled GPU.# basic install for CR detection or library integration$pipinstallcosmic-conn# include Flask to use the interactive tool$pipinstallcosmic-conn[webapp]# install all dependencies for development$pipinstallcosmic-conn[develop]Command-line interfaceAfter installation, you can batch process FITS files for CR detection from the terminal:$cosmic-conn-mground_imaging-eSCI-iinput_dir-mor--modelspecifies the CR detection model."ground_imaging"is loaded by default,"NRES"is the spectroscopic model for LCO NRES instruments. You can also download a Hubble Space Telescope model trained bydeepCRand pass in the model's path.-ior--inputspecifies the input file or directory.-eor--extdefines which FITS extension to read image data, by default we read the first valid image array in the order ofhdul[0] -> hdul[1] -> hdul['SCI']unless user specify an extension name.Seedocumentationfor the complete user guide.Python APIsIt is also easy to integrate Cosmic-CoNN CR detection into your data workflow. Letimagebe a two-dimensionalfloat32 numpyarray of any size:fromcosmic_connimportinit_model# initialize a Cosmic-CoNN modelcr_model=init_model("ground_imaging")# the model outputs a CR probability map in np.float32cr_prob=cr_model.detect_cr(image)# convert the probability map to a boolean mask with a 0.5 thresholdcr_mask=cr_prob>0.5Interactive CR mask visualization and editing$cosmic-conn-aground_imaging-eSCIThe Cosmic-CoNN web app automatically finds large CRs for close inspection. It supports live CR mask visualization and editing and is especially useful to find the suitable thresholds for different types of observations. We are working on addding the paintbrush tool for pixel-level manual editing.The Cosmic-CoNN web app interface.Train new models with Cosmic-CoNNSeedocumentationfor the developer guide on using LCO CR dataset, data reduction, and model training.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.