CRISPY simulates the WFIRST (now Roman Space Telescope) Integral Field Spectrograph with high-fidelity modeling of optical effects, detector characteristics, and data reduction pipelines.
- π High-Fidelity IFS Simulation: Complete modeling of WFIRST/Roman Space Telescope IFS
- π Polychromatic Processing: Full spectral cube generation and analysis
- ποΈ Multiple Configurations: Support for WFIRST and PISCES instruments
- π§ͺ Comprehensive Testing: Modern pytest framework with emoji output
- π Data Reduction Tools: Optimal extraction, wavelength calibration, and more
- π Python 3.8+: Modernized for current Python standards
# Clone the repository
git clone https://github.com/mjrfringes/crispy.git
cd crispy
# Create and activate the conda environment (use 'mamba' instead of 'conda' if preferred)
conda env create -f environment.yml
conda activate crispy
# Install in development mode
pip install -e .
# Test the installation π§ͺ
python test_environment.py# Clone and install directly
git clone https://github.com/mjrfringes/crispy.git
cd crispy
python setup.py installCRISPY includes a modern pytest framework with beautiful emoji output:
# Always activate environment first
conda activate crispy
# Run all working tests β
python run_tests.py --working
# Run unit tests only π§ͺ
python run_tests.py --unit
# Run integration tests π
python run_tests.py --integration
# Run fast tests (skip slow ones) β‘
python run_tests.py --fast
# Run with coverage report π
python run_tests.py --coverage
# Get help with all options
python run_tests.py --helpπ Starting CRISPY Test Suite
==================================================
tests/unit/test_core_functionality.py β
.β
β
β
.β
β
tests/unit/test_working_functions.py β
.β
β
β
.β
β
==================================================
π Test Session Complete!
π All tests passed!
import numpy as np
from crispy.configs.WFIRST import params
from crispy.IFS import polychromeIFS
# Load WFIRST parameters
par = params.Params()
# Create input cube (wavelength, x, y)
wavelengths = np.linspace(600, 900, 10) # nm
input_cube = np.ones((10, 64, 64))
# Run IFS simulation
detector_image = polychromeIFS(par, wavelengths, input_cube)# WFIRST configuration
from crispy.configs.WFIRST import params as wfirst_params
wfirst_par = wfirst_params.Params()
# PISCES configuration
from crispy.configs.PISCES import params as pisces_params
pisces_par = pisces_params.Params()
print(f"WFIRST R = {wfirst_par.R}") # R = 50
print(f"PISCES R = {pisces_par.R}") # R = 70from crispy.tools.image import Image
from crispy.unitTests import testOptExt
# Load your detector image
detector_data = np.random.rand(128, 128) * 1000
image = Image(data=detector_data)
# Perform optimal extraction
spectrum, variance = testOptExt(par, image, lensX=0, lensY=0)The detector mapping stored in lamsol.dat is documented in the Sphinx docs as
Wavelength Solution Files. That page explains the column layout, coefficient
ordering, lenslet index convention, and the recommended APIs for converting a
given lenslet index and wavelength into detector (x, y) coordinates.
crispy/
βββ crispy/ # Main package
β βββ WFIRST/ # WFIRST instrument parameters
β βββ PISCES/ # PISCES instrument parameters
β βββ tools/ # Analysis and processing tools
β βββ *.py # Core modules
βββ tests/ # Modern pytest test suite
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
β βββ conftest.py # Test fixtures
βββ docs/ # Documentation and notebooks
βββ environment.yml # Conda environment
βββ setup.py # Package setup
βββ pytest.ini # pytest configuration
βββ run_tests.py # Test runner with emoji support
# Start Jupyter in the crispy environment
conda activate crispy
jupyter notebook
# Navigate to docs/source/notebooks/ for examplescd docs
make htmlTests are organized by category with descriptive markers:
@pytest.mark.working # β
Known working tests
@pytest.mark.experimental # β οΈ Experimental features
@pytest.mark.slow # π Long-running tests
@pytest.mark.requires_data # π Needs reference data- π Full Documentation: https://mjrfringes.github.io/crispy/index.html
- π Wavelength Solution Format: build the docs locally and open the
Wavelength Solution Filespage forlamsol.datdetails - π§ Developer Guide: See
CLAUDE.mdfor development workflow - π Example Notebooks: Located in
docs/source/notebooks/
Original Development Team:
- Maxime Rizzo
- Tim Brandt
- Neil Zimmerman
- Tyler Groff
- Prabal Saxena
- Mike McElwain
- Avi Mandell
Institution: NASA Goddard Space Flight Center
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
- π§ General Questions: Contact the development team
Ready to simulate some spectra?
- β¬οΈ Install: Follow the installation instructions above
- π§ͺ Test: Run
python run_tests.py --workingto verify everything works - π Learn: Check out the notebooks in
docs/source/notebooks/ - π Simulate: Start with the basic examples above
Happy Simulating! β¨π