diff --git a/pyproject.toml b/pyproject.toml index 3efd043..2bf6fd8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,7 @@ dependencies = [ # "rad >=0.19.2", # "roman_datamodels >=0.19.1", "rad @ git+https://github.com/spacetelescope/rad.git", - # "roman_datamodels @ git+https://github.com/spacetelescope/roman_datamodels.git", - "roman_datamodels @ git+https://github.com/stscieisenhamer/roman_datamodels.git@rcal-853-velocity", + "roman_datamodels @ git+https://github.com/spacetelescope/roman_datamodels.git", "gwcs >=0.19.0", "jsonschema >=4.8", "numpy >=1.22", diff --git a/romanisim/tests/test_wcs.py b/romanisim/tests/test_wcs.py index c9ed3a9..8654bed 100644 --- a/romanisim/tests/test_wcs.py +++ b/romanisim/tests/test_wcs.py @@ -171,3 +171,25 @@ def test_scale_factor(): sky = gwcs.pixel_to_world(grid, grid) assert all(truth.separation(sky).to(u.arcsec).value < 1e-3) + + +def test_scale_factor_negative(): + """Test that specifying a scale factor actually calculates a new wcs""" + + # Truth aiming for. + cc = SkyCoord(ra=0 * u.deg, dec=0 * u.deg) + scale_factor = -99999 + truth = SkyCoord([(0. , 0. ), (0.03055555, 0.03055555), + (0.06111109, 0.06111105), (0.09166659, 0.09166647), + (0.12222204, 0.12222176)], + unit='deg') + + # Make a simple grid of pixel coordinates to calculate sky for + grid = range(0, 4096, 1000) + + # Create the wcs and generate results + distortion = make_fake_distortion_function() + gwcs = wcs.make_wcs(cc, distortion, scale_factor=scale_factor) + sky = gwcs.pixel_to_world(grid, grid) + + assert all(truth.separation(sky).to(u.arcsec).value < 1e-3) diff --git a/romanisim/wcs.py b/romanisim/wcs.py index 59e9f5d..ce9ade0 100644 --- a/romanisim/wcs.py +++ b/romanisim/wcs.py @@ -34,6 +34,8 @@ import romanisim.parameters import roman_datamodels.maker_utils as maker_utils +from romanisim import log + def fill_in_parameters(parameters, coord, pa_aper=0, boresight=True): """Add WCS info to parameters dictionary. @@ -574,7 +576,9 @@ def dva_corr_model(va_scale, v2_ref, v3_ref): return models.Identity(2) if va_scale <= 0: - raise ValueError("'Velocity aberration scale must be a positive number.") + log.warning("Velocity aberration scale must be a positive number: %s", va_scale) + log.warning("Defaulting to scale of 1.0") + va_scale = 1.0 va_corr = models.Scale(va_scale, name="dva_scale_v2") & models.Scale( va_scale, name="dva_scale_v3"