Closed bmorris3 closed 1 year ago
CI failures appear related.
Patch coverage: 100.00
% and project coverage change: +0.34
:tada:
Comparison is base (
63d9e0c
) 96.99% compared to head (5469ccb
) 97.33%.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Looks good for StdDevUncertainty
. I admit I don't know exactly to what extent glue Data objects support other uncertainty types, but Specutils1DHandler
processes and stores the types and units to retrieve the appropriate type:
https://github.com/glue-viz/glue-astronomy/blob/71ded78d9d2b425aad416ab6d734393f0912ef77/glue_astronomy/translators/spectrum1d.py#L275-L277
It would be good to cover this consistently, and perhaps add test cases for VarianceUncertainty
and InverseVariance
.
Then at some point we should probably see how the Spectrum1D
translator can reuse the NDData
functionality, but that need not be part of this PR.
@dhomeier I agree this would be great! For now, the relevant collapse functions I wrote for jdaviz via astropy in NDDataArray
only support variance-like uncertainties, so this PR is a good first step (https://github.com/astropy/astropy/pull/14175).
I see. Would it make sense to have to_data
convert other types with represent_as(StdDevUncertainty)
then? That's probably a bit double-sided, as other applications may have use for the original forms, even if jdaviz does not a this point.
But otherwise I think it should check for the correct type on input, as the present implementation would e.g. silently interpret an InverseVariance
as StdDevUncertainty
and return it as such.
Good idea @dhomeier! Implemented in https://github.com/glue-viz/glue-astronomy/pull/86/commits/91d8dbc8989871182d358dbd5fd46ccc7e29cdc2.
Will need imports for the other uncertainties; also we may have to compare to spec.uncertainty
instead of uncertainty
since the former should have the correct units set (not sure if represent_as
will transform it correctly otherwise).
@dhomeier Done and passing 💯
@dhomeier Would you consider this a bugfix, for soon release? We will use it downstream in https://github.com/spacetelescope/jdaviz/pull/2039.
In #81, I added translators for objects in
astropy.nddata
. In this PR, I add support for extracting uncertainties from glueData
objects and translating them into theuncertainty
attr inNDDataArray
objects. This was missing in the previous PR, but should have been there.