Exemple #1
0
def test_exptime():
    exptime = np.array([0, 30, None, 900])
    assert np.array_equal(framematch.check_frame_exptime(exptime, [0, None]),
                          np.array([False, True, False, True]))
    assert np.array_equal(
        framematch.check_frame_exptime(exptime, [None, 1000]),
        np.array([True, True, False, True]))
    assert np.array_equal(
        framematch.check_frame_exptime(exptime, [None, None]),
        np.array([True, True, False, True]))
    assert np.array_equal(framematch.check_frame_exptime(exptime, [None, 500]),
                          np.array([True, True, False, False]))
    assert np.array_equal(framematch.check_frame_exptime(exptime, [10, 20]),
                          np.array([False, False, False, False]))
Exemple #2
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        # TODO: Allow for 'sky' frame type, for now include sky in
        # 'science' category
        if ftype == 'science':
            return good_exp & (fitstbl['idname'] == 'Object')
        if ftype == 'standard':
            return good_exp & ((fitstbl['idname'] == 'Std') |
                               (fitstbl['idname'] == 'Object'))
        if ftype == 'bias':
            return good_exp & (fitstbl['idname'] == 'Bias')
        if ftype == 'dark':
            return good_exp & (fitstbl['idname'] == 'Dark')
        if ftype in ['pixelflat', 'trace']:
            # Flats and trace frames are typed together
            return good_exp & ((fitstbl['idname'] == 'Flat') |
                               (fitstbl['idname'] == 'IntFlat'))
        if ftype in ['arc', 'tilt']:
            return good_exp & (fitstbl['idname'] == 'Line')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #3
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype == 'science':
            return good_exp & self.lamps(fitstbl, 'off') & (
                fitstbl['hatch'] == '1')  #hatch=1,0=open,closed
        if ftype == 'bias':
            return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch']
                                                            == '0')
        if ftype in ['pixelflat', 'illumflat', 'trace']:
            # Flats and trace frames are typed together
            return good_exp & self.lamps(fitstbl, 'dome_noarc') & (
                fitstbl['hatch'] == '0') & (fitstbl['idname'] == '6')
        if ftype in ['dark']:
            # Dark frames
            return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch']
                                                            == '0')
        if ftype in ['align']:
            # Alignment frames
            return good_exp & self.lamps(fitstbl, 'dome') & (
                fitstbl['hatch'] == '0') & (fitstbl['idname'] == '4')
        if ftype in ['arc', 'tilt']:
            return good_exp & self.lamps(fitstbl, 'arcs') & (fitstbl['hatch']
                                                             == '0')
        if ftype in ['pinhole']:
            # Don't type pinhole frames
            return np.zeros(len(fitstbl), dtype=bool)

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #4
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype == 'science':
            #return good_exp & (fitstbl['lampstat01'] == 'Off') & (fitstbl['hatch'] == 'open')
            return good_exp & (fitstbl['lampstat01']
                               == 'Off') & (fitstbl['hatch'] == 'open')
        if ftype == 'bias':
            return good_exp & (fitstbl['lampstat01']
                               == 'Off') & (fitstbl['hatch'] == 'closed')
        if ftype in ['pixelflat', 'trace']:
            # Flats and trace frames are typed together
            return good_exp & (fitstbl['idname']
                               == 'IntFlat') & (fitstbl['hatch'] == 'closed')
        if ftype in ['pinhole', 'dark']:
            # Don't type pinhole or dark frames
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype in ['arc', 'tilt']:
            return good_exp & (fitstbl['idname'] == 'Line') & (fitstbl['hatch']
                                                               == 'closed')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
 def check_frame_type(self, ftype, fitstbl, exprng=None):
     """
     Check for frames of the provided type.
     """
     good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
     if ftype in ['science', 'standard']:
         return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch'] == 0) \
                     & (fitstbl['idname'] == 'object')
     if ftype in ['bias', 'dark']:
         return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch'] == 0) \
                     & (fitstbl['idname'] == 'dark')
     if ftype in ['pixelflat', 'trace']:
         # Flats and trace frames are typed together
         return good_exp & self.lamps(fitstbl, 'dome') & (fitstbl['hatch'] == 1) \
                     & (fitstbl['idname'] == 'flatlamp')
     if ftype == 'pinhole':
         # Don't type pinhole frames
         return np.zeros(len(fitstbl), dtype=bool)
     if ftype == 'arc':
         # TODO: This is a kludge.  Allow science frames to also be
         # classified as arcs
         is_arc = self.lamps(fitstbl, 'arcs') & (fitstbl['hatch'] == 1) \
                         & (fitstbl['idname'] == 'arclamp')
         is_obj = self.lamps(fitstbl, 'off') & (fitstbl['hatch'] == 0) \
                     & (fitstbl['idname'] == 'object')
         return good_exp & (is_arc | is_obj)
     msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
     return np.zeros(len(fitstbl), dtype=bool)
