diff --git a/glue_astronomy/translators/nddata.py b/glue_astronomy/translators/nddata.py index 4b50536..cc684b6 100644 --- a/glue_astronomy/translators/nddata.py +++ b/glue_astronomy/translators/nddata.py @@ -126,7 +126,7 @@ def to_object(self, data_or_subset, attribute=None): values = data.get_data(attribute) values, mask = _get_value_and_mask(subset_state, data, values) - values = values * u.Unit(component.units) + values = u.Quantity(values, unit=component.units) if has_fitswcs: result = CCDData(values, mask=mask, wcs=wcs, meta=data.meta) diff --git a/glue_astronomy/translators/spectral_cube.py b/glue_astronomy/translators/spectral_cube.py index eca2166..8e236f8 100644 --- a/glue_astronomy/translators/spectral_cube.py +++ b/glue_astronomy/translators/spectral_cube.py @@ -73,7 +73,7 @@ def to_object(self, data_or_subset, attribute=None, cls=SpectralCube): values = values.copy() mask = BooleanArrayMask(mask, wcs=wcs) - values = values * u.Unit(component.units) + values = u.Quantity(values, unit=component.units) # Drop Stokes axis if there is one for FITS WCS if isinstance(wcs, WCS) and wcs.sub([WCSSUB_STOKES]).naxis > 0: diff --git a/glue_astronomy/translators/spectrum1d.py b/glue_astronomy/translators/spectrum1d.py index f61eb6b..300a382 100644 --- a/glue_astronomy/translators/spectrum1d.py +++ b/glue_astronomy/translators/spectrum1d.py @@ -267,7 +267,7 @@ def parse_attributes(attributes): if attribute_label not in ('flux', 'uncertainty'): attribute_label = 'flux' - values = values * u.Unit(component.units) + values = u.Quantity(values, unit=component.units) # If the attribute is uncertainty, we must coerce it to a # specific uncertainty type. If no value exists in the glue