A comprehensive Python toolkit for downloading, processing, and visualizing REAL James Webb Space Telescope (JWST) data using Astropy and other scientific Python libraries. Successfully tested with actual JWST observations!
- β REAL Data Download: Download actual JWST data from MAST using astroquery
- β Image Processing: Complete pipeline for calibrating, denoising, and enhancing JWST images
- β Multi-Filter Support: Process and combine multiple filter images
- β Source Detection: Automatically detect and catalog astronomical sources
- β Beautiful Visualizations: Create publication-quality plots and RGB composites
- β Multiple Instruments: Support for NIRCam, MIRI, NIRSpec, and NIRISS
- β Tested with Real Data: Successfully processed NIRISS observations (2048Γ2048 pixels)
git clone https://github.com/yourusername/jwst-image-processing.git
cd jwst-image-processing-
Clone or download this repository
git clone <repository-url> cd jwst-image-processing
-
Install dependencies
pip install -r requirements.txt
-
Download and process REAL JWST data
python find_jwst_data.py
-
Run the example with synthetic data
python jwst_demo.py
python jwst_main.py --target "NGC 3132" --instrument NIRCam --max-files 5python jwst_main.py --target "M51" --download-onlypython jwst_main.py --process-onlypython jwst_main.py --visualize-onlyjwst-image-processing/
βββ jwst_main.py # Main pipeline script
βββ jwst_data_downloader.py # Data downloading from MAST
βββ jwst_image_processor.py # Image processing functions
βββ jwst_visualizer.py # Visualization tools
βββ find_jwst_data.py # REAL data finder & downloader
βββ download_real_jwst_*.py # Multiple real data downloaders
βββ jwst_demo.py # Synthetic data demo
βββ jwst_real_data_demo.py # Realistic data demo
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ jwst_data/ # Data directory (created automatically)
βββ raw/ # REAL JWST FITS files
βββ processed/ # Processed data
βββ visualizations/ # Generated plots
β Successfully downloaded and processed REAL JWST data!
- Downloaded: 3 real NIRISS observations (2048Γ2048 pixels each)
- Instrument: NIRISS (Near-Infrared Imager and Slitless Spectrograph)
- Filter: CLEAR (broadband near-infrared)
- Program: 01063 (JWST Early Release Science)
- Data Source: MAST archive via astroquery
- Processing: Complete pipeline from raw FITS to enhanced visualizations
The project has been tested and verified with actual telescope data from space!
The find_jwst_data.py script downloads real JWST data from MAST:
from find_jwst_data import find_jwst_data
# Download real JWST data
downloaded_files = find_jwst_data()The JWSTDataDownloader class handles downloading data from MAST:
from jwst_data_downloader import JWSTDataDownloader
# Initialize downloader
downloader = JWSTDataDownloader()
# Search for observations
observations = downloader.search_observations(
target="NGC 3132",
instrument="NIRCam",
max_records=10
)
# Download data
obs_id = observations[0]['obsid']
files = downloader.download_observation(obs_id, max_files=5)The JWSTImageProcessor class handles all image processing:
from jwst_image_processor import JWSTImageProcessor
# Initialize processor
processor = JWSTImageProcessor()
# Process a single image
result = processor.process_single_image(
"path/to/image.fits",
enhance_method='log',
denoise_method='gaussian'
)
# Process multiple filters
filepaths = ["file1.fits", "file2.fits", "file3.fits"]
processed_filters = processor.process_multiple_filters(filepaths)The JWSTVisualizer class creates beautiful plots:
from jwst_visualizer import JWSTVisualizer
# Initialize visualizer
visualizer = JWSTVisualizer()
# Plot single image
visualizer.plot_single_image(
data,
title="My JWST Image",
filter_name="F444W",
stretch='asinh',
colormap='hubble'
)
# Create RGB composite
visualizer.plot_rgb_composite(
rgb_data,
title="RGB Composite",
filters_used=["F444W", "F277W", "F090W"]
)hubble: Hubble Space Telescope styleinfrared: Infrared optimizedcosmic: Cosmic color schemeviridis,plasma,inferno,magma: Standard scientific colormaps
linear: Linear scalinglog: Logarithmic scalingsqrt: Square root scalingasinh: Arcsinh scaling (recommended for most cases)
- Single Image: Individual filter images
- Processing Pipeline: Shows original β calibrated β denoised β enhanced
- Source Detection: Overlays detected sources on images
- Multi-Filter: Grid of all available filters
- RGB Composite: Color composite from multiple filters
- Publication Plot: High-quality combined visualization
- Filters: F090W, F150W, F200W, F277W, F356W, F444W
- Wavelength: 0.6-5.0 ΞΌm
- Best for: Galaxy structure, star formation, exoplanets
- Filters: F560W, F770W, F1000W, F1130W, F1280W, F1500W, F1800W, F2100W, F2550W
- Wavelength: 5-28 ΞΌm
- Best for: Dust, molecular clouds, evolved stars
- Modes: Prism, G140M, G235M, G395M
- Wavelength: 0.6-5.3 ΞΌm
- Best for: Spectroscopy, galaxy evolution
- Filters: F115W, F150W, F200W, F277W, F356W, F444W
- Wavelength: 0.8-5.0 ΞΌm
- Best for: Wide-field imaging, exoplanet transit spectroscopy
- NGC 3132: Southern Ring Nebula
- M51: Whirlpool Galaxy
- NGC 3324: Cosmic Cliffs in Carina Nebula
- Stephan's Quintet: Galaxy group
- WASP-96b: Exoplanet atmosphere
- SMACS 0723: Deep field galaxy cluster
- Visit MAST Portal
- Search for your target of interest
- Filter by JWST observations
- Use the observation ID in the pipeline
# Custom processing with specific parameters
processor = JWSTImageProcessor()
# Load and calibrate
data, header, wcs = processor.load_fits_file("image.fits")
calibrated = processor.basic_calibration(data, header)
# Custom enhancement
enhanced = processor.enhance_contrast(calibrated, method='histogram')
# Custom denoising
denoised = processor.denoise_image(enhanced, method='tv')
# Detect sources with custom threshold
catalog = processor.detect_sources(denoised, threshold=5.0)# Process multiple observations
targets = ["NGC 3132", "M51", "NGC 3324"]
instruments = ["NIRCam", "MIRI"]
for target in targets:
for instrument in instruments:
# Download and process
observations = downloader.search_observations(target, instrument)
if len(observations) > 0:
obs_id = observations[0]['obsid']
files = downloader.download_observation(obs_id)
# Process files...The pipeline generates several types of output:
- Raw FITS: Downloaded from MAST
- Processed FITS: Calibrated and enhanced images
- Source Catalogs: Detected sources with properties
- Single Images: Individual filter plots
- Processing Pipeline: Step-by-step processing visualization
- Source Detection: Images with overlaid sources
- Multi-Filter: Grid of all filters
- RGB Composite: Color composite images
- Publication Plot: High-quality combined visualization
-
No data found for target
- Try different target names or coordinates
- Check if JWST has observed your target
- Use the sample data option
-
Download errors
- Check internet connection
- Verify target name spelling
- Try reducing max_files parameter
-
Processing errors
- Ensure FITS files are valid
- Check file permissions
- Verify all dependencies are installed
-
Visualization issues
- Check matplotlib backend
- Ensure output directory exists
- Verify data is not empty
- Check the Astropy documentation
- Visit JWST documentation
- Explore MAST help
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
This project is open source and available under the MIT License.
- Astropy: Core astronomical Python library
- MAST: Mikulski Archive for Space Telescopes
- JWST Team: For the incredible telescope and data
- Photutils: Source detection and photometry
- Matplotlib: Visualization capabilities
Happy exploring the cosmos! πβ¨
