示例#1
0
def test_wfss_extract_custom_height():
    """Test WFSS extraction with a user supplied half height.

     Notes
     -----
     The filter warning is for fits card length

     objects 9 and 19 should have order 1 extracted
     object 25 should have partial boxes for both orders
     object 26 should have order 2 excluded at order 1 partial
    """
    imwcs, refs = setup_image_cat()
    imwcs.meta.wcsinfo._instance['dispersion_direction'] = 1
    extract_orders = [1]  # just extract the first order
    test_boxes = create_grism_bbox(imwcs,
                                   refs,
                                   mmag_extract=99.,
                                   extract_orders=extract_orders,
                                   wfss_extract_half_height=5)

    for sid in [9, 19]:
        ids = [source for source in test_boxes if source.sid == sid]
        assert len(ids) == 1
        assert [1] == list(ids[0].order_bounding.keys())
        y_extent = ids[0].order_bounding[1][0]
        assert y_extent[1] - y_extent[0] == 10
示例#2
0
def test_create_box_gwcs():
    """Make sure that a box is created around a source catalog object.
    This version allows use of the GWCS to translate the source location.

    This is currently expected to fail because of the distortion
    reference file. The settings and catalog used should produce
    first order trace boxes for the objects.
    """
    source_catalog = get_file_path('step_SourceCatalogStep_cat.ecsv')
    hdul = create_hdul(exptype='NRC_WFSS', pupil='GRISMR', wcskeys=wcs_wfss_kw)
    im = ImageModel(hdul)
    aswcs = AssignWcsStep()
    imwcs = aswcs(im)
    imwcs.meta.source_catalog = source_catalog
    refs = get_reference_files(im)
    test_boxes = create_grism_bbox(imwcs, refs, mmag_extract=99.)
    assert len(test_boxes) >= 2  # the catalog has 4 objects
    for sid in [9, 19]:
        ids = [source for source in test_boxes if source.sid == sid]
        assert len(ids) == 1
        assert ids[0].xcentroid > 0
        assert ids[0].ycentroid > 0
        if sid == 19:
            assert [1, 2] == list(ids[0].order_bounding.keys())
        if sid == 9:
            assert [1] == list(ids[0].order_bounding.keys())
示例#3
0
def test_wfss_extract_custom_wavelength_range():
    """ Test WFSS extraction with a user supplied wavelength_range. """
    imwcs, refs = setup_image_cat()
    test_boxes = create_grism_bbox(imwcs,
                                   mmag_extract=99.,
                                   wavelength_range={1: (3.01, 4.26)})

    for sid in [9, 19]:
        ids = [source for source in test_boxes if source.sid == sid]
        assert len(ids) == 1
        assert [1] == list(ids[0].order_bounding.keys())
示例#4
0
def test_create_specific_orders():
    """Test that boxes only for the specified orders
    are created.. instead of the default in the reference
    file.

     Notes
     -----
     The filter warning is for fits card length

     objects 9 and 19 should have order 1 extracted
     object 25 should have partial boxes for both orders
     object 26 should have order 2 excluded at order 1 partial
    """
    imwcs, refs = setup_image_cat()
    extract_orders = [1]  # just extract the first order
    test_boxes = create_grism_bbox(imwcs,
                                   refs,
                                   mmag_extract=99.,
                                   extract_orders=extract_orders)

    for sid in [9, 19]:
        ids = [source for source in test_boxes if source.sid == sid]
        assert len(ids) == 1
        assert [1] == list(ids[0].order_bounding.keys())