Example #1
0
def test_gwa_to_slit(tmpdir):
    transforms = [m1, m2]
    s0 = Slit("s0", 1, 2, 3, 4, 5, 6, 7, 8)
    s1 = Slit("s1", 10, 20, 30, 40, 50, 60, 70, 80)
    slits = [s0, s1]
    m = Gwa2Slit(slits, transforms)
    assert_model_roundtrip(m, tmpdir)

    slits = [1, 2]
    m = Gwa2Slit(slits, transforms)
    assert_model_roundtrip(m, tmpdir)
Example #2
0
def test_gwa_to_slit(tmpdir):
    transforms = [m1, m2]
    s0 = Slit("s0", 1, 2, 3, 4, 5, 6, 7, 8)
    s1 = Slit("s1", 10, 20, 30, 40, 50, 60, 70, 80)
    slits = [s0, s1]
    m = Gwa2Slit(slits, transforms)
    tree = {'model': m}
    helpers.assert_roundtrip_tree(tree, tmpdir, extensions=jwextension.JWSTExtension())

    slits = [1, 2]
    m = Gwa2Slit(slits, transforms)
    tree = {'model': m}
    helpers.assert_roundtrip_tree(tree, tmpdir, extensions=jwextension.JWSTExtension())
Example #3
0
def test_msa_configuration_multiple_returns():
    """
    Test the get_open_msa_slits function.
    """
    # Test 4: One row is skipped, should be acceptable.
    msa_meta_id = 16
    msaconfl = get_file_path('msa_configuration.fits')
    dither_position = 1
    slitlet_info = nirspec.get_open_msa_slits(msaconfl,
                                              msa_meta_id,
                                              dither_position,
                                              slit_y_range=[-.5, .5])
    ref_slit1 = Slit(59, 8651, 1, 256, 24, -2.85, 5.15, 4, 1, '11x1011',
                     '95065_1', '2122', 0.13000000000000003,
                     -0.31716078999999997, -0.18092266)
    ref_slit2 = Slit(60, 11573, 1, 258, 32, -2.85, 4, 4, 2, '11x111',
                     '95065_2', '172', 0.70000000000000007,
                     -0.31716078999999997, -0.18092266)
    _compare_slits(slitlet_info[0], ref_slit1)
    _compare_slits(slitlet_info[1], ref_slit2)
Example #4
0
def test_msa_configuration_all_background():
    """
    Test the get_open_msa_slits function.
    """

    # Test 3:  No non-background, not acceptable.
    msa_meta_id = 14
    msaconfl = get_file_path('msa_configuration.fits')
    dither_position = 1
    slitlet_info = nirspec.get_open_msa_slits(msaconfl,
                                              msa_meta_id,
                                              dither_position,
                                              slit_y_range=[-.5, .5])
    ref_slit = Slit(57, 8646, 1, 251, 24, -2.85, .55, 4, 0, '11x',
                    'background_57', 'bkg_57', 0, -0.5, -0.5)
    _compare_slits(slitlet_info[0], ref_slit)
Example #5
0
def test_msa_configuration_normal():
    """
    Test the get_open_msa_slits function.
    """

    # Test 1: Reasonably normal as well
    msa_meta_id = 12
    msaconfl = get_file_path('msa_configuration.fits')
    dither_position = 1
    slitlet_info = nirspec.get_open_msa_slits(msaconfl,
                                              msa_meta_id,
                                              dither_position,
                                              slit_y_range=[-.5, .5])
    ref_slit = Slit(55, 9376, 1, 251, 26, -5.15, 0.55, 4, 1, '1111x',
                    '95065_1', '2122', 0.13, -0.31716078999999997, -0.18092266)
    _compare_slits(slitlet_info[0], ref_slit)
Example #6
0
def test_msa_configuration_row_skipped():
    """
    Test the get_open_msa_slits function.
    """

    # Test 4: One row is skipped, should be acceptable.
    msa_meta_id = 15
    msaconfl = get_file_path('msa_configuration.fits')
    dither_position = 1
    slitlet_info = nirspec.get_open_msa_slits(msaconfl,
                                              msa_meta_id,
                                              dither_position,
                                              slit_y_range=[-.5, .5])
    ref_slit = Slit(58, 8646, 1, 251, 24, -2.85, 5.15, 4, 1, '11x1011',
                    '95065_1', '2122', 0.130, -0.31716078999999997, 0.18092266)
    _compare_slits(slitlet_info[0], ref_slit)