Skip to content

Commit

Permalink
Full step test
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson committed May 25, 2022
1 parent 519ab6a commit cb7e194
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions romancal/assign_wcs/tests/test_wcs.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import numpy as np
import os
import pytest

import numpy as np
from numpy.testing import assert_allclose

from gwcs.wcstools import grid_from_bounding_box

from romancal.assign_wcs.assign_wcs_step import load_wcs
from romancal.assign_wcs.assign_wcs_step import AssignWcsStep
from roman_datamodels import datamodels as rdm
from roman_datamodels.testing import utils as testutil

Expand All @@ -14,12 +15,14 @@

def create_image():
l2 = testutil.mk_level2_image()

l2.meta.wcsinfo.v2_ref = -503
l2.meta.wcsinfo.v3_ref = -318
l2.meta.wcsinfo.ra_ref = 156
l2.meta.wcsinfo.dec_ref = 54.2
l2.meta.wcsinfo.vparity = -1
l2.meta.wcsinfo.roll_ref = 0.15

l2im = rdm.ImageModel(l2)
return l2im

Expand All @@ -36,9 +39,17 @@ def create_distortion():


@pytest.mark.parametrize("distortion", create_distortion())
def test_wcs(distortion):
@pytest.mark.skipif(
os.environ.get("CI") == "true",
reason="Roman CRDS servers are not currently available outside the internal network"
)
def test_wcs(tmpdir, distortion):
file_name = str(tmpdir / 'distortion.asdf')
dist = rdm.DistortionRefModel(distortion)
dist.save(file_name)

l2im = create_image()
l2_wcs = load_wcs(l2im, {'distortion': distortion})
l2_wcs = AssignWcsStep.call(l2im, override_distortion=file_name)

assert l2_wcs.meta.wcs is not None
assert l2_wcs.meta.cal_step.assign_wcs == 'COMPLETE'
Expand Down

0 comments on commit cb7e194

Please sign in to comment.