A robust contrast curve analysis tool for astronomical imaging, featuring intelligent annotation placement and comprehensive statistical analysis.
- Automatic star detection and centering
- Robust FITS header handling - handles corrupted or incomplete headers
- Detection limit calculation using median-absolute deviation (MAD) statistics
- Smart annotation placement that automatically avoids data points
- GUI interface for easy parameter adjustment
- Multiple filter presets (Sloan g', r', i', z')
- Configurable smoothing for contrast curves
- Comprehensive output including:
- PSF FWHM measurements
- λ/D calculations
- Dynamic range analysis
- High-quality plots with dual axis (arcsec and pixels)
- Download
ccurve.exefrom this repository - Double-click to run - no installation required!
- Clone this repository
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- Windows:
venv\Scripts\activate - Linux/Mac:
source venv/bin/activate
- Windows:
- Install dependencies:
pip install -r requirements.txt
- Run the application:
python main.py
Simply run the executable or python main.py without arguments to launch the GUI:
- Browse to select your FITS file
- Load the file to read header information
- Adjust parameters as needed:
- Target name
- Telescope specifications
- Pixel scale and wavelength
- Analysis radius range
- Smoothing level
- Click Generate Contrast Curve to create the plot
You can also run the tool from the command line:
python main.py your_image.fitsThe tool will automatically:
- Extract metadata from the FITS header
- Calculate the contrast curve
- Display the plot
- Target Name: Name of the observed object
- Telescope Name: Name of the telescope used
- Diameter: Telescope diameter in inches
- Confidence Level (σ): Detection threshold (default: 5σ)
- Min/Max Radius: Analysis range in pixels
- Pixel Scale: Image scale in arcseconds per pixel
- Wavelength: Observation wavelength in nanometers
- Smoothing (sigma): Gaussian smoothing level (0=none, 5=aggressive)
The tool implements a robust statistical method for contrast curve generation:
- Extrema Detection: Identifies all local maxima and minima in concentric annuli around the star
- Statistical Analysis:
- Calculates median values to resist outliers
- Uses MAD (Median Absolute Deviation) for robust standard deviation estimation
- Detection Limit:
Detection Limit = median(maxima) + 5 × avg(σ_maxima, σ_minima) - Smart Visualization: Automatically places annotations to avoid obscuring data points
The generated plots include:
- Scatter plot of local maxima (empty squares) and minima (dots)
- 5σ detection limit curve (red line)
- Dual x-axis showing separation in both arcseconds and pixels
- Information box with:
- Target and telescope details
- Pixel scale and PSF FWHM
- λ/D and dynamic range
- Observation date (if available)
- Automatic detection annotation for significant detections
This tool is provided as-is for astronomical research purposes.
Generated with assistance from Claude Code