import sys, os import numpy as np import matplotlib.pyplot as plt import astropy.io.fits as fits import logging _log = logging.getLogger("test_webbpsf") _log.addHandler(logging.NullHandler()) from .. import webbpsf_core import poppy # ------------------ NIRSpec Tests ---------------------------- from test_webbpsf import generic_output_test, do_test_source_offset test_nirspec = lambda: generic_output_test("NIRSpec") # Use a larger than typical tolerance when testing NIRSpec offsets. The # pixels are so undersampled (0.1 arcsec!) that it's unreasonable to try for # better than 1/10th of a pixel precision using default settings. test_nirspec_source_offset_00 = lambda: do_test_source_offset("NIRSpec", theta=0.0, tolerance=0.1, monochromatic=3e-6) test_nirspec_source_offset_45 = lambda: do_test_source_offset("NIRSpec", theta=45.0, tolerance=0.1, monochromatic=3e-6)
import matplotlib.pyplot as plt import astropy.io.fits as fits import logging _log = logging.getLogger('test_webbpsf') _log.addHandler(logging.NullHandler()) from .. import webbpsf_core import poppy from .test_errorhandling import _exception_message_starts_with #------------------ NIRCam Tests ---------------------------- from test_webbpsf import generic_output_test, do_test_source_offset test_nircam = lambda : generic_output_test('NIRCam') test_nircam_source_offset_00 = lambda : do_test_source_offset('NIRCam', theta=0.0, monochromatic=2e-6) test_nircam_source_offset_45 = lambda : do_test_source_offset('NIRCam', theta=45.0, monochromatic=2e-6) test_nircam_blc_circ_45 = lambda : do_test_nircam_blc(kind='circular', angle=45) test_nircam_blc_circ_0 = lambda : do_test_nircam_blc(kind='circular', angle=0) test_nircam_blc_wedge_0 = lambda : do_test_nircam_blc(kind='linear', angle=0) test_nircam_blc_wedge_45 = lambda : do_test_nircam_blc(kind='linear', angle=45) import pytest # The test setup for this one is not quite right yet # See https://github.com/mperrin/webbpsf/issues/30 # and https://github.com/mperrin/poppy/issues/29 @pytest.mark.xfail def test_nircam_SAMC(oversample=4):
import numpy as np import matplotlib.pyplot as plt import astropy.io.fits as fits import logging _log = logging.getLogger('test_webbpsf') _log.addHandler(logging.NullHandler()) from .. import webbpsf_core import poppy #------------------ NIRISS Tests ---------------------------- from test_webbpsf import generic_output_test, do_test_source_offset test_niriss= lambda : generic_output_test('NIRISS') test_niriss_source_offset_00 = lambda : do_test_source_offset('NIRISS', theta=0.0, monochromatic=3.0e-6) test_niriss_source_offset_45 = lambda : do_test_source_offset('NIRISS', theta=45.0, monochromatic=3.0e-6) def test_niriss_auto_pupil(): """ Test switching between CLEAR and CLEARP depending on selected filter or wavelengths """ niriss = webbpsf_core.NIRISS() assert niriss.pupil_mask is None niriss.filter='F277W' niriss.calcPSF(nlambda=1) assert niriss.pupil_mask == 'CLEARP'
import astropy.io.fits as fits import logging _log = logging.getLogger('test_webbpsf') _log.addHandler(logging.NullHandler()) from .. import webbpsf_core import poppy #------------------ MIRI Tests ---------------------------- from test_webbpsf import generic_output_test, do_test_source_offset test_miri= lambda : generic_output_test('MIRI') test_miri_source_offset_00 = lambda : do_test_source_offset('MIRI', theta=0.0, monochromatic=8e-6) test_miri_source_offset_45 = lambda : do_test_source_offset('MIRI', theta=45.0, monochromatic=8e-6) def do_test_miri_fqpm(nlambda=1, clobber=True, angle=0.0, offset=0.0, oversample=2, outputdir=None, display=False, save=False): miri = webbpsf_core.MIRI() miri.pupilopd = None miri.filter='F1065C' miri.image_mask = 'FQPM1065' miri.pupil_mask = 'MASKFQPM' #for offset in np.linspace(0.0, 1.0, nsteps): #miri.options['source_offset_theta'] = 0.0 miri.options['source_offset_r'] = offset #for angle in [0,45]: