{"id":48448549,"url":"https://github.com/cy-xu/cosmic-conn","last_synced_at":"2026-04-06T19:02:28.115Z","repository":{"id":37389573,"uuid":"380562575","full_name":"cy-xu/cosmic-conn","owner":"cy-xu","description":"Cosmic-CoNN: A Cosmic Ray Detection Deep-Learning Framework, Dataset, and Toolkit","archived":false,"fork":false,"pushed_at":"2026-04-06T15:32:25.000Z","size":12662,"stargazers_count":28,"open_issues_count":3,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-06T17:10:46.830Z","etag":null,"topics":["astronomy-data-reduction","ccd-observation","classification","convolutional-neural-networks","cosmic-rays","deep-learning","neural-networks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cy-xu.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-06-26T17:41:26.000Z","updated_at":"2026-04-06T15:31:47.000Z","dependencies_parsed_at":"2023-12-06T03:45:53.607Z","dependency_job_id":null,"html_url":"https://github.com/cy-xu/cosmic-conn","commit_stats":{"total_commits":64,"total_committers":2,"mean_commits":32.0,"dds":0.171875,"last_synced_commit":"6d4434f8b693d675e34406221cbcbe7c1d86451b"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/cy-xu/cosmic-conn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cy-xu%2Fcosmic-conn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cy-xu%2Fcosmic-conn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cy-xu%2Fcosmic-conn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cy-xu%2Fcosmic-conn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cy-xu","download_url":"https://codeload.github.com/cy-xu/cosmic-conn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cy-xu%2Fcosmic-conn/sbom","scorecard":{"id":313839,"data":{"date":"2025-08-11","repo":{"name":"github.com/cy-xu/cosmic-conn","commit":"6d4434f8b693d675e34406221cbcbe7c1d86451b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Code-Review","score":1,"reason":"Found 2/19 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/pypi-publish.yml:1","Warn: no topLevel permission defined: .github/workflows/python-pytest.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pypi-publish.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/cy-xu/cosmic-conn/pypi-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pypi-publish.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/cy-xu/cosmic-conn/pypi-publish.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pypi-publish.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/cy-xu/cosmic-conn/pypi-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-pytest.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/cy-xu/cosmic-conn/python-pytest.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-pytest.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/cy-xu/cosmic-conn/python-pytest.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/pypi-publish.yml:28","Warn: pipCommand not pinned by hash: .github/workflows/pypi-publish.yml:29","Warn: pipCommand not pinned by hash: .github/workflows/python-pytest.yml:29","Warn: pipCommand not pinned by hash: .github/workflows/python-pytest.yml:30","Warn: pipCommand not pinned by hash: .github/workflows/python-pytest.yml:39","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   5 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T23:44:14.464Z","repository_id":37389573,"created_at":"2025-08-17T23:44:14.465Z","updated_at":"2025-08-17T23:44:14.465Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31485516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T17:22:55.647Z","status":"ssl_error","status_checked_at":"2026-04-06T17:22:54.741Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astronomy-data-reduction","ccd-observation","classification","convolutional-neural-networks","cosmic-rays","deep-learning","neural-networks"],"created_at":"2026-04-06T19:02:24.861Z","updated_at":"2026-04-06T19:02:28.109Z","avatar_url":"https://github.com/cy-xu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cosmic-CoNN: A Cosmic Ray Detection Deep Learning Framework, Dataset, and Toolkit\n\n[![arXiv](https://img.shields.io/badge/arXiv-2106.14922-b31b1b.svg?style=flat)](https://arxiv.org/abs/2106.14922) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6630624.svg)](https://doi.org/10.5281/zenodo.6630624) [![PyPI version](https://badge.fury.io/py/cosmic-conn.svg)](https://badge.fury.io/py/cosmic-conn) [![readthedocs](https://readthedocs.org/projects/cosmic-conn/badge/?version=latest)](https://cosmic-conn.readthedocs.io) [![astropy](http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat)](http://www.astropy.org/) [![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg?style=flat-square)](https://tldrlegal.com/license/gnu-lesser-general-public-license-v3-(lgpl-3))\n\n## [Documentation](https://cosmic-conn.readthedocs.io/) • [PyPI Release](https://pypi.org/project/cosmic-conn/) • [LCO CR Dataset](https://zenodo.org/record/5034763) • [Publications](https://github.com/cy-xu/cosmic-conn#publications)\n\n### [[New] Demo video for interactive CR mask visualization and editing](https://www.youtube.com/watch?v=bdqmwcQeKyc\u0026ab_channel=CYXu)\n\n## About\n\n![Cosmic-CoNN overview](https://cosmic-conn.readthedocs.io/en/latest/_images/Cosmic-CoNN_overview.png)\n\nCosmic-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:\n\n1. [LCO CR dataset](https://zenodo.org/record/5034763), a large, diverse cosmic ray dataset that consists of over 4,500 scientific images from [Las Cumbres Observatory](https://lco.global/) (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.\n\n2. A PyTorch deep-learning framework that trains generic, robust CR detection models for ground- and space-based imaging data, as well as spectroscopic observations.\n\n3. A suite of tools including console commands, a web app, and Python APIs to make deep-learning models easily accessible to astronomers.\n\n![Detection demo on Gemini data](https://cosmic-conn.readthedocs.io/en/latest/_images/fig11_gemini_results_demo.png)\nVisual inspection of Cosmic-CoNNCR detection results. Detecting CRs in a Gemini GMOS-N 1×1 binning image with our generic ``ground-imaging`` model. 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.\n\n![Detection demo on LCO NRES data](https://cosmic-conn.readthedocs.io/en/latest/_images/fig11_nres_result_0034_1.png)\nThe Cosmic-CoNN ``NRES`` model 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.\n\n## Installation\n\nWe recommend using [uv](https://github.com/astral-sh/uv). See the step-by-step [installation guide](https://cosmic-conn.readthedocs.io/en/latest/source/installation.html) for more detail.\n PyTorch must be requested explicitly via an extra — `cpu` and `cuda` are mutually exclusive:\n\n```bash\n  # CPU-only PyTorch (no GPU required)\n  $ uv pip install \"cosmic-conn[cpu]\"\n\n  # CUDA-enabled PyTorch (requires NVIDIA GPU with CUDA 12.4)\n  $ uv pip install \"cosmic-conn[cuda]\"\n\n  # include Flask to use the interactive web tool\n  $ uv pip install \"cosmic-conn[cpu,webapp]\"\n\n  # install all dependencies for development\n  $ uv pip install \"cosmic-conn[cpu,develop]\"\n```\n\nIf you are using plain `pip`, install PyTorch separately from the [PyTorch website](https://pytorch.org/get-started/locally/) before installing `cosmic-conn`. See the [installation guide](https://cosmic-conn.readthedocs.io/en/latest/source/installation.html) for more detail.\n\n## Command-line interface\n\nAfter installation, you can batch process FITS files for CR detection from the terminal:\n\n```bash\n  $ cosmic-conn -m ground_imaging -e SCI -i input_dir\n```\n\n``-m`` or ``--model`` specifies 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 by [deepCR](https://github.com/profjsb/deepCR) and pass in the model's path.\n\n``-i`` or ``--input`` specifies the input file or directory. \n\n``-e`` or ``--ext`` defines which FITS extension to read image data, by default we read the first valid image array in the order of `hdul[0] -\u003e hdul[1] -\u003e hdul['SCI']` unless user specify an extension name.\n\n\nSee [documentation](https://cosmic-conn.readthedocs.io/en/latest/source/user_guide.html) for the complete user guide.\n\n## Python APIs\n\nIt is also easy to integrate Cosmic-CoNN CR detection into your data workflow. Let `image` be a two-dimensional `float32 numpy` array of any size:\n\n```Python\n\n  from cosmic_conn import init_model\n\n  # initialize a Cosmic-CoNN model\n  cr_model = init_model(\"ground_imaging\")\n\n  # the model outputs a CR probability map in np.float32\n  cr_prob = cr_model.detect_cr(image)\n\n  # convert the probability map to a boolean mask with a 0.5 threshold\n  cr_mask = cr_prob \u003e 0.5\n\n```\n\n## Interactive CR mask visualization and editing\n\n```bash\n  $ cosmic-conn -am ground_imaging -e SCI\n```\n\nThe 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.\n\n\u003c!-- \u003cimg src=\"https://cosmic-conn.readthedocs.io/en/latest/_images/cosmic_conn_web_app_interface.png\" alt=\"web-based CR detector interface\" width=\"600\"/\u003e --\u003e\n\n\u003ca href=\"https://www.youtube.com/watch?v=bdqmwcQeKyc\n\" target=\"_blank\"\u003e\u003cimg src=\"https://cosmic-conn.readthedocs.io/en/latest/_images/cosmic_conn_web_app_interface.png\" \nalt=\"web-based CR detector interface\" width=\"400\" /\u003e\u003c/a\u003e\n\nThe Cosmic-CoNN web app interface.\n\n## Train new models with Cosmic-CoNN\n\nSee [documentation](https://cosmic-conn.readthedocs.io/en/latest/source/lco_cr_dataset.html) for the developer guide on using LCO CR dataset, data reduction, and model training.\n\n## Publications\n\n\u003cp\u003e\n\u003c!-- \u003ca href=\"https://arxiv.org/abs/2106.14922\"\u003e\u003cimg style=\"float: left; padding-right:30px;\" src=\"https://cosmic-conn.readthedocs.io/en/latest/_images/paper_with_shadow.png\"  width=\"220\"/\u003e\u003c/a\u003e --\u003e\n\nThis 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: [The Astrophysical Journal](https://iopscience.iop.org/article/10.3847/1538-4357/ac9d91/meta), [NASA ADS](https://ui.adsabs.harvard.edu/abs/2021arXiv210614922X/abstract)\n\n```\n@article{Xu_2023,\ndoi = {10.3847/1538-4357/ac9d91},\nurl = {https://dx.doi.org/10.3847/1538-4357/ac9d91},\nyear = {2023},\nmonth = {jan},\npublisher = {The American Astronomical Society},\nvolume = {942},\nnumber = {2},\npages = {73},\nauthor = {Chengyuan Xu and Curtis McCully and Boning Dong and D. Andrew Howell and Pradeep Sen},\ntitle = {Cosmic-CoNN: A Cosmic-Ray Detection Deep-learning Framework, Data Set, and Toolkit},\njournal = {The Astrophysical Journal},\n}\n```\n\nPlease also cite the [LCO CR dataset](http://doi.org/10.5281/zenodo.5034763) if you used the Cosmic-CoNN `ground_imaging` model or the data in your research:\n```\n@dataset{xu_chengyuan_2021_5034763,\n  author       = {Xu, Chengyuan and\n                  McCully, Curtis and\n                  Dong, Boning and\n                  Howell, D. Andrew and\n                  Sen, Pradeep},\n  title        = {Cosmic-CoNN LCO CR Dataset},\n  month        = jun,\n  year         = 2021,\n  publisher    = {Zenodo},\n  version      = {0.1.0},\n  doi          = {10.5281/zenodo.5034763},\n  url          = {https://doi.org/10.5281/zenodo.5034763}\n}\n```\n\n**Interactive Segmentation and Visualization for Tiny Objects in Multi-megapixel Images**  \n[CVPR 2022](https://openaccess.thecvf.com/content/CVPR2022/html/Xu_Interactive_Segmentation_and_Visualization_for_Tiny_Objects_in_Multi-Megapixel_Images_CVPR_2022_paper.html)\n```\n@InProceedings{Xu_2022_CVPR,\n    author    = {Xu, Chengyuan and Dong, Boning and Stier, Noah and McCully, Curtis and Howell, D. Andrew and Sen, Pradeep and H\\\"ollerer, Tobias},\n    title     = {Interactive Segmentation and Visualization for Tiny Objects in Multi-Megapixel Images},\n    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},\n    month     = {June},\n    year      = {2022},\n    pages     = {21447-21452}\n}\n```\n\n![interactive_segmentation_cvpr22_poster_v2](https://user-images.githubusercontent.com/24612082/174725216-8df9b89b-d5b2-483d-8cf7-d7c660302aeb.png)\n  \n\u003c/p\u003e\n\n\n## Credits\n\nThis package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcy-xu%2Fcosmic-conn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcy-xu%2Fcosmic-conn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcy-xu%2Fcosmic-conn/lists"}