Skip to content

prism-spectra/prism-imageproc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prism-imageproc

DOI

This repository contains the Python library prism-imageproc, which provides tools for processing images from instruments modeled using 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:

pip install prism-imageproc

Usage

The library is used in the following way:

# 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')
# Get version of the library that produced this
lib_version = straightener.lib_version
# Get hash of the instrument model that produced this
instr_version = straightener.instr_version
# 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

About

Image processing library for PrISM instruments

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages