Skip to main content

⚠️ Work in progress

Cosmit

Cosmic-ray tools for AstroSat/UVIT

Cosmit identifies UVIT event-list frames with unusually high event counts, flags them as candidate cosmic-ray-affected frames, and removes the events associated with those frames. It then updates the exposure maps and regenerates count-rate images, error images, and diagnostic products.

Features

  • Robust frame rejection: flags frames using the median and normal-scaled median absolute deviation (NMAD) of the valid-event counts.
  • Cleaned event lists: removes all event-list rows associated with flagged frame times.
  • Updated exposure maps: scales exposure maps by the fraction of inspected frames retained.
  • Regenerated images: creates detector-coordinate and astronomical-coordinate count-rate images and their corresponding error images.
  • Diagnostics: records frame counts and flags in a CSV catalogue, saves diagnostic plots, and writes a processing log.

Requirements

  • Python 3.9 or later
  • AstroSat/UVIT Level 2 products from UVIT Pipeline Version 7 or later, or PSF improved products generated by Resolvit

Installation

Install Cosmit with pip:

pip install cosmit

Usage

Run Cosmit on an observation directory. For example:

cosmit 20160101_A01_123T01_0123456789_level2

By default, Cosmit searches recursively for event lists under directories named data_products.

Process Resolvit products

To process products under resolvit_data_products, specify the input source:

cosmit 20160101_A01_123T01_0123456789_level2 --input-source resolvit

Change the rejection threshold

Cosmit uses a default threshold factor of 10.0. Set a different value with --threshold-factor:

cosmit 20160101_A01_123T01_0123456789_level2 --threshold-factor 8

A smaller factor generally makes rejection more aggressive; a larger factor generally makes it more conservative. The threshold is calculated independently for each event list.

Other command-line options

Display the installed version:

cosmit --version

Display the full command-line help:

cosmit --help

Python API

Cosmit can also be called from Python:

from cosmit import process_observation

results = process_observation(
    "20160101_A01_123T01_0123456789_level2",
    input_source="v7",
    threshold_factor=10.0,
)

process_observation() returns a list of (paths, summary) pairs, one for each processed event list. Use input_source="resolvit" to process Resolvit products.

Input data

Cosmit recursively searches the supplied observation directory for files matching AS1*l2ce.fits under the selected input-source directory.

--input-source Input directory
v7 (default) data_products
resolvit resolvit_data_products

Output products

Cosmit writes results to a sibling directory named cosmit_data_products.

For each event list, the products include:

Product Filename pattern Description
Cleaned event list *_l2ce.fits Event list with rows from flagged frame times removed
Detector-coordinate count-rate image *I_l2img.fits Regenerated detector-coordinate image
Detector-coordinate count-rate error image *I_l2err.fits Corresponding error image
Astronomical-coordinate count-rate image *A_l2img.fits Regenerated astronomical-coordinate image
Astronomical-coordinate count-rate error image *A_l2err.fits Corresponding error image
Detector exposure map *I_l2exp.fits Exposure map scaled by the retained-frame fraction
Astronomical exposure map *A_l2exp.fits Exposure map scaled by the retained-frame fraction

Cosmit also creates a diagnostics directory for each product:

cosmit_data_products/<relative_parent>/diagnostics/<product_id>/

It contains:

  • cosmit.log — input and output paths, run information, threshold statistics, and summary metrics.
  • cosmic_ray_catalogue.csv — MJD_L2, valid-event count, and the CR_flag flag for each inspected frame.
  • unique_frametime_counts.png — distribution of events per frame, with the rejection threshold.
  • unique_frametime_counts_vs_time.png — frame event counts versus time, with flagged frames highlighted.

Metadata

Release files for cosmit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cosmit 0.1.0
File Size Uploaded Provenance Actions
cosmit-0.1.0.tar.gz 13.2 kB Without provenance Details for cosmit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cosmit 0.1.0
File Interpreter ABI Platform Actions
cosmit-0.1.0-py3-none-any.whl Python 3 none any Details for cosmit-0.1.0-py3-none-any.whl

Total release size: 26.9 kB

Release files / cosmit-0.1.0.tar.gz

Download URL cosmit-0.1.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4b8630b0c46ab04c29b55efccc4db72a97fba925a444219cd15a2e6e394e71a2
BLAKE2b-256 checksum
How to use checksums
82965db6cd43befd8528f26640f17ed3e437860416891b9dc1f2d8e7cb32b5da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / cosmit-0.1.0-py3-none-any.whl

Download URL cosmit-0.1.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c33b5a5c06ae505c077854463abee394e491c8d0bda4460353003a22c51c3b0
BLAKE2b-256 checksum
How to use checksums
f23a9fbd025abe150a83dd25e6021346ec13f38cb618db88b1b3a11bcf5115a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for cosmit 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page