Skip to content

Commit

Permalink
Make default flux unit DN; bump minimum Python req
Browse files Browse the repository at this point in the history
  • Loading branch information
ojustino committed Nov 21, 2022
1 parent 4b0bdd5 commit c9e076e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ github_project = astropy/specreduce
[options]
zip_safe = False
packages = find:
python_requires = >=3.7
python_requires = >=3.8
setup_requires = setuptools_scm
install_requires =
astropy
Expand Down
2 changes: 1 addition & 1 deletion specreduce/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _parse_image(self, image, disp_axis=1):
else:
uncertainty = VarianceUncertainty(np.ones(img.shape))

unit = getattr(image, 'unit', u.Unit('DN')) # or u.Unit()?
unit = getattr(image, 'unit', u.Unit('DN'))

spectral_axis = getattr(image, 'spectral_axis',
np.arange(img.shape[disp_axis]) * u.pix)
Expand Down
8 changes: 4 additions & 4 deletions specreduce/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class HorneExtract(SpecreduceOperation):
unit : `~astropy.units.Unit` or str, optional
(Only used if ``image`` is not an NDData object.)
The associated unit for the data in ``image``. If blank,
fluxes are interpreted as unitless. [default: None]
fluxes are interpreted in DN. [default: None]
"""
image: NDData
Expand Down Expand Up @@ -307,7 +307,7 @@ def _parse_image(self, image,
unit : `~astropy.units.Unit` or str, optional
(Only used if ``image`` is not an NDData object.)
The associated unit for the data in ``image``. If blank,
fluxes are interpreted as unitless.
fluxes are interpreted in DN.
disp_axis : int, optional
The index of the image's dispersion axis. Should not be
changed until operations can handle variable image
Expand Down Expand Up @@ -381,7 +381,7 @@ def _parse_image(self, image,
variance = VarianceUncertainty(variance)

unit = getattr(image, 'unit',
u.Unit(unit) if unit is not None else u.Unit())
u.Unit(unit) if unit is not None else u.Unit('DN'))

spectral_axis = getattr(image, 'spectral_axis',
np.arange(img.shape[disp_axis]) * u.pix)
Expand Down Expand Up @@ -434,7 +434,7 @@ def __call__(self, image=None, trace_object=None,
unit : `~astropy.units.Unit` or str, optional
(Only used if ``image`` is not an NDData object.)
The associated unit for the data in ``image``. If blank,
fluxes are interpreted as unitless.
fluxes are interpreted in DN.
Returns
Expand Down
4 changes: 2 additions & 2 deletions specreduce/tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ def test_horne_image_validation():
ext = extract(image=image.data, variance=err, mask=mask)

# an array-type image given without mask and unit arguments is fine
# and produces an extraction with unitless flux and spectral axis in pixels
# and produces an extraction with flux in DN and spectral axis in pixels
err = np.ones_like(image)
ext = extract(image=image.data, variance=err, mask=None, unit=None)
assert ext.unit == u.Unit()
assert ext.unit == u.Unit('DN')
assert np.all(ext.spectral_axis
== np.arange(image.shape[extract.disp_axis]) * u.pix)

Expand Down

0 comments on commit c9e076e

Please sign in to comment.