Exemple #6
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype in ['science', 'standard']:
            return good_exp & self.lamps(fitstbl, 'off')


#            \
#                        & np.array([ t not in ['Arcs', 'Bias', 'Dome Flat']
#                                        for t in fitstbl['target']])
        if ftype == 'bias':
            return good_exp  # & (fitstbl['target'] == 'Bias')
        if ftype in ['pixelflat', 'trace', 'illumflat']:
            # Flats and trace frames are typed together
            return good_exp & self.lamps(
                fitstbl, 'dome')  # & (fitstbl['target'] == 'Dome Flat')
        if ftype in ['pinhole', 'dark']:
            # Don't type pinhole or dark frames
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype in ['arc', 'tilt']:
            return good_exp & self.lamps(
                fitstbl, 'arcs')  #  & (fitstbl['target'] == 'Arcs')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #7
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        # TODO: Allow for 'sky' frame type, for now include sky in
        # 'science' category
        if ftype == 'science':
            return good_exp & ((fitstbl['idname'] == 'SCIENCE')
                               | (fitstbl['target'] == 'STD,TELLURIC')
                               | (fitstbl['target'] == 'STD,SKY'))
        if ftype == 'standard':
            return good_exp & (fitstbl['target'] == 'STD,FLUX')
        if ftype == 'bias':
            return good_exp & (fitstbl['target'] == 'BIAS')
        if ftype == 'dark':
            return good_exp & (fitstbl['target'] == 'DARK')
        if ftype in ['pixelflat', 'trace']:
            # Flats and trace frames are typed together
            return good_exp & ((fitstbl['target'] == 'LAMP,DFLAT')
                               | (fitstbl['target'] == 'LAMP,QFLAT')
                               | (fitstbl['target'] == 'LAMP,FLAT'))
        if ftype == 'pinhole':
            # Don't type pinhole
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype in ['arc', 'tilt']:
            return good_exp & (fitstbl['target'] == 'LAMP,WAVE')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #8
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.

        Args:
            ftype (:obj:`str`):
                Type of frame to check. Must be a valid frame type; see
                frame-type :ref:`frame_type_defs`.
            fitstbl (`astropy.table.Table`_):
                The table with the metadata for one or more frames to check.
            exprng (:obj:`list`, optional):
                Range in the allowed exposure time for a frame of type
                ``ftype``. See
                :func:`pypeit.core.framematch.check_frame_exptime`.

        Returns:
            `numpy.ndarray`_: Boolean array with the flags selecting the
            exposures in ``fitstbl`` that are ``ftype`` type frames.
        """
        if ftype in ['pinhole', 'dark']:
            # No pinhole or bias or dark frames
            return np.zeros(len(fitstbl), dtype=bool)
        elif ftype in ['bias']:
            return fitstbl['idname'] == 'Bias'
        elif ftype in ['pixelflat', 'trace']:
            return fitstbl['idname'] == 'Flat'
        elif ftype in ['arc']:
            return fitstbl['idname'] == 'ThAr-Lamp'
        else:
            return (fitstbl['idname'] == 'Object') \
                        & framematch.check_frame_exptime(fitstbl['exptime'], exprng)
Exemple #9
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype == 'science':
            return good_exp & (fitstbl['idname'] == 'Object') & (fitstbl['lampstat01'] == 'Off') \
                        & (fitstbl['hatch'] == 'open')
        if ftype == 'bias':
            return good_exp & (fitstbl['idname'] == 'Bias') & (fitstbl['lampstat01'] == 'Off') \
                        & (fitstbl['hatch'] == 'closed')
        if ftype in ['pixelflat', 'trace', 'illumflat']:
            # Flats and trace frames are typed together
            is_flat = np.any(np.vstack(((fitstbl['idname'] == n) & (fitstbl['hatch'] == h)
                                    for n,h in zip(['IntFlat', 'DmFlat', 'SkyFlat'],
                                                   ['closed', 'open', 'open']))), axis=0)
            return good_exp & is_flat
        if ftype == 'pinhole':
            # Pinhole frames are never assigned for DEIMOS
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype == 'dark':
            return good_exp & (fitstbl['idname'] == 'Dark') & (fitstbl['lampstat01'] == 'Off') \
                        & (fitstbl['hatch'] == 'closed')
        if ftype in ['arc', 'tilt']:
            return good_exp & (fitstbl['idname'] == 'Line') & (fitstbl['hatch'] == 'closed')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #10
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        # ATTENTION: Standards have to be added manually for LUCI because
        # there is not unique flag that allows to distinguish between targets
        # and standards
        if ftype in ['science']:
            return good_exp & (fitstbl['idname'] == 'object')
        if ftype in ['standard']:
            return good_exp & (fitstbl['idname'] == 'standard')
        if ftype == 'bias':
            # for NIR data we type off lamp flats as biases
            return good_exp & (fitstbl['idname'] == 'flat_off')
        if ftype in ['pixelflat', 'trace']:
            # Flats and trace frames are typed together
            return good_exp & (fitstbl['idname'] == 'flat')
        if ftype in ['dark']:
            # NOT Typing dark frames
            # return np.zeros(len(fitstbl), dtype=bool)
            # for testing dark typing uncommen the following line and comment
            # out the previous line
            return good_exp & (fitstbl['idname'] == 'dark')
        if ftype in ['arc', 'tilt']:
            return (good_exp & ((fitstbl['idname'] == 'object') |
                                (fitstbl['idname'] == 'arc')))

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #11
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.

        Args:
            ftype (:obj:`str`):
                Type of frame to check. Must be a valid frame type; see
                frame-type :ref:`frame_type_defs`.
            fitstbl (`astropy.table.Table`_):
                The table with the metadata for one or more frames to check.
            exprng (:obj:`list`, optional):
                Range in the allowed exposure time for a frame of type
                ``ftype``. See
                :func:`pypeit.core.framematch.check_frame_exptime`.

        Returns:
            `numpy.ndarray`_: Boolean array with the flags selecting the
            exposures in ``fitstbl`` that are ``ftype`` type frames.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype in ['science', 'standard']:
            return good_exp & (fitstbl['lampstat01']
                               == '0000000') & (fitstbl['idname'] == 'object')
        if ftype == 'bias':
            return good_exp & (fitstbl['idname'] == 'bias')
        if ftype in ['pixelflat', 'trace', 'illumflat']:
            return good_exp & (fitstbl['idname'] == 'flat')
        if ftype in ['pinhole', 'dark']:
            # Don't type pinhole or dark frames
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype in ['arc', 'tilt']:
            return good_exp & (fitstbl['lampstat01'] !=
                               '0000000') & (fitstbl['idname'] == 'cal')
        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #12
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.

        Args:
            ftype (:obj:`str`):
                Type of frame to check. Must be a valid frame type; see
                frame-type :ref:`frame_type_defs`.
            fitstbl (`astropy.table.Table`_):
                The table with the metadata for one or more frames to check.
            exprng (:obj:`list`, optional):
                Range in the allowed exposure time for a frame of type
                ``ftype``. See
                :func:`pypeit.core.framematch.check_frame_exptime`.

        Returns:
            `numpy.ndarray`_: Boolean array with the flags selecting the
            exposures in ``fitstbl`` that are ``ftype`` type frames.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        # hatch=1,0=open,closed
        if ftype == 'science':
            return good_exp & (fitstbl['idname'] == 'OBJECT') & (fitstbl['calpos'] == 'Sky') \
                    & self.lamps(fitstbl, 'off') & (fitstbl['hatch'] == '1')
        if ftype == 'bias':
            return good_exp & (fitstbl['idname'] == 'BIAS')
        if ftype == 'pixelflat':
            # Use internal lamp
            return good_exp & (fitstbl['idname'] == 'FLATLAMP') & (fitstbl['calpos'] == 'Mirror') \
                    & self.lamps(fitstbl, 'cont_noarc') & (fitstbl['hatch'] == '0')
        if ftype in ['illumflat', 'trace']:
            # Use dome flats
            return good_exp & (fitstbl['idname'] == 'DOMEFLAT') & (fitstbl['calpos'] == 'Sky') \
                    & self.lamps(fitstbl, 'dome_noarc') & (fitstbl['hatch'] == '1')
        if ftype == 'dark':
            # Dark frames
            return good_exp & (fitstbl['idname'] == 'DARK') & self.lamps(fitstbl, 'off') \
                    & (fitstbl['hatch'] == '0')
        if ftype == 'align':
            # Alignment frames
            # NOTE: Different from previous versions, this now only warns the user if everyth
            is_align = good_exp & (fitstbl['idname'] == 'CONTBARS') \
                        & (fitstbl['calpos'] == 'Mirror') & self.lamps(fitstbl, 'cont') \
                        & (fitstbl['hatch'] == '0')
            if np.any(is_align
                      & np.logical_not(self.lamps(fitstbl, 'cont_noarc'))):
                msgs.warn(
                    'Alignment frames have both the continuum and arc lamps on (although '
                    'arc-lamp shutter might be closed)!')
            return is_align
        if ftype in ['arc', 'tilt']:
            return good_exp & (fitstbl['idname'] == 'ARCLAMP') & (fitstbl['calpos'] == 'Mirror') \
                    & self.lamps(fitstbl, 'arcs') & (fitstbl['hatch'] == '0')
        if ftype == 'pinhole':
            # Don't type pinhole frames
            return np.zeros(len(fitstbl), dtype=bool)

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #13
0
 def check_frame_type(self, ftype, fitstbl, exprng=None):
     """
     Check for frames of the provided type.
     """
     good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
     if ftype == 'science':
         return good_exp & (fitstbl['lampstat01']
                            == 'Off') & (fitstbl['hatch'] == 'open')
Exemple #14
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.

        Args:
            ftype (:obj:`str`):
                Type of frame to check. Must be a valid frame type; see
                frame-type :ref:`frame_type_defs`.
            fitstbl (`astropy.table.Table`_):
                The table with the metadata for one or more frames to check.
            exprng (:obj:`list`, optional):
                Range in the allowed exposure time for a frame of type
                ``ftype``. See
                :func:`pypeit.core.framematch.check_frame_exptime`.

        Returns:
            `numpy.ndarray`_: Boolean array with the flags selecting the
            exposures in ``fitstbl`` that are ``ftype`` type frames.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype == 'bias':
            return fitstbl['idname'] == 'BIAS'
        if ftype in ['arc', 'tilt']:
            # FOCUS frames should have frametype None, BIAS is bias regardless of lamp status
            return (good_exp
                    & (fitstbl['lampstat01'] != 'off')
                    & (fitstbl['idname'] != 'FOCUS')
                    & (fitstbl['idname'] != 'BIAS'))
        if ftype in ['trace', 'pixelflat']:
            return (good_exp
                    & (fitstbl['idname'] == 'DOME FLAT')
                    & (fitstbl['lampstat01'] == 'off'))
        if ftype in ['illumflat', 'sky']:
            return (good_exp
                    & (fitstbl['idname'] == 'SKY FLAT')
                    & (fitstbl['lampstat01'] == 'off'))
        if ftype == 'science':
            # Both OBJECT and STANDARD frames should be processed as science frames
            return (good_exp
                    & ((fitstbl['idname'] == 'OBJECT') |
                       (fitstbl['idname'] == 'STANDARD'))
                    & (fitstbl['lampstat01'] == 'off'))
        if ftype == 'standard':
            return (good_exp
                    & (fitstbl['idname'] == 'STANDARD')
                    & (fitstbl['lampstat01'] == 'off'))
        if ftype == 'dark':
            return (good_exp
                    & (fitstbl['idname'] == 'DARK')
                    & (fitstbl['lampstat01'] == 'off'))
        if ftype in ['pinhole', 'align']:
            # Don't types pinhole or align frames
            return np.zeros(len(fitstbl), dtype=bool)
        msgs.warn(f"Cannot determine if frames are of type {ftype}")
        return np.zeros(len(fitstbl), dtype=bool)
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        if ftype in ['pinhole', 'bias']:
            # No pinhole or bias frames
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype in ['pixelflat', 'trace']:
            return fitstbl['idname'] == 'domeflat'

        return (fitstbl['idname'] == 'object') \
                        & framematch.check_frame_exptime(fitstbl['exptime'], exprng)
Exemple #16
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.

        Args:
            ftype (:obj:`str`):
                Type of frame to check. Must be a valid frame type; see
                frame-type :ref:`frame_type_defs`.
            fitstbl (`astropy.table.Table`_):
                The table with the metadata for one or more frames to check.
            exprng (:obj:`list`, optional):
                Range in the allowed exposure time for a frame of type
                ``ftype``. See
                :func:`pypeit.core.framematch.check_frame_exptime`.

        Returns:
            `numpy.ndarray`_: Boolean array with the flags selecting the
            exposures in ``fitstbl`` that are ``ftype`` type frames.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype in ['science']:
            science = []
            for obj in fitstbl['idname'].tolist():
                science.append(not (("Dome Flat" in obj) or (
                    "STANDARD" in obj) or ("HIP05" in obj) or ("HZ" in obj) or
                                    ("G191" in obj) or ("PG0220" in obj)))
            return good_exp & (fitstbl['lampstat01'] == 'off') & science
        if ftype in ['standard']:
            standard = []
            for obj in fitstbl['idname'].tolist():
                standard.append(("STANDARD" in obj) or ("HIP05" in obj)
                                or ("HZ" in obj) or ("G191" in obj)
                                or ("PG0220" in obj))
            return good_exp & (fitstbl['lampstat01'] == 'off') & (
                fitstbl['idname'] != 'Dome Flat') & standard
        if ftype == 'bias':
            bias = []
            for obj in fitstbl['idname'].tolist():
                bias.append(("BIAS" in obj) or ("Bias" in obj))
            return good_exp & (fitstbl['lampstat01'] == 'off') & bias
        if ftype in ['pixelflat', 'trace']:
            flat = []
            for obj in fitstbl['idname'].tolist():
                flat.append(("Dome Flat" in obj))
            return good_exp & (fitstbl['lampstat01'] == 'off') & flat
        if ftype in ['pinhole', 'dark']:
            # Don't type pinhole or dark frames
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype in ['arc', 'tilt']:
            return good_exp & (fitstbl['lampstat01'] != 'off')
        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #17
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.

        Args:
            ftype (:obj:`str`):
                Type of frame to check. Must be a valid frame type; see
                frame-type :ref:`frame_type_defs`.
            fitstbl (`astropy.table.Table`_):
                The table with the metadata for one or more frames to check.
            exprng (:obj:`list`, optional):
                Range in the allowed exposure time for a frame of type
                ``ftype``. See
                :func:`pypeit.core.framematch.check_frame_exptime`.

        Returns:
            `numpy.ndarray`_: Boolean array with the flags selecting the
            exposures in ``fitstbl`` that are ``ftype`` type frames.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        # TODO: Allow for 'sky' frame type, for now include sky in
        # 'science' category
        if ftype == 'science':
            return good_exp & ((fitstbl['idname'] == 'SINFONI_IFS_OBS')
                               | (fitstbl['target'] == 'STD,TELLURIC')
                               | (fitstbl['target'] == 'SKY,STD'))
        if ftype == 'standard':
            return good_exp & ((fitstbl['target'] == 'STD') |
                               (fitstbl['target'] == 'SKY,STD'))
        #if ftype == 'bias':
        #    return good_exp & (fitstbl['target'] == 'BIAS')
        if ftype == 'dark':
            return good_exp & (fitstbl['target'] == 'DARK')
        if ftype in ['pixelflat', 'trace']:
            # Flats and trace frames are typed together
            return good_exp & (fitstbl['target'] == 'FLAT,LAMP')
        #if ftype == 'pinhole':
        #    # Don't type pinhole
        #    return np.zeros(len(fitstbl), dtype=bool)
        if ftype in ['arc', 'tilt']:
            return good_exp & ((fitstbl['target'] == 'WAVE,LAMP') |
                               (fitstbl['idname'] == 'SINFONI_IFS_OBS') |
                               (fitstbl['idname'] == 'SINFONI_IFS_SKY'))
        # Putting this in now in anticipation of the sky class
        if ftype in ['sky']:
            return good_exp & (fitstbl['idname'] == 'SINFONI_IFS_SKY')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
 def check_frame_type(self, ftype, fitstbl, exprng=None):
     """
     Check for frames of the provided type.
     """
     if ftype in ['pinhole', 'dark']:
         # No pinhole or bias or dark frames
         return np.zeros(len(fitstbl), dtype=bool)
     elif ftype in ['bias']:
         return fitstbl['idname'] == 'Bias'
     elif ftype in ['pixelflat', 'trace']:
         return fitstbl['idname'] == 'Flat'
     elif ftype in ['arc']:
         return fitstbl['idname'] == 'ThAr-Lamp'
     else:
         return (fitstbl['idname'] == 'Object') \
                     & framematch.check_frame_exptime(fitstbl['exptime'], exprng)
Exemple #19
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype == 'science':
            return good_exp & (fitstbl['lampstat01'] == 'off') & (fitstbl['lampstat02'] == 'stowed') & (fitstbl['exptime'] > 100.0)
        if ftype == 'standard':
            return good_exp & (fitstbl['lampstat01'] == 'off') & (fitstbl['lampstat02'] == 'stowed') & (fitstbl['exptime'] <= 100.0)
        if ftype in ['arc', 'tilt']:
            return good_exp & (fitstbl['lampstat01'] == 'on')
        if ftype in ['pixelflat', 'trace', 'illumflat']:
            return good_exp & (fitstbl['lampstat01'] == 'off') & (fitstbl['lampstat02'] == 'deployed')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #20
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.

        Args:
            ftype (:obj:`str`):
                Type of frame to check. Must be a valid frame type; see
                frame-type :ref:`frame_type_defs`.
            fitstbl (`astropy.table.Table`_):
                The table with the metadata for one or more frames to check.
            exprng (:obj:`list`, optional):
                Range in the allowed exposure time for a frame of type
                ``ftype``. See
                :func:`pypeit.core.framematch.check_frame_exptime`.

        Returns:
            `numpy.ndarray`_: Boolean array with the flags selecting the
            exposures in ``fitstbl`` that are ``ftype`` type frames.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype == 'science':
            return good_exp & self.lamps(fitstbl, 'off') & (
                fitstbl['hatch'] == '1')  #hatch=1,0=open,closed
        if ftype == 'bias':
            return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch']
                                                            == '0')
        if ftype in ['pixelflat', 'illumflat', 'trace']:
            # Flats and trace frames are typed together
            return good_exp & self.lamps(fitstbl, 'dome_noarc') & (
                fitstbl['hatch'] == '0') & (fitstbl['idname'] == '6')
        if ftype in ['dark']:
            # Dark frames
            return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch']
                                                            == '0')
        if ftype in ['align']:
            # Alignment frames
            return good_exp & self.lamps(fitstbl, 'dome') & (
                fitstbl['hatch'] == '0') & (fitstbl['idname'] == '4')
        if ftype in ['arc', 'tilt']:
            return good_exp & self.lamps(fitstbl, 'arcs') & (fitstbl['hatch']
                                                             == '0')
        if ftype in ['pinhole']:
            # Don't type pinhole frames
            return np.zeros(len(fitstbl), dtype=bool)

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #21
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype == 'science':
            return good_exp & (fitstbl['target'] != 'CuAr') & (fitstbl['target'] != 'GCALflat') & (fitstbl['target'] != 'Bias')
            #& (fitstbl['idname'] == 'OBJECT')
        if ftype in ['arc', 'tilt']:
            return good_exp & (fitstbl['target'] == 'CuAr')#& (fitstbl['idname'] == 'ARC')
        if ftype in ['pixelflat', 'trace']:
            return good_exp & (fitstbl['target'] == 'GCALflat')#& (fitstbl['idname'] == 'FLAT')
        if ftype == 'bias':
            return good_exp & (fitstbl['target'] == 'Bias')#& (fitstbl['idname'] == 'BIAS')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #22
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.

        Args:
            ftype (:obj:`str`):
                Type of frame to check. Must be a valid frame type; see
                frame-type :ref:`frame_type_defs`.
            fitstbl (`astropy.table.Table`_):
                The table with the metadata for one or more frames to check.
            exprng (:obj:`list`, optional):
                Range in the allowed exposure time for a frame of type
                ``ftype``. See
                :func:`pypeit.core.framematch.check_frame_exptime`.

        Returns:
            `numpy.ndarray`_: Boolean array with the flags selecting the
            exposures in ``fitstbl`` that are ``ftype`` type frames.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        # ATTENTION: Standards have to be added manually for LUCI because
        # there is not unique flag that allows to distinguish between targets
        # and standards
        if ftype in ['science']:
            return good_exp & (fitstbl['idname'] == 'object')
        if ftype in ['standard']:
            return good_exp & (fitstbl['idname'] == 'standard')
        if ftype == 'bias':
            # for NIR data we type off lamp flats as biases
            return good_exp & (fitstbl['idname'] == 'flat_off')
        if ftype in ['pixelflat', 'trace']:
            # Flats and trace frames are typed together
            return good_exp & (fitstbl['idname'] == 'flat')
        if ftype in ['dark']:
            # NOT Typing dark frames
            # return np.zeros(len(fitstbl), dtype=bool)
            # for testing dark typing uncommen the following line and comment
            # out the previous line
            return good_exp & (fitstbl['idname'] == 'dark')
        if ftype in ['arc', 'tilt']:
            return (good_exp & ((fitstbl['idname'] == 'object') |
                                (fitstbl['idname'] == 'arc')))

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #23
0
 def check_frame_type(self, ftype, fitstbl, exprng=None):
     """
     Check for frames of the provided type.
     """
     good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
     if ftype in ['science', 'standard']:
         return good_exp & (fitstbl['lampstat01'] == 'Off') & (fitstbl['idname'] == 'object')
     if ftype == 'bias':
         return good_exp & (fitstbl['idname'] == 'zero')
     if ftype in ['pixelflat', 'trace']:
         return good_exp & (fitstbl['lampstat01'] == 'W') & (fitstbl['idname'] == 'flat')
     if ftype in ['pinhole', 'dark']:
         # Don't type pinhole or dark frames
         return np.zeros(len(fitstbl), dtype=bool)
     if ftype in ['arc', 'tilt']:
         return good_exp & (fitstbl['lampstat01'] == 'CuNe+CuAr') & (fitstbl['idname'] == 'arc')
     msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
     return np.zeros(len(fitstbl), dtype=bool)
Exemple #24
0
 def check_frame_type(self, ftype, fitstbl, exprng=None):
     """
     Check for frames of the provided type.
     """
     good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
     if ftype in ['science', 'standard']:
         return good_exp & (fitstbl['idname'] == 'OBJECT')
     if ftype == 'bias':
         return good_exp & (fitstbl['idname'] == 'BIAS')
     if ftype in ['pixelflat', 'trace', 'illumflat']:
         return good_exp & (fitstbl['idname'] == 'FLAT,LAMP')
     if ftype in ['pinhole', 'dark']:
         # Don't type pinhole or dark frames
         return np.zeros(len(fitstbl), dtype=bool)
     if ftype in ['arc', 'tilt']:
         return good_exp & (fitstbl['idname'] == 'WAVE,LAMP')
     msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
     return np.zeros(len(fitstbl), dtype=bool)
 def check_frame_type(self, ftype, fitstbl, exprng=None):
     """
     Check for frames of the provided type.
     """
     good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
     if ftype in ['pinhole', 'bias']:
         # No pinhole or bias frames
         return np.zeros(len(fitstbl), dtype=bool)
     if ftype in ['pixelflat', 'trace']:
         return good_exp & (fitstbl['idname'] == 'PixFlat')
     if ftype == 'standard':
         return good_exp & (fitstbl['idname'] == 'Telluric')
     if ftype == 'science':
         return good_exp & (fitstbl['idname'] == 'Science')
     if ftype in ['arc', 'tilt']:
         return good_exp & (fitstbl['idname'] == 'Science')
     msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
     return np.zeros(len(fitstbl), dtype=bool)
Exemple #26
0
 def check_frame_type(self, ftype, fitstbl, exprng=None):
     """
     Check for frames of the provided type.
     """
     good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
     if ftype in ['pinhole', 'bias']:
         # No pinhole or bias frames
         return np.zeros(len(fitstbl), dtype=bool)
     if ftype == 'standard':
         return good_exp & (fitstbl['idname'] == 'Object')
     if ftype == 'dark':
         return good_exp & (fitstbl['idname'] == 'dark')
     if ftype in ['pixelflat', 'trace']:
         return fitstbl['idname'] == 'domeflat'
     if ftype in 'science':
         return good_exp & (fitstbl['idname'] == 'Object')
     if ftype in ['arc', 'tilt']:
         return good_exp & (fitstbl['idname'] == 'Object')
     return np.zeros(len(fitstbl), dtype=bool)
Exemple #27
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.

        Args:
            ftype (:obj:`str`):
                Type of frame to check. Must be a valid frame type; see
                frame-type :ref:`frame_type_defs`.
            fitstbl (`astropy.table.Table`_):
                The table with the metadata for one or more frames to check.
            exprng (:obj:`list`, optional):
                Range in the allowed exposure time for a frame of type
                ``ftype``. See
                :func:`pypeit.core.framematch.check_frame_exptime`.

        Returns:
            `numpy.ndarray`_: Boolean array with the flags selecting the
            exposures in ``fitstbl`` that are ``ftype`` type frames.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype in ['science', 'standard']:
            return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch'] == 0) \
                        & (fitstbl['idname'] == 'object')
        if ftype in ['bias', 'dark']:
            return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch'] == 0) \
                        & (fitstbl['idname'] == 'dark')
        if ftype in ['pixelflat', 'trace']:
            # Flats and trace frames are typed together
            return good_exp & self.lamps(fitstbl, 'dome') & (fitstbl['hatch'] == 1) \
                        & (fitstbl['idname'] == 'flatlamp')
        if ftype == 'pinhole':
            # Don't type pinhole frames
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype in ['arc', 'tilt']:
            # TODO: This is a kludge.  Allow science frames to also be
            # classified as arcs
            is_arc = self.lamps(fitstbl, 'arcs') & (fitstbl['hatch'] == 1) \
                            & (fitstbl['idname'] == 'arclamp')
            is_obj = self.lamps(fitstbl, 'off') & (fitstbl['hatch'] == 0) \
                        & (fitstbl['idname'] == 'object')
            return good_exp & (is_arc | is_obj)
        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #28
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype == 'science':
            return good_exp & (fitstbl['idname'] == 'OBJECT')
        if ftype == 'standard':
            return good_exp & (fitstbl['idname'] == 'OBJECT')
        if ftype == 'pixelflat' or ftype == 'trace':
            # Flats and trace frames are typed together
            return good_exp & (fitstbl['idname'] == 'FLAT')
        if ftype == 'pinhole' or ftype == 'dark' or ftype == 'bias':
            # Don't type pinhole, dark, or bias frames
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype == 'arc':
            return good_exp & (fitstbl['idname'] == 'ARC')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #29
0
    def check_frame_type(self, ftype, fitstbl, exprng=None):
        """
        Check for frames of the provided type.
        """
        good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
        if ftype == 'science':
            return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch'] == 'open')
        if ftype == 'bias':
            return good_exp & self.lamps(fitstbl, 'off') & (fitstbl['hatch'] == 'closed')
        if ftype == 'pixelflat' or ftype == 'trace':
            # Flats and trace frames are typed together
            return good_exp & self.lamps(fitstbl, 'dome') & (fitstbl['hatch'] == 'open')
        if ftype == 'pinhole' or ftype == 'dark':
            # Don't type pinhole or dark frames
            return np.zeros(len(fitstbl), dtype=bool)
        if ftype == 'arc':
            return good_exp & self.lamps(fitstbl, 'arcs') & (fitstbl['hatch'] == 'closed')

        msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
        return np.zeros(len(fitstbl), dtype=bool)
Exemple #30
0
 def check_frame_type(self, ftype, fitstbl, exprng=None):
     """
     Check for frames of the provided type.
     """
     good_exp = framematch.check_frame_exptime(fitstbl['exptime'], exprng)
     if ftype in ['science', 'standard']:
         return good_exp & (fitstbl['idname'] == 'OBJECT') & (fitstbl['lamps'] == 'Parking') \
                     & (fitstbl['dispname'] != 'OPEN')
     if ftype == 'bias':
         return good_exp & (fitstbl['dispname'] == 'OPEN')
     if ftype in ['pixelflat', 'trace']:
         return good_exp & (fitstbl['idname'] == 'CALIB') & (fitstbl['lamps'] == 'Halogen') \
                     & (fitstbl['dispname'] != 'OPEN')
     if ftype in ['pinhole', 'dark']:
         # Don't type pinhole or dark frames
         return np.zeros(len(fitstbl), dtype=bool)
     if ftype in ['arc', 'tilt']:
         return good_exp & (fitstbl['idname'] == 'arc') & (fitstbl['lamps'] == 'Ne+Hg') \
                     & (fitstbl['dispname'] != 'OPEN')
     msgs.warn('Cannot determine if frames are of type {0}.'.format(ftype))
     return np.zeros(len(fitstbl), dtype=bool)