コード例 #1
0
def test_deimos_mask_coordinates():
    f = os.path.join(os.environ['PYPEIT_DEV'], 'RAW_DATA', 'Keck_DEIMOS',
                     '830G_M_8500', 'DE.20100913.22358.fits.gz')
    spec = KeckDEIMOSSpectrograph()
    spec.get_grating(f)
    assert numpy.isclose(spec.grating.central_wave,
                         8500.0078125), 'Incorrect grating setup'
    # Get the chip and pixel coordinates (1-indexed!) at the central
    # wavelength
    ximg, yimg, ccd, xpix, ypix = spec.mask_to_pixel_coordinates(x=-127.15775,
                                                                 y=20.0565)
    assert ccd == 6, 'Incorrect chip selected'
    assert numpy.isclose(xpix, 528.54329982), 'Incorrect x coordinate'
    assert numpy.isclose(ypix, 487.64455754), 'Incorrect y coordinate'
コード例 #2
0
ファイル: test_opticalmodel.py プロジェクト: tbowers7/PypeIt
def test_deimos_ccd_slits():
    f = os.path.join(os.environ['PYPEIT_DEV'], 'RAW_DATA', 'keck_deimos', '830G_M_8500',
                     'DE.20100913.22358.fits.gz')
    spec = KeckDEIMOSSpectrograph()
    spec.get_grating(f)
    ximg, yimg, ccd, xpix, ypix = spec.mask_to_pixel_coordinates(filename=f,
                                                                 wave=spec.grating.central_wave)
    indx = ccd < 1
    assert numpy.sum(indx) == 4, 'Should find 4 slits that are off all CCDs at the central lambda'
    ccds_with_slits_at_cwl, n_per_ccd = numpy.unique(ccd, return_counts=True)
    assert len(set(numpy.arange(8)+1) - set(ccds_with_slits_at_cwl)) == 0, \
            'Should find slits on all CCDs'
    assert numpy.sum(n_per_ccd) == 106, 'Should return coordinates for all 106 slits'
    assert n_per_ccd[1] == 14, 'Incorrect number of slits on CCD 1'
コード例 #3
0
ファイル: test_opticalmodel.py プロジェクト: tbowers7/PypeIt
def test_deimos_mask_coordinates():
    f = os.path.join(os.environ['PYPEIT_DEV'], 'RAW_DATA', 'keck_deimos', '830G_M_8500',
                     'DE.20100913.22358.fits.gz')
    spec = KeckDEIMOSSpectrograph()
    spec.get_grating(f)
    spec.get_amapbmap(f)
    spec.get_slitmask(f)
    assert numpy.isclose(spec.grating.central_wave, 8500.0078125), 'Incorrect grating setup'
    # Get the chip and pixel coordinates (1-indexed!) at the central
    # wavelength
    ximg, yimg, ccd, xpix, ypix = spec.mask_to_pixel_coordinates(x=spec.slitmask.center[:, 0],
                                                                 y=spec.slitmask.center[:, 1],
                                                                 wave=spec.grating.central_wave)
    assert ccd[0] == 6, 'Incorrect chip selected'
    assert numpy.isclose(xpix[0], 604.5558558898638), 'Incorrect x coordinate'
    assert numpy.isclose(ypix[0], 362.1307486284081), 'Incorrect y coordinate'
コード例 #4
0
ファイル: test_slitmask.py プロジェクト: Tuo-Ji/PypeIt
def test_assign_maskinfo():

    # Spectrograph
    keck_deimos = KeckDEIMOSSpectrograph()
    par = keck_deimos.default_pypeit_par()
    # working only on detector 3
    det = 3

    # Built trace image
    traceImage = buildimage.buildimage_fromlist(
        keck_deimos, det, par['calibrations']['traceframe'],
        deimos_flat_files())
    msbpm = keck_deimos.bpm(traceImage.files[0], det)

    # load specific config parameters
    par = keck_deimos.config_specific_par(traceImage.files[0])
    trace_par = par['calibrations']['slitedges']

    # Run edge trace
    edges = edgetrace.EdgeTraceSet(traceImage,
                                   keck_deimos,
                                   trace_par,
                                   bpm=msbpm,
                                   auto=True,
                                   debug=False,
                                   show_stages=False,
                                   qa_path=None)

    slits = edges.get_slits()

    # Test that the maskfile is saved properly
    hdul = fits.open(slits.maskfile)
    det_par = keck_deimos.get_detector_par(hdul, det=det)

    specobjs_file = os.path.join(
        os.getenv('PYPEIT_DEV'), 'Cooked', 'Science',
        'spec1d_DE.20100913.22358-CFHQS1_DEIMOS_2010Sep13T061231.334.fits')
    # specobjs_file = os.path.join(os.getenv('PYPEIT_DEV'), 'REDUX_OUT', 'keck_deimos',
    #                              '830G_M_8500', 'Science',
    #                              'spec1d_DE.20100913.22358-CFHQS1_DEIMOS_2010Sep13T061231.334.fits')
    sobjs = specobjs.SpecObjs.from_fitsfile(specobjs_file)
    # Init at null
    for sobj in sobjs:
        sobj.MASKDEF_OBJNAME = None
        sobj.RA = None
        sobj.DEC = None

    # Run me
    slits.assign_maskinfo(sobjs, det_par['platescale'])

    # Test
    assert sobjs[sobjs.SLITID ==
                 496].MASKDEF_OBJNAME == 'ero89', 'Wrong MASKDEF_OBJNAME'
    assert sobjs[sobjs.SLITID == 496].RA == 352.27471667, 'Wrong object RA'
    assert sobjs[sobjs.SLITID == 496].DEC == -3.09223056, 'Wrong object DEC'

    # Write sobjs
    sobjs.write_to_fits({}, data_path('tst_sobjs.fits'))
    os.remove(data_path('tst_sobjs.fits'))
コード例 #5
0
def test_deimosslitmask():
    f = os.path.join(os.environ['PYPEIT_DEV'], 'RAW_DATA', 'keck_deimos', '830G_M_8500',
                     'DE.20100913.22358.fits.gz')
    spec = KeckDEIMOSSpectrograph()
    spec.get_slitmask(f)
    assert spec.slitmask.nslits == 106, 'Incorrect number of slits read!'