Skip to main content

A small package assisting in data analysis for Xray astronomy

Project description

The fits_util library

Introduction

This package exists to streamline certain parts of astronomical X-ray data analysis. For now, the main focus lies on the creation of Colour-Colour / Colour-Intensity plots from raw photon event data, as well as the successive (interactive) categorization of these data into branches, using the plots mentioned. Furthermore, the package features a method to effortlessly calculate the cross-correlation curve from two light curves.

Lastly, the package features a collection of useful functions, mostly made for data-extraction of satellite data contained inside fits-files. For now, the scope of this project remains rather compact, featuring support for .evt-files, .pha-files and the qdp-format.

As the data-extraction differs from mission to mission, higher level functions have been prepared in mission-specific files (i.e. ninja.py, tess.py). These will be expanded as my need for them arises.

Examples of how to use the most important features of this package are shown below.

Dependencies

This Package depends on the following:

  • astropy
  • numpy
  • pandas
  • matplotlib
  • seaborn

Documentation

As of now, there is no documentation apart from the doc strings. I did my best to briefly state what each function does, for any further information The user is encouraged to look into the source code himself.

Examples

CCI_Analyzer

Below I have provided the method I currently use to analyse NinjaSat data:

from luis_astro_analysis import cci_analyzer as cci
from luis_astro_analysis import fits_util as f

ninja_path = "/path/to/ninja.evt"
gti_path = "/path/to/ninja.gti"
rmf_path = "/path/to/ninja.rmf"

ninja_bands = {
    "soft": (2, 4),
    "med": (4, 8),
    "hard": (8, 20),
}

# Load and format event data using fits_util
ninja_evts = f.read_mjd_channel(ninja_path)
ninja_rmf = f.read_rmf_ebounds(rmf_path)
ninja_evts = ninja_evts.merge(ninja_rmf, on="channel", how="left")

# initialize CCI_Analyzer
CCI = cci.CCI_Analyzer()

# load data
CCI.load_dataframe(ninja_evts)
CCI.load_gti_from_file(gti_path)

# set analysis parameters
CCI.set_colorbands(ninja_bands) # initial colorbands
CCI.set_binsize(binsize_sec=600) # initial binsize
CCI.set_interactive_bin_bounds(1, 1000) # boundaries for binsize (sec)
CCI.set_color_ratio_error_threshold(0.5) # error threshold for color data

# gti filtering
CCI.refine_gti() #recommended for NinjaSat data
CCI.select_good_time()

# interactive selection
CCI.select_bins_and_colors()
CCI.select_branches()

# results
CCI.plot_color_intensity()
CCI.plot_color_color()

Cross-Correlator

Below is an example of how to calculate the direct cross-correlation of two lightcurves using the Cross-Correlator class:

from luis_astro_analysis import Cross-Correlator as croco
from luis_astro_analysis import fits_util as f
from luis_astro_analysis import ninja
from luis_astro_analysis import tess

ninja_path = "/path/to/ninja.evt"
gti_path = "/path/to/ninja.gti"
rmf_path = "/path/to/ninja.rmf"
tess_path = "/path/to/tess.evt"

binsize_sec = 20 # same as TESS

gti = f.read_stdgti_mjd(gti_path)
gti = f.refine_gti(gti, f.read_evt_mjd(ninja_path))

ninja_lc = ninja.extract_lightcurve(ninja_path, binsize_sec, gti=gti, rmf=rmf, drop_zeros=True)

tess_lc = tess.extract_lightcurve(tess_path)
tess_lc = tess_lc.loc[tess_lc["mjd"] > ninja_lc["mjd"].min()]

CC = croco.Cross_Correlator()

CC.load_dataframe(tess_lc, "Tess", 1)
CC.load_dataframe(ninja_lc, "Ninja", 2)
CC.load_gti(gti)
df = CC.interactive_dccf(tau_max_init=5000, d_tau_init=20)

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

luis_astro_analysis-0.2.1.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

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

luis_astro_analysis-0.2.1-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

File details

Details for the file luis_astro_analysis-0.2.1.tar.gz.

File metadata

  • Download URL: luis_astro_analysis-0.2.1.tar.gz
  • Upload date:
  • Size: 41.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for luis_astro_analysis-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e403c07f8c856f968e08ac2e7c97067f29f2999f0934449c467654d08db4e6a5
MD5 32f90e7c4e31037da3b558b71e1bd2d3
BLAKE2b-256 4aa8dd75ac507fa7ff6f4f68a7eb2723cd4b337867d0a110daf259613cff69ba

See more details on using hashes here.

File details

Details for the file luis_astro_analysis-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for luis_astro_analysis-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72a56e63b4313f0080012dc575803f19f2c306a28569fadd6e3682ef7cf1ae3e
MD5 11442b5bbcb0bbe7982abcc36c19ea6f
BLAKE2b-256 ce3376e8fa15f311761a361469a7db36eb57d238519309b2e7754bc6e3a77fe3

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