Metadata-Version: 2.4
Name: prism-imageproc
Version: 0.0.3
Summary: Image processing utilities for SpectroForged instruments, powered by PrISM
Author-email: "Sunip K. Mukherjee" <sunipkmukherjee@gmail.com>
License: MIT
Keywords: image-processing,remote-sensing,mosaic
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: astropy>=7.1
Requires-Dist: dacite>=1.8.1
Requires-Dist: natsort>=8.4.0
Requires-Dist: numpy>=1.26
Requires-Dist: scikit-image>=0.22
Requires-Dist: serde-dataclass>=0.0.4
Requires-Dist: tomlkit>=0.12.5
Requires-Dist: xarray>=2024.1.0
Requires-Dist: netcdf4>=1.6.3
Requires-Dist: astropy-xarray==0.1.0

# prism-imageproc

[![DOI](https://zenodo.org/badge/1201252361.svg)](https://zenodo.org/badge/latestdoi/1201252361)

This repository contains the Python library `prism-imageproc`, which provides tools for processing images
from instruments modeled using SpectroForge (https://github.com/sunipkm/SpectroForge). The library includes functions
applying image transformations to map detector images onto the focal plane of the instrument, as well as
remove diffraction slit curvature from the images. This library is designed to be used stand-alone, using
the instrument configuration files generated by SpectroForge. This library is also used internally by
SpectroForge.

# Installation

You can install the library using pip:

```bash
pip install prism-imageproc
```

# Usage

The library is used in the following way:

```python
# Import the library
from prism_imageproc import ImageStraightener
import matplotlib.pyplot as plt # For plotting the straightened images

# Create a straightener object using the instrument configuration file
straightener = ImageStraightener.from_instrument_config('path/to/instrument_curve_maps.bin')
# Load an image and map it onto the mosaic grid
image_array = ...  # Load your image as a 2D NumPy array
mapped_image = straightener.load_image(image_array)
# Straighten the image by removing slit curvature
straightened_images = mapped_image.straighten_image()
# The result is a dictionary of straightened images, one for each window. You can access them like this:
for window_name, straightened_image in straightened_images.items():
    print(f"Straightened image for window {window_name}:")
    straightened_image.plot()  # Render the straightened image
    plt.show() # Display the plot
```
