Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use stpipe.crds_client.reference_uri_to_cache_path #8542

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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