Beispiel #1
0
def test_instr_config():
    from pypit import arutils as arut
    from pypit import armlsd
    # Dummy self
    slf = arut.dummy_self()
    # Grab
    fits_dict = {'slitwid': [0.5], 'dichroic': ['d55'],
                 'disperser': ['B600/400'], 'cdangle': [11000.]}
    det, scidx = 1, 0
    #
    config = armlsd.instconfig(slf, det, scidx, fits_dict)
    # Test
    assert config == 'S05-D55-G600400-T110000-B11'
Beispiel #2
0
def init_exp(slf, scidx, det, fitsdict, trc_img=None, ypos=0.5, **kwargs):
    """Generate a list of SpecObjExp objects for a given exposure

    Parameters
    ----------
    self
       Instrument "setup" (min=10,max=99)
    scidx : int
       Index of file
    det : int
       Detector index 
    ypos : float, optional [0.5]
       Row on trimmed detector (fractional) to define slit (and object)
    """
    from pypit.armlsd import instconfig

    # Init
    specobjs = []
    config = instconfig(slf, det, scidx, fitsdict)
    yidx = int(np.round(ypos*slf._lordloc[det-1].shape[0]))
    pixl_slits = slf._lordloc[det-1][yidx, :]
    pixr_slits = slf._rordloc[det-1][yidx, :]
    #
    if trc_img['nobj'] != 0: # Object traces
        for qq in range(trc_img['traces'].shape[1]): # Loop on objects
            # Find the slit
            gds = np.where( (trc_img['traces'][yidx,qq]>pixl_slits) & 
                (trc_img['traces'][yidx,qq]<pixr_slits))[0]
            if len(gds) != 1:
                msgs.error('arspecobj.init_exp: Problem finding the slit')
            else:
                islit = gds[0]
                pixl_slit = pixl_slits[islit]
                pixr_slit = pixr_slits[islit]
                xl_slit = pixl_slit/trc_img['object'].shape[1]
                xr_slit = pixr_slit/trc_img['object'].shape[1]
            # xobj
            xobj = (trc_img['traces'][yidx,qq]-pixl_slit) / (pixr_slit-pixl_slit)
            # Generate 
            specobj = SpecObjExp((trc_img['object'].shape[:2]), config, scidx, det, (xl_slit,xr_slit),ypos, xobj, **kwargs)
            # Add traces
            specobj.trace = trc_img['traces'][:,qq]
            # Append
            specobjs.append(specobj)
    else:
        msgs.warn("No objects for specobjs")
    # Return
    return specobjs
Beispiel #3
0
def init_exp(slf, scidx, det, fitsdict, trc_img=None, ypos=0.5, **kwargs):
    """Generate a list of SpecObjExp objects for a given exposure

    Parameters
    ----------
    self
       Instrument "setup" (min=10,max=99)
    scidx : int
       Index of file
    det : int
       Detector index 
    ypos : float, optional [0.5]
       Row on trimmed detector (fractional) to define slit (and object)
    """
    from pypit.armlsd import instconfig

    # Init
    specobjs = []
    config = instconfig(slf, det, scidx, fitsdict)
    yidx = int(np.round(ypos*slf._lordloc[det-1].shape[0]))
    pixl_slits = slf._lordloc[det-1][yidx, :]
    pixr_slits = slf._rordloc[det-1][yidx, :]
    #
    if trc_img['nobj'] != 0: # Object traces
        for qq in xrange(trc_img['traces'].shape[1]): # Loop on objects
            # Find the slit
            gds = np.where( (trc_img['traces'][yidx,qq]>pixl_slits) & 
                (trc_img['traces'][yidx,qq]<pixr_slits))[0]
            if len(gds) != 1:
                msgs.error('arspecobj.init_exp: Problem finding the slit')
            else:
                islit = gds[0]
                pixl_slit = pixl_slits[islit]
                pixr_slit = pixr_slits[islit]
                xl_slit = pixl_slit/trc_img['object'].shape[1]
                xr_slit = pixr_slit/trc_img['object'].shape[1]
            # xobj
            xobj = (trc_img['traces'][yidx,qq]-pixl_slit) / (pixr_slit-pixl_slit)
            # Generate 
            specobj = SpecObjExp((trc_img['object'].shape[:2]), config, scidx, det, (xl_slit,xr_slit),ypos, xobj, **kwargs)
            # Add traces
            specobj.trace = trc_img['traces'][:,qq]
            # Append
            specobjs.append(specobj)
    else:
        msgs.warn("No objects for specobjs")
    # Return
    return specobjs
Beispiel #4
0
def test_instr_config():
    from pypit import arutils as arut
    from pypit import armlsd
    # Dummy self
    slf = arut.dummy_self()
    # Grab
    fits_dict = {
        'slitwid': [0.5],
        'dichroic': ['d55'],
        'disperser': ['B600/400'],
        'cdangle': [11000.]
    }
    det, scidx = 1, 0
    #
    config = armlsd.instconfig(slf, det, scidx, fits_dict)
    # Test
    assert config == 'S05-D55-G600400-T110000-B11'