Skip to main content

Image processing utilities for SpectroForged instruments, powered by PrISM

Project description

prism-imageproc

DOI

This repository contains the Python library prism-imageproc, which provides tools for processing images from instruments modeled using SpectroForge (https://github.com/prism-spectra/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

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

prism_imageproc-0.0.4.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prism_imageproc-0.0.4-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file prism_imageproc-0.0.4.tar.gz.

File metadata

  • Download URL: prism_imageproc-0.0.4.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for prism_imageproc-0.0.4.tar.gz
Algorithm Hash digest
SHA256 d8c49e3d0a7fb2efc8ca9d5500e737e59b5386591ed3eb43659195f8b3501ce7
MD5 8b64b10ec2717e25ea42d16840ab9ccc
BLAKE2b-256 9793dc6aceaf1899b73c49ecb4a066ed50ffdbbf89a99ffd76ad99b655499260

See more details on using hashes here.

File details

Details for the file prism_imageproc-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for prism_imageproc-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eaf2e79defd62d3ff649cba4e3629ba7b0940ff52e1ceed8c80fb5de0449c155
MD5 6b42848f3095ff68a8385e5d07e84fcb
BLAKE2b-256 2ed64707d99fc01e5232554b3cfa0653a13864ba19bc278e5c87772dadfd753e

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