Skip to main content

Astronomical image calibration pipeline

Project description

astropy PyPI Version License

Satprocess - A Spectral Alignment Toolbox

A Python package for spatial, wavelength, and intensity calibration of FITS files. This toolbox was specifically built using data from the CHASE satellite, available at https://ssdc.nju.edu.cn/NdchaseSatellite.

Features

  • Three-stage calibration pipeline:
    • Spatial alignment using the Hough transform
    • Wavelength calibration via cross-correlation
    • Intensity normalisation to reference spectra
  • FITS file support with memory-efficient processing
  • H-alpha companion file processing that applies calibrations from Fe files
  • Comprehensive logging and shift parameter tracking
  • User selected calibration where the reference file is chosen (although the default is the first file in the list)

Installation

  pip install satprocess

Dependencies

  • Python 3.7+
  • NumPy
  • SciPy
  • Matplotlib
  • Astropy
  • scikit-image

Usage/Examples

Basic usage: Calibrates all files in the supplied folder

from satprocess import Calibration
import os

if __name__ == "__main__":
    try:
        folder_path = "TestImages"
        shifts_file = os.path.join(folder_path, "shifts.csv")
        
        # Ensure folder structure exists
        Calibration.ensure_folder_structure(folder_path)
        os.makedirs(os.path.join(folder_path, "plots"), exist_ok=True)
        
        # Load or initialise shifts
        shifts = Calibration.load_shifts(shifts_file)
        
        # Run the calibrations
        spatial_results = Calibration.spatial_calibration(
            folder_path,
            shifts,
        )
        wavelength_results = Calibration.wavelength_calibration(
            folder_path,
            shifts,
        )
        intensity_results = Calibration.intensity_calibration(
            folder_path,
            shifts,
        )
        
        print("Calibration completed successfully")
        
    except Exception as e:
        print(f"Pipeline failed: {str(e)}")

Advanced Features

Calibration calculated on Fe files, then applying the shifts to Ha files. The file used as the target for calibrations is the third file available.

# ... Initialisation code as before

print("=== CALIBRATING FE FILES ===")
spatial_results = Calibration.spatial_calibration(
    folder_path,
    shifts,
    alignment_wavelength=40,
    reference_index=2,
    wide_min_radius=600,
    wide_max_radius=1200,
    mode="fe_only"
)

wavelength_results = Calibration.wavelength_calibration(
    folder_path,
    shifts,
    reference_index=2
    region_size=100,
    percentage=1,
    mode="fe_only"
)

intensity_results = Calibration.intensity_calibration(
    folder_path,
    shifts,
    reference_index=2
    region_size=100,
    percentage=1,
    mode="fe_only"
)

# Second run: Apply calibrations to H-alpha files with plotting
print("=== APPLYING TO H-alpha FILES ===")
ha_results = Calibration.apply_calibrations_to_ha_files(
    folder_path,
    shifts,
    alignment_wavelength=40,
    plot_spectra=True
)

File Structure

The package creates the following directory structure during processing:

📦 input_folder ┣━━ 📂 AlignedImages ┃ ┣━━ 📂 Spatial # Spatially aligned files ┃ ┣━━ 📂 Wavelength # Wavelength calibrated files ┃ ┣━━ 📂 Intensity # Intensity normalized files ┃ ┗━━ 📂 H_alpha # Processed H-alpha files ┣━━ 📂 plots # Diagnostic plots ┗━━ shifts.csv # Tracking file for calibration parameters

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

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

satprocess-0.1.1.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

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

satprocess-0.1.1-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file satprocess-0.1.1.tar.gz.

File metadata

  • Download URL: satprocess-0.1.1.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for satprocess-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9ebaecb47437bbd94bcc70c62f43bf7f93b8b436a01869b8bd2e4ed7afc0c8be
MD5 ff83819abb02889b4eec4c985a71d08b
BLAKE2b-256 d40c92b8469150393e79408778f92d02c1740a0bccde414d22a9b1b4b2eef119

See more details on using hashes here.

File details

Details for the file satprocess-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: satprocess-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for satprocess-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 293a879ca293841579c1856cd1ee1d868fdf29478ea6513d4db5efc28699a957
MD5 781bebbb42196ccc61569c3a6b75ddd9
BLAKE2b-256 94180bd071f4161cc2bbb7b6f9d6d8dee83f59c603dd82a41cc00bce956e64b1

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