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.

Features

  • Three-stage calibration pipeline:
    • Spatial alignment using circular feature detection
    • 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

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)}")

Core Functions

  • Spatial Calibration: spatial_calibration(folder_path, shifts, **params)

    • Aligns images using circular feature detection
    • Supports adaptive radius detection
  • Wavelength Calibration: wavelength_calibration(folder_path, shifts, **params)

    • Aligns spectra using cross-correlation
    • Preserves spectral relationships
  • Intensity Calibration: intensity_calibration(folder_path, shifts, **params)

    • Normalizes flux to reference spectrum
    • Maintains relative intensities

Advanced Features

Calibration calculated on Fe files, then applying the shifts to Ha files.

# ... Initialisation code as before

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

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

intensity_results = Calibration.intensity_calibration(
    folder_path,
    shifts,
    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.0.tar.gz (16.3 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.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: satprocess-0.1.0.tar.gz
  • Upload date:
  • Size: 16.3 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.0.tar.gz
Algorithm Hash digest
SHA256 4a309c15b3133ed3baa31d4d97175075091bb861724ed1fd8f2885de9f95f3ac
MD5 04bec18269f911545e07d966294a8474
BLAKE2b-256 8efd2b1b58a3cff03d3b948e826e3ed680b1c1e8a39c40426c78214596148ffc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: satprocess-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3466c03059482f99b79ce618c7c11aead17c1ccc14946964798f3e03e7b50fa8
MD5 8916ea8b236e5051eb7a5b3529272385
BLAKE2b-256 b2e02c9181426cfb69ca59c93608e32ee6125232627cc924ef8dda52fcf3706d

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