denoise_median_2d¶
Square median filter over ctx.image, optionally banded by rows.
| Category | Preprocessing (2-D image) |
| Backend | scipy - implemented here on top of scipy primitives |
| Version | 1.0.0 |
| Reads | ctx.image (an ImageFrame) |
| Writes | image |
scipy.ndimage.median_filter(size=kernel_size) over rows [row_lo, row_hi). Outside the band the original pixels are kept.
Parameters¶
| Parameter | Default | Required | Description |
|---|---|---|---|
kernel_size |
3 |
- | Square kernel size, odd integer ≥ 3. |
row_lo |
0 |
- | First row (inclusive); 0 ⇒ top of image. |
row_hi |
0 |
- | Last row (exclusive); 0 ⇒ bottom of image. |
Use it¶
The CLI loads a single 1-D spectrum with --input; this algorithm needs
ctx.image (an ImageFrame). Run it from Python or as a step of a pipeline preset.
References¶
- Tukey 1977, Exploratory Data Analysis (Addison-Wesley) — rank-order filtering for impulse noise.
- scipy.ndimage.median_filter — multi-dim median implementation.
Related algorithms¶
correct_slant_affine- Make monochromatic lines parallel to the rows by a horizontal shear.correct_smile_polynomial- Undo smile curvature via the Schroeder even-order expansion.correct_tilt_affine- Re-align the slit with the detector columns by a vertical shear.dark_subtract- Subtract a master dark fromctx.image.denoise_gaussian_2d- Separable isotropic Gaussian smoothing ofctx.image.flat_normalize- Dividectx.imageby a master flat normalised to unity.flat_normalize_easyspec- Flat-field correct a science frame viacleaning.flatten.outlier_rejection_mad_adaptive- Replace pixels whose deviation from a local median exceedsthreshold·MAD.subtract_bias_easyspec- Subtract a master bias from a single science frame viacleaning.debias.subtract_dark_easyspec- Subtract a master dark from a science frame viacleaning.sub_dark.subtract_sky_2d- Subtract a per-column sky model fitted from off-trace rows ofctx.image.