Example #1
0
def func_tdecdeg(filename, hdulist=None, whichhdu=None):
    """ return the fits header value TELDEC in degrees """

    hdulist2 = None
    if hdulist is None:
        hdulist2 = pyfits.open(filename, 'readonly')
    else:
        hdulist2 = hdulist

    teldec = fitsutils.get_hdr_value(hdulist, 'TELDEC')

    if hdulist is None:
        hdulist2.close()

    return spmeta.convert_dec_to_deg(teldec)
Example #2
0
def func_tdecdeg(filename, hdulist=None):
    """ Get the fits header value 'TELDEC' in degrees

        Parameters
        ----------
        filename : str
            The file to get the filter keyword from (must be a fits file),
            only used if hdulist is ``None``.

        hdulist : astropy.io.fits.HDUList, optional
            A listing of the HDUs to search for the requested HDU,
            default is ``None``, in which case `filename` is opened and used.

        whichhdu : various, optional
            The HDU being searched for, this can be an int for the HDU index,
            a string for the HDU name, or ``None`` in which case the primary
            HDU is used. The default is ``None``.

        Returns
        -------
        float
            The value of TELDEC in decimal degrees.

    """

    hdulist2 = None
    if hdulist is None:
        hdulist2 = fits.open(filename, 'readonly')
    else:
        hdulist2 = hdulist

    teldec = fitsutils.get_hdr_value(hdulist, 'TELDEC')

    if hdulist is None:
        hdulist2.close()

    return spmeta.convert_dec_to_deg(teldec)