Skip to main content

Python package for INTEGRAL IBIS/ISGRI lightcurve analysis

Project description

ISGRI

Python toolkit for INTEGRAL/ISGRI data analysis.

Features

Command Line Interface

Query catalogs directly from the terminal:

  • Interactive and direct query modes
  • Filter by time, position, quality, revolution
  • Export results to FITS/CSV or SWID lists

SCW Catalog Query

Query INTEGRAL Science Window catalogs with a fluent Python API:

  • Filter by time, position, quality, revolution
  • Calculate detector offsets
  • Export results to any auto detectable astropy table extension or in table aligned data for any other extension

Light Curve Analysis

Extract and analyze ISGRI light curves:

  • Load from file paths or SWID/source lookup
  • PIF weighting with adjustable thresholds
  • Custom time binning
  • Module-by-module analysis
  • Quality metrics (chi-squared tests)
  • Time conversions (IJD to/from UTC)

Installation

pip install isgri

Quick Start

CLI Usage

# Configure default paths (once)
isgri config-set --archive /path/to/archive --catalog ~/data/scw_catalog.fits --pif /path/to/pif

# View current config
isgri config

# Interactive catalog query
isgri query
# query> time
# Start: 2010-01-01
# Stop: 2010-12-31
# → 1234 SCWs
# query> pos
# RA: 83.63
# Dec: 22.01
# ...

# Direct catalog query
isgri query --tstart 2010-01-01 --tstop 2010-12-31 --ra 83.63 --dec 22.01 --max-chi 2.0

# Get SWID list for batch processing
isgri query --tstart 3000 --tstop 3100 --list-swids > swids.txt

# Export results
isgri query --tstart 3000 --tstop 3100 --output results.fits

Query SCW Catalog

from isgri.catalog import ScwQuery

# Load catalog
cat = ScwQuery("path_to_catalog.fits")

# Find Crab observations in 2010 with good quality
results = (cat
    .time(tstart="2010-01-01", tstop="2010-12-31")
    .quality(max_chi=2.0)
    .position(ra=83.63, dec=22.01, fov_mode="full")
    .get()
)

# Filter by revolution(s)
results = cat.revolution([1000, 1001, 1002]).get()

# Save selected columns
cat.write('results.fits', columns=['SWID', 'TSTART', 'TSTOP'])

# Get SWID list
swids = cat.get_swids()

print(f"Found {len(results)} observations")

Analyze Light Curves

from isgri.utils import LightCurve, QualityMetrics

# Method 1: Load from file paths
lc = LightCurve.load_data(
    events_path="isgri_events.fits",
    pif_path="source_model.fits",
    use_pif=True,
    pif_threshold=0.5
)

# Method 2: Load by SWID (requires config)
lc = LightCurve.load_data(swid="255900280010")

# Method 3: Load by SWID + source (auto-finds PIF)
lc = LightCurve.load_data(
    swid="255900280010",
    source="SGR1935",
    use_pif=True,
    pif_threshold=0.5
)

# Create binned lightcurve
time, counts = lc.rebin(binsize=1.0, emin=30, emax=100)

# Override PIF settings temporarily
time, counts = lc.rebin(binsize=1.0, emin=30, emax=100, use_pif=True, pif_threshold=0.8)

# Or change instance settings
lc.pif_threshold = 0.7
lc.use_pif = True
time, counts = lc.rebin(binsize=1.0, emin=30, emax=100)

# Module-by-module analysis
times, module_counts = lc.rebin_by_modules(binsize=1.0, emin=30, emax=300)

# Quality metrics
qm = QualityMetrics(lc, binsize=1.0, emin=30, emax=100)
chi_raw = qm.raw_chi_squared()
chi_clipped = qm.sigma_clip_chi_squared(sigma=1)
chi_gti = qm.gti_chi_squared()
print(f"Chisq/dof = {chi_raw:.2f}")

# Time conversions
from isgri.utils.time_conversion import ijd2utc, utc2ijd
print(f"Start time: {ijd2utc(lc.t0)}")

Configuration

ISGRI stores configuration in default config folder for each system (see: platformdirs package)

# View current config
isgri config

# Set paths
isgri config-set --archive /path/to/archive
isgri config-set --catalog /path/to/catalog.fits
isgri config-set --pif /path/to/pif

# Set all at once
isgri config-set --archive /path/to/archive --catalog /path/to/catalog.fits --pif /path/to/pif

Config in Python:

from isgri.config import Config

cfg = Config()
print(cfg.archive_path)
print(cfg.catalog_path)
print(cfg.pif_path)

# Create new config programmatically
cfg.create_new(
    archive_path="/path/to/archive",
    catalog_path="/path/to/catalog.fits",
    pif_path="/path/to/pif"
)

Local config file isgri_config.toml in current directory overrides global config.

Documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isgri-0.7.0.tar.gz (48.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

isgri-0.7.0-py3-none-any.whl (39.0 kB view details)

Uploaded Python 3

File details

Details for the file isgri-0.7.0.tar.gz.

File metadata

  • Download URL: isgri-0.7.0.tar.gz
  • Upload date:
  • Size: 48.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for isgri-0.7.0.tar.gz
Algorithm Hash digest
SHA256 519eb7ff81550a701b34b7449e987ff424f528825225ed024d21cd4476314eb1
MD5 37bc54ed7a3cbfa0973a4b0cab7377e5
BLAKE2b-256 976b918adc9d24e593c31379291a6e331d7773eced79dec217a2c2db5a14bc2a

See more details on using hashes here.

File details

Details for the file isgri-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: isgri-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 39.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for isgri-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c494fe3604e7db66091cb488abe6cb970b8725d70cecdc67dbab12198a9eb806
MD5 daefb7c76463e437febd4572cf0d1210
BLAKE2b-256 eba57d30f259a8868f6d3022186c0ddd279ac118373ed63dc6b8a1b740f7b334

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page