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

Uploaded Python 3

File details

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

File metadata

  • Download URL: satprocess-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 6a4986f08bccaa99f143ac31d0d1d25b07eab12ae389be022f067a3a47346307
MD5 aaa5dd2fb8a4400192c926e3e40ba1fe
BLAKE2b-256 ccd447adfc9b427d35eb740b97c2afaf01fb1cb5bd926c76d7a940fa46c8d00e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: satprocess-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f955763c894987c250753afb3f2028695e19b34b91449233bef5f8e7afae3f1f
MD5 e7e1df2bb6105b00696db1413980c96b
BLAKE2b-256 ce315336fc826b4e359a7ef79c4fc6188917af605cdc1bd92f72c121a53258a7

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