Skip to content

geofstone/ccurve-release

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Contrast Curve Generator

A robust contrast curve analysis tool for astronomical imaging, featuring intelligent annotation placement and comprehensive statistical analysis.

Features

  • 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)

Installation

Option 1: Windows Executable (Easiest)

  1. Download ccurve.exe from this repository
  2. Double-click to run - no installation required!

Option 2: Run from Source

  1. Clone this repository
  2. Create a virtual environment:
    python -m venv venv
  3. Activate the virtual environment:
    • Windows: venv\Scripts\activate
    • Linux/Mac: source venv/bin/activate
  4. Install dependencies:
    pip install -r requirements.txt
  5. Run the application:
    python main.py

Usage

GUI Mode (Default)

Simply run the executable or python main.py without arguments to launch the GUI:

  1. Browse to select your FITS file
  2. Load the file to read header information
  3. Adjust parameters as needed:
    • Target name
    • Telescope specifications
    • Pixel scale and wavelength
    • Analysis radius range
    • Smoothing level
  4. Click Generate Contrast Curve to create the plot

Command Line Mode

You can also run the tool from the command line:

python main.py your_image.fits

The tool will automatically:

  • Extract metadata from the FITS header
  • Calculate the contrast curve
  • Display the plot

Parameters

  • 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)

Method

The tool implements a robust statistical method for contrast curve generation:

  1. Extrema Detection: Identifies all local maxima and minima in concentric annuli around the star
  2. Statistical Analysis:
    • Calculates median values to resist outliers
    • Uses MAD (Median Absolute Deviation) for robust standard deviation estimation
  3. Detection Limit:
    Detection Limit = median(maxima) + 5 × avg(σ_maxima, σ_minima)
    
  4. Smart Visualization: Automatically places annotations to avoid obscuring data points

Output

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

License

This tool is provided as-is for astronomical research purposes.

Author

Generated with assistance from Claude Code

About

Speckle image contrast curve generator

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors