- Added uncertainty propagation to
specreduce.extract.BoxcarExtractandspecreduce.extract.HorneExtract. The extracted spectra have now proper uncertainties. [#295, #296] - Added uncertainty propagation to
specreduce.background.Background. Thebkg_image(),bkg_spectrum(),sub_image(), andsub_spectrum()methods now return spectra with proper uncertainties. When 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] - Added optional
sigmaparameter tospecreduce.background.Backgroundfor sigma clipping outlier rejection in background estimation. Default is 5.0; set toNoneto disable. [#297]
- Removed
specreduce.compatmodule and migrated all internal code to usespecutils.Spectrumdirectly. This breaks compatibility with specutils 1.x. Users must update to specutils ≥2.0. [#299] - Bumped minimum dependency versions: specutils ≥2.0, astropy ≥6.0, scipy ≥1.14, photutils ≥1.11. These increases are required for specutils 2.0 compatibility. [#299]
- Changed to use
sphinx_astropy.conf.v2and revised the documentation. [#275]
- Added a new
specreduce.wavecal1d.WavelengthCalibration1Dclass for one-dimensional wavelength calibration. The oldspecreduce.wavelength_calibration.WavelengthCalibration1Dis deprecated and will be removed in v. 2.0. - Added a
disp_boundsargument totracing.FitTrace. The argument allows for adjusting the dispersion-axis window from which the trace peaks are estimated.
- 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_spectrumintroduced in 1.5.0 [#266].
- 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
statisticparameter inutils.measure_cross_dispersion_profileto accept eithermedianoraverageinstead ofmedianormean. [#258]
- 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. [#256]
- Added the
mask_treatmentparameter to Background, Trace, and Boxcar Extract operations to handle non-finite data and boolean masks. Available options areapply,ignore,propagate,zero_fill,nan_fill,apply_mask_only, orapply_nan_only. [#216, #254] - Modified
background.Background.bgk_spectrumto allow the user to select the statistic used for background estimation betweenmedianoraverage. [#253] - Modified
extract.BoxcarExtractto ignore non-finite pixels whenmask_treatmentis set toapply; 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.
- Fixed Astropy v7.0 incompatibility bug in
tracing.FitTrace: changed to useastropy.modeling.fitting.DogBoxLSQFitterwhen fitting a Gaussian peak model instead ofastropy.modeling.fitting.LevMarLSQFitterthat may be deprecated in the future. Also changed to usefitting.LMLSQFitterinstead offitting.LevMarLSQFitterwhen fitting a generic nonlinear trace model. [#229]
- Changed
tracing.FitTraceto useastropy.modeling.fitting.LinearLSQFitterif the trace model is linear.
- Fix bug where Background one sided / two sided was not correctly assigning units to data. [#221]
- Added 'interpolated_profile' option for HorneExtract. If The
interpolated_profileoption is used, the image will be sampled in various wavelength bins (set byn_bins_interpolated_profile), averaged in those bins, and samples are then interpolated between (linear by default, interpolation degree can be set with theinterp_degree_interpolated_profileparameter) 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]
- Fit residuals exposed for wavelength calibration in
WavelengthCalibration1D.fit_residuals. [#446]
- 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]
- 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]
- The new FitTrace class (see "API Changes" below) introduces the ability to take a polynomial trace of an image [#128]
- 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'
imageattributes are now coerced Spectrum1D objects [#144, #154] - HorneExtract can now handle non-flat traces [#148]
- Fixed passing a single
Traceobject toBackground[#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]
Backgroundhas new methods for exposing the 1D spectrum of the background or background-subtracted regions [#143]
- 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]
peak_methodas an optional argument toKosmosTrace[#115]
HorneExtractno longer requiresmaskandunitarguments [#105]BoxcarExtractandHorneExtractnow accept parameters (and require the image and trace) at initialization, and allow overriding any input parameters when calling [#117]
- Corrected the default mask created in
HorneExtract/OptimalExtractwhen a user doesn't specify one and gives their image as a numpy array [#118]
- Added
Traceclasses - Added basic synthetic data routines
- Added
BoxcarExtract - Added
HorneExtract, a.k.a.OptimalExtract - Added basic
Backgroundsubtraction
- Update
codecov-actiontov2 - Change default branch from
mastertomain - Test fixes; bump CI to python 3.8 and 3.9 and deprecate support for 3.7