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.2.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.2-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: satprocess-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 155277c8a61ba3923e9f5e5c3d7fedb4de3626abd72ab4817ec82b93e228beb3
MD5 60b4ff6069c197de6b7197d1f6001d49
BLAKE2b-256 136e83645dcbf86eef913b803b6a328d7489849e203e5c1f7a7d7a133c3542bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: satprocess-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f4e4d29780d822a0406df547153eb11ee73b3049eb1d88f7808a41fece56a2e2
MD5 de54cc4dcbe726f4b5f457621e19b3c8
BLAKE2b-256 6b1e97ea73593f6a049e7792ccb74f01988666534d79c12c25e4b1a288d9aa78

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