diff --git a/gemini_instruments/gmu.py b/gemini_instruments/gmu.py index 3be8ef96a..8c812b02c 100644 --- a/gemini_instruments/gmu.py +++ b/gemini_instruments/gmu.py @@ -112,7 +112,9 @@ def return_requested_units(input_units='nm'): """ Decorator that replaces the repeated code for asMicrometers, asNanometers, asAngstroms. Should be replaced by a "units='nm'" - parameter, but time is limited. Keeping current coding to avoid + parameter, but time is limited. + + Returns as np.float32 values to avoid excessive precision """ def inner_decorator(fn): @wraps(fn) diff --git a/gemini_instruments/test/lut_descriptors.py b/gemini_instruments/test/lut_descriptors.py index 07b2eba1f..4dbf765a3 100644 --- a/gemini_instruments/test/lut_descriptors.py +++ b/gemini_instruments/test/lut_descriptors.py @@ -510,7 +510,7 @@ ('detector_x_bin', 1), ('detector_y_bin', 1), ('disperser', 'MIRROR'), - ('dispersion', [-3.8800000000000006e-10]), + ('dispersion', [-3.88e-10]), ('dispersion_axis', [2]), ('effective_wavelength', 1.25e-06), ('elevation', 60.1851833333), diff --git a/gemini_instruments/test/test_astrodata_descriptors.py b/gemini_instruments/test/test_astrodata_descriptors.py index ba28bd2f8..a423200ce 100644 --- a/gemini_instruments/test/test_astrodata_descriptors.py +++ b/gemini_instruments/test/test_astrodata_descriptors.py @@ -4,12 +4,19 @@ import gemini_instruments import os +import numpy as np + + +FLOAT_TYPES = (float, np.float32, np.float64) + THIS_DIR = os.path.dirname(__file__) from .lut_descriptors import fixture_data as descriptors_fixture_data # Keep separate because GHOST has non-raw files from .ghost_lut_descriptors import fixture_data as ghost_descriptors_fixture_data +F + @pytest.mark.parametrize("instr,filename,descriptor,value", ([*k]+[*vv] for k, v in (list(descriptors_fixture_data.items()) + @@ -40,7 +47,7 @@ def test_descriptor(instr, filename, descriptor, value): assert method() is None else: mvalue = method() - if float in (type(value), type(mvalue)): + if type(value) in FLOAT_TYPES or type(mvalue) in FLOAT_TYPES: assert abs(mvalue - value) < 0.0001 else: assert value == mvalue