Skip to content

Releases: astropy/specreduce

v1.9.0

Choose a tag to compare

@hpparvi hpparvi released this 06 May 20:47
cf599fd

specreduce 1.9.0

Released 2026-05-06.

This release introduces new 2D tilt correction classes for measuring
and removing spectral line tilt, adds a specreduce-specific Glossary
to the documentation, and deprecates the legacy terminology page.

Highlights

Tilt correction (#303)

Two new modules give specreduce a complete 2D tilt-correction workflow:

  • specreduce.tilt_correction.TiltCorrection detects arc-lamp lines and
    fits a 2D model of the spectral tilt across the detector.

  • specreduce.tilt_solution.TiltSolution stores the fitted model and
    provides:

    • bidirectional coordinate transforms between the detector frame and the
      tilt-corrected frame,
    • flux-conserving 2D resampling of the input image onto the rectified grid,
    • export of the solution as a gwcs.WCS object via the gwcs property,
    • reconstruction from a previously exported GWCS object via
      TiltSolution.from_gwcs().

The GWCS round-trip means tilt solutions can be persisted in standard
FITS/ASDF WCS containers and reloaded without specreduce-specific
serialisation.

Glossary (#304)

A new specreduce-specific Glossary consolidates the
terminology used across the package in a single reference page.

Other changes

  • The legacy docs/terms.rst terminology document is deprecated and will be
    removed in a future release. A deprecation banner now points readers to the
    new Glossary. (#304)

Compatibility

No new minimum-dependency bumps in this release. The specutils ≥ 2.0 / astropy
≥ 6.0 / scipy ≥ 1.14 / photutils ≥ 1.11 floors introduced in 1.8.0 still apply.

Full changelog

See CHANGES.rst for the complete list of changes.

v1.8.0

Choose a tag to compare

@hpparvi hpparvi released this 25 Feb 16:50
36efd6e

Specreduce 1.8

This release focuses on uncertainty propagation throughout the spectral reduction pipeline, ensuring that extracted spectra carry proper error estimates.

New Features

  • Uncertainty propagation in background estimation — Background.bkg_image(), bkg_spectrum(), sub_image(), and sub_spectrum() now return results with proper uncertainties. When the input image has uncertainty, it is propagated using variance
    formulas appropriate for the chosen statistic. When no uncertainty is provided, it is estimated from the flux values in the background region. (#297)
  • Uncertainty propagation in spectrum extraction — BoxcarExtract and HorneExtract now produce extracted spectra with proper uncertainties. (#295, #296)
  • Sigma clipping in background estimation — New optional sigma parameter on Background for outlier rejection (default: 5.0; set to None to disable). (#297)

API Changes

  • Migrated to specutils 2.0 — Removed the specreduce.compat module; all internal code now uses specutils.Spectrum directly. Users must update to specutils >= 2.0. (#299)
  • Bumped minimum dependencies — specutils >= 2.0, astropy >= 6.0, scipy >= 1.14, photutils >= 1.11. (#299)

Other Changes

  • Switched to sphinx_astropy.conf.v2 and revised documentation. (#275)

Installation

pip install specreduce==1.8.0

v1.7.0

Choose a tag to compare

@hpparvi hpparvi released this 13 Nov 20:59
05be828

New Features

  • Added a new specreduce.wavecal1d.WavelengthCalibration1D class for one-dimensional wavelength
    calibration. The old specreduce.wavelength_calibration.WavelengthCalibration1D is
    deprecated and will be removed in v. 2.0. [#265]
  • Added a disp_bounds argument to tracing.FitTrace. The argument allows for adjusting the
    dispersion-axis window from which the trace peaks are estimated. [#277]

v1.6.0

Choose a tag to compare

@hpparvi hpparvi released this 18 Jun 21:06
8f3738d

Bug Fixes

  • When all-zero bin encountered in fit_trace with peak_method=gaussian, the bin peak
    will be set to NaN in this case to work better with DogBoxLSQFitter. [#257]
  • Reverted the changes to background.Background.bgk_spectrum introduced in 1.5.0 [#266].

Other changes

  • Compatibility with specutils 2.0. [#260]
  • Set Python 3.11 as the minimum supported Python version and added test support
    for Python 3.13. [#271]
  • Changed the statistic parameter in utils.measure_cross_dispersion_profile to accept
    either median or average instead of median or mean. [#258]

v1.5.1

Choose a tag to compare

@hpparvi hpparvi released this 13 Mar 09:25
4afc0c8

1.5.1 (2024-03-08)

Bug Fixes

  • Changed Horne extraction to behave as before when using an interpolated spatial profile
    and not explicitly setting bkgrd_prof to None. The changed default behavior in 1.5.0
    caused problems in codes using specreduce.

v1.5.0

Choose a tag to compare

@hpparvi hpparvi released this 05 Mar 20:24
12f9e6c

New Features

  • Added the mask_treatment parameter to Background, Trace, and Boxcar Extract
    operations to handle non-finite data and boolean masks. Available options are
    apply, ignore, propagate, zero_fill, nan_fill, apply_mask_only,
    or apply_nan_only. [#216, #254]

  • Modified background.Background.bgk_spectrum to allow the user to select the statistic
    used for background estimation between median or average. [#253]

  • Modified extract.BoxcarExtract to ignore non-finite pixels when mask_treatment is set
    to apply; otherwise, non-finite values are propagated. Boxcar extraction is
    now carried out as a weighed sum over the window. When no non-finite values are
    present, the extracted spectra remain unchanged from the previous behaviour.

Bug Fixes

  • Fixed Astropy v7.0 incompatibility bug in tracing.FitTrace: changed to use
    astropy.modeling.fitting.DogBoxLSQFitter when fitting a Gaussian peak model instead of
    astropy.modeling.fitting.LevMarLSQFitter that may be deprecated in the future. Also
    changed to use fitting.LMLSQFitter instead of fitting.LevMarLSQFitter when fitting
    a generic nonlinear trace model. [#229]

Other changes

  • Changed tracing.FitTrace to use astropy.modeling.fitting.LinearLSQFitter
    if the trace model is linear.

New Contributors

Full Changelog: v1.4.1...v1.5.0

v1.4.1

Choose a tag to compare

@cshanahan1 cshanahan1 released this 20 Jun 14:37
ce0c4b2

Bug Fixes
Fix bug where Background one sided / two sided was not correctly assigning units to data. [#221]

v1.4.0: parent 080b288fd29ec64810432bf9127c1a34a4f0ed68 (#220)

Choose a tag to compare

@cshanahan1 cshanahan1 released this 29 May 20:09
388adb0

New Features
^^^^^^^^^^^^

  • Added 'interpolated_profile' option for HorneExtract. If The interpolated_profile option
    is used, the image will be sampled in various wavelength bins (set by
    n_bins_interpolated_profile), averaged in those bins, and samples are then
    interpolated between (linear by default, interpolation degree can be set with
    the interp_degree_interpolated_profile parameter) to generate a continuously varying
    spatial profile that can be evaluated at any wavelength. [#173]

  • Added a function to measure a cross-dispersion profile. A profile can be
    obtained at a single pixel/wavelength, or an average profile can be obtained
    from a range/set of wavelengths. [#214]

API Changes
^^^^^^^^^^^

  • Fit residuals exposed for wavelength calibration in WavelengthCalibration1D.fit_residuals. [#446]

Bug Fixes
^^^^^^^^^

  • Output 1D spectra from Background no longer include NaNs. Output 1D
    spectra from BoxcarExtract no longer include NaNs when none are present
    in the extraction window. NaNs in the window will still propagate to
    BoxcarExtract's extracted 1D spectrum. [#159]

  • Backgrounds using median statistic properly ignore zero-weighted pixels.
    [#159]

  • HorneExtract now accepts 'None' as a vaild option for bkgrd_prof. [#171]

  • Fix in FitTrace to set fully-masked column bin peaks to NaN. Previously, for
    peak_method='max' these were set to 0.0, and for peak_method='centroid' they
    were set to the number of rows in the image, biasing the final fit to all bin
    peaks. Previously for Gaussian, the entire fit failed. [#205, #206]

  • Fixed input of traces in Background. Added a condition to 'FlatTrace' that
    trace position must be a positive number. [#211]

Other changes
^^^^^^^^^^^^^

  • The following packages are now optional dependencies because they are not
    required for core functionality: matplotlib, photutils, synphot.
    To install them anyway, use the [all] specifier when you install specreduce; e.g.:
    pip install specreduce[all] [#202]

v1.3.0

Choose a tag to compare

@ojustino ojustino released this 05 Dec 19:18
v1.3.0
fd2e7ae

New Features

  • The new FitTrace class (see "API Changes" below) introduces the
    ability to take a polynomial trace of an image [#128]

API Changes

  • Renamed KosmosTrace as FitTrace, a conglomerate class for traces that
    are fit to images instead of predetermined [#128]

  • The default number of bins for FitTrace is now its associated image's
    number of dispersion pixels instead of 20. Its default peak_method is
    now 'max' [#128]

  • All operations now accept Spectrum1D and Quantity-type images. All
    accepted image types are now processed internally as Spectrum1D objects
    [#144, #154]

  • All operations' image attributes are now coerced Spectrum1D
    objects [#144, #154]

  • HorneExtract can now handle non-flat traces [#148]

Bug Fixes

  • Fixed passing a single Trace object to Background [#146]

  • Moved away from creating image masks with numpy's mask_invalid()
    function after change to upstream API. This will make specreduce
    be compatible with numpy 1.24 or later. [#155]


What's Changed

New Contributors

Full Changelog: v1.2.0...v1.3.0

v1.2.0

Choose a tag to compare

@ojustino ojustino released this 04 Oct 20:36
v1.2.0
f8c67a9

New Features

  • Background has new methods for exposing the 1D spectrum of the background or
    background-subtracted regions [#143]

Bug Fixes

  • Improved errors/warnings when background region extends beyond bounds of image [#127]
  • Fixed boxcar weighting bug that often resulted in peak pixels having weight
    above 1 and erroneously triggered overlapping background errors [#125]
  • Fixed boxcar weighting to handle zero width and edge of image cases [#141]

What's Changed

  • DOC: No need to automodapi the top-level package by @pllim in #135
  • MNT: Remove dead code from APE 17 by @pllim in #136
  • MNT: Remove version template by @pllim in #134
  • logic to detect background regions extending beyond image limits by @kecnry in #127
  • Found cause of background "overlap" error by @ojustino in #125
  • Enable nitpicky mode for sphinx and get docs to build cleanly by @tepickering in #140
  • basic quickstart examples for spectral extraction by @kecnry in #142
  • Background.bkg_spectrum and sub_spectrum by @kecnry in #143
  • Rewrite boxcar weights logic by @kecnry in #141
  • Prepare changelog for release v1.2.0 by @ojustino in #145

Full Changelog: v1.1.0...v1.2.0