Skip to content

Commit

Permalink
use stpipe.crds_client.reference_uri_to_cache_path
Browse files Browse the repository at this point in the history
instead off Step.reference_uri_to_cache_path to allow it's removal
in stpipe
  • Loading branch information
braingram committed Jun 8, 2024
1 parent 4fcb915 commit 06c6a6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions jwst/msaflagopen/msaflagopen_step.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from stdatamodels.jwst import datamodels

from stpipe.crds_client import reference_uri_to_cache_path

from ..stpipe import Step
from . import msaflag_open

Expand Down Expand Up @@ -51,7 +53,6 @@ def process(self, input):

def create_reference_filename_dictionary(input_model):
reffiles = {}
a = Step()
reffiles['distortion'] = input_model.meta.ref_file.distortion.name
reffiles['filteroffset'] = input_model.meta.ref_file.filteroffset.name
reffiles['specwcs'] = input_model.meta.ref_file.filteroffset.name
Expand All @@ -72,5 +73,5 @@ def create_reference_filename_dictionary(input_model):
# Convert from crds protocol to absolute filenames
for key in reffiles.keys():
if reffiles[key].startswith('crds://'):
reffiles[key] = a.reference_uri_to_cache_path(reffiles[key], input_model.crds_observatory)
reffiles[key] = reference_uri_to_cache_path(reffiles[key], input_model.crds_observatory)
return reffiles
9 changes: 5 additions & 4 deletions jwst/wavecorr/tests/test_wavecorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from stdatamodels.jwst import datamodels
from stdatamodels.jwst.transforms import models
from stpipe.crds_client import reference_uri_to_cache_path

import jwst
from jwst.assign_wcs import AssignWcsStep
Expand Down Expand Up @@ -59,7 +60,7 @@ def test_wavecorr():
# test the round-tripping on the wavelength correction transform
ref_name = im_wave.meta.ref_file.wavecorr.name
freference = datamodels.WaveCorrModel(
WavecorrStep.reference_uri_to_cache_path(ref_name, im.crds_observatory))
reference_uri_to_cache_path(ref_name, im.crds_observatory))

lam_uncorr = lam_before * 1e-6
wave2wavecorr = wavecorr.calculate_wavelength_correction_transform(
Expand Down Expand Up @@ -160,7 +161,7 @@ def test_skipped():

ref_name = outw.meta.ref_file.wavecorr.name
reffile = datamodels.WaveCorrModel(
WavecorrStep.reference_uri_to_cache_path(ref_name, im.crds_observatory))
reference_uri_to_cache_path(ref_name, im.crds_observatory))
source_xpos = 0.1
aperture_name = 'S200A1'

Expand Down Expand Up @@ -262,10 +263,10 @@ def test_wavecorr_fs():

# test the roundtripping on the wavelength correction transform
ref_name = result.meta.ref_file.wavecorr.name
freference = datamodels.WaveCorrModel(WavecorrStep.reference_uri_to_cache_path(ref_name, im.crds_observatory))
freference = datamodels.WaveCorrModel(reference_uri_to_cache_path(ref_name, im.crds_observatory))

lam_uncorr = lam_before * 1e-6
wave2wavecorr = wavecorr.calculate_wavelength_correction_transform(lam_uncorr, dispersion,
wave2wavecorr = wavecorr.calculate_wavelength_correction_transform(lam_uncorr, dispersion,
freference, slit.source_xpos, 'S200A1')
lam_corr = wave2wavecorr(lam_uncorr)
assert_allclose(lam_uncorr, wave2wavecorr.inverse(lam_corr))
Expand Down

0 comments on commit 06c6a6d

Please sign in to comment.