NGC 5335 · HST demo
Drag the handle to compare the raw HST frame and the LACosmic output. Notice how the algorithm removes razor-sharp impacts while leaving compact stars alone.
- Laplacian detection (astroscrappy) powered by your camera noise model.
- PSF-aware discrimination via Object Limit.
- meanmask interpolation to preserve photometry.
Raw Input
Cleaned
PixInsight interface
Control everything inside PixInsight (PJSR): presets for common sensors, execution logs, cleaned-pixel stats, and persistent storage for camera parameters.
How LACosmic works
Instead of judging pixels by brightness alone, LACosmic analyzes sharpness (second derivative) and the statistics of your camera noise. Here’s the short version:
- Laplacian filter spots the ultra-steep spikes that cosmic rays leave behind.
- Noise model uses Gain / Read Noise so the detection threshold adapts to your hardware.
- Sigma clipping compares the Laplacian signal to the noise model; anything above threshold is flagged.
- Object Limit differentiates PSF-shaped stars from cosmic rays to avoid false positives.
- Iterations repeat the process so adjacent hits revealed after the first pass also get removed.
- meanmask / medmask interpolation fills flagged pixels using neighboring data while respecting photometry.
Suggested workflow
Drop the module right after calibration, before alignment/stacking. It’s tuned for >30 s exposures (HST, CMOS, CCD) and shines when you only have a single frame to clean.
- Sigma Clipping 4.5 — lower to 3.0 if the dataset is heavily contaminated.
- Object Limit 5.0 — increase if bright stars show any clipping.
- Iterations 5 — 4 to 6 passes handle most cases.
- Clean Type — meanmask (default) or medmask for noisy scenes.
Scientific summary
BB Cosmic Rays is a direct adaptation of the van Dokkum (2001) LACosmic method. The script leverages astroscrappy’s Laplacian edge detection to isolate cosmic-ray impacts, normalizes the noise model using camera-specific gain/read-noise, and performs iterative rejection/interpolation passes that respect photometric accuracy. The PixInsight implementation automatically rescales normalized (0–1) data to ADU so the detection thresholds mirror the original theory.
Recommended usage: apply to calibrated exposures longer than ~30 s prior to registration/stacking. Avoid already-stacked data (rejection is redundant) and planetary/lunar imaging where different denoising strategies are preferred.