Skip to content

Commit

Permalink
skip some things for jwst 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrammer committed Oct 22, 2024
1 parent 16e4e34 commit 8bf67db
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 16 deletions.
7 changes: 5 additions & 2 deletions msaexp/tests/test_combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

import numpy as np
import matplotlib.pyplot as plt

import jwst

from .. import utils
from .. import slit_combine
from .. import spectrum

TARGETS = ["1345_933"]
if jwst.__version__ < "100.16":
TARGETS = ["1345_933"]
else:
TARGETS = ["4233_19489"]


def data_path():
Expand Down
17 changes: 16 additions & 1 deletion msaexp/tests/test_drizzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,26 @@
import numpy as np
import matplotlib.pyplot as plt

import pytest
import jwst

from .. import utils, pipeline
from .. import drizzle as msadrizzle

pipe = None
TARGETS = ["1345_933"]

# TARGETS = ["1345_933"]

if jwst.__version__ < "100.16":
TARGETS = ["1345_933"]
else:
TARGETS = ["4233_19489"]

if jwst.__version__ >= "1.16":
pytest.skip(
"Skip drizzle with jwst={jwst.__version__} >= 1.16",
allow_module_level=True,
)


def data_path():
Expand Down
10 changes: 7 additions & 3 deletions msaexp/tests/test_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
plt.ioff()

import astropy.io.fits as pyfits
import jwst

from .. import utils, spectrum

eazy_templates = None

# SPECTRUM_FILE = f'ceers-prism.1345_933.v0.spec.fits'
SPECTRUM_FILE = "test-driz-center-bkg_933.spec.fits"
# SPECTRUM_FILE = 'test-driz-center_933.spec.fits'
if jwst.__version__ < "100.16":
# SPECTRUM_FILE = f'ceers-prism.1345_933.v0.spec.fits'
SPECTRUM_FILE = "test-driz-center-bkg_933.spec.fits"
# SPECTRUM_FILE = 'test-driz-center_933.spec.fits'
else:
SPECTRUM_FILE = "rubies-egs51-v4_prism-clear_4233_19489.spec.fits"


def data_path():
Expand Down
40 changes: 30 additions & 10 deletions msaexp/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import os
import numpy as np
import pytest
from scipy.stats import uniform

import jwst

from .. import utils


Expand Down Expand Up @@ -292,22 +295,39 @@ def test_pixfrac():
def data_path():
return os.path.join(os.path.dirname(__file__), "data")


def test_slit_things():

import jwst.datamodels

import jwst

os.chdir(data_path())

file = 'jw01345062001_03101_00001_nrs2_phot.138.1345_933.fits'

if jwst.__version__ < "100.16":
file = "jw01345062001_03101_00001_nrs2_phot.138.1345_933.fits"
else:
file = "jw04233005001_03101_00002_nrs1_phot.140.4233_19489.fits"

with jwst.datamodels.open(file) as slit:
utils.update_slit_metadata(slit)

with jwst.datamodels.open(file) as slit:
corr = utils.slit_normalization_correction(slit, verbose=True)



@pytest.mark.skipif(jwst.__version__ >= "1.16", reason="requires jwst<1.16")
def test_slit_sign():

import jwst.datamodels
import jwst

os.chdir(data_path())

if jwst.__version__ < "100.16":
file = "jw01345062001_03101_00001_nrs2_phot.138.1345_933.fits"
else:
file = "jw04233005001_03101_00002_nrs1_phot.140.4233_19489.fits"

with jwst.datamodels.open(file) as slit:
sign = utils.get_slit_sign(slit)
assert sign == -1




0 comments on commit 8bf67db

Please sign in to comment.