コード例 #1
0
    def getInfo(self, filename):
        """Retrieve path, calib_hdu, and possibly calibDate.

        Parameters
        ----------
        filename: `str`
            Calibration file to inspect.

        Returns
        -------
        phuInfo : `dict`
            Primary header unit info.
        infoList : `list` of `dict`
            List of file properties to use for each extension.
        """
        phuInfo, infoList = CalibsParseTask.getInfo(self, filename)
        # In practice, this returns an empty dict
        # and a list containing an empty dict.
        for item in infoList:
            item['path'] = filename
            try:
                item['calib_hdu'] = item['hdu']
            except KeyError:  # calib_hdu is required for the calib registry
                item['calib_hdu'] = 1
        # Try to fetch a date from filename
        # and use as the calibration dates if not already set
        found = re.search(r'(\d\d\d\d-\d\d-\d\d)', filename)
        if found:
            date = found.group(1)
            for info in infoList:
                if 'calibDate' not in info or info['calibDate'] == "unknown":
                    info['calibDate'] = date
        return phuInfo, infoList
コード例 #2
0
    def getInfo(self, filename):
        """Get information about the image from the filename and/or its contents

        @param filename: Name of file to inspect
        @return File properties; list of file properties for each extension
        """
        phuInfo, infoList = CalibsParseTask.getInfo(self, filename)
        # Single-extension fits without EXTNAME can be a valid CP calibration product
        # Use info of primary header unit
        if not infoList:
            infoList.append(phuInfo)
        return phuInfo, infoList
コード例 #3
0
    def getInfo(self, filename):
        """Get information about the image from the filename and/or its contents

        @param filename: Name of file to inspect
        @return File properties; list of file properties for each extension
        """
        phuInfo, infoList = CalibsParseTask.getInfo(self, filename)
        # Single-extension fits without EXTNAME can be a valid CP calibration product
        # Use info of primary header unit
        if not infoList:
            infoList.append(phuInfo)
        for info in infoList:
            info['path'] = filename
        # Try to fetch a date from filename
        # and use as the calibration dates if not already set
        found = re.search('(\d\d\d\d-\d\d-\d\d)', filename)
        if not found:
            return phuInfo, infoList
        date = found.group(1)
        for info in infoList:
            if 'calibDate' not in info or info['calibDate'] == "unknown":
                info['calibDate'] = date
        return phuInfo, infoList
コード例 #4
0
    def getInfo(self, filename):
        """Get information about the image from the filename and/or its contents

        @param filename: Name of file to inspect
        @return File properties; list of file properties for each extension
        """
        phuInfo, infoList = CalibsParseTask.getInfo(self, filename)
        # Single-extension fits without EXTNAME can be a valid CP calibration product
        # Use info of primary header unit
        if not infoList:
            infoList.append(phuInfo)
        for info in infoList:
            info['path'] = filename
        # Try to fetch a date from filename
        # and use as the calibration dates if not already set
        found = re.search('(\d\d\d\d-\d\d-\d\d)', filename)
        if not found:
            return phuInfo, infoList
        date = found.group(1)
        for info in infoList:
            if 'calibDate' not in info or info['calibDate'] == "unknown":
                info['calibDate'] = date
        return phuInfo, infoList
コード例 #5
0
    def getInfo(self, filename):
        """Get information about the image from the filename and/or its contents.

        Parameters
        ----------
        filename: `str`
            Name of file to inspect.

        Returns
        -------
        phuInfo : `dict`
            Primary header unit info.
        infoList : `list` of `dict`
            File properties; list of file properties for each extension.
        """
        phuInfo, infoList = CalibsParseTask.getInfo(self, filename)
        # Single-extension fits without EXTNAME can be a valid CP calibration product
        # Use info of primary header unit
        if not infoList:
            infoList.append(phuInfo)
        for info in infoList:
            info['path'] = filename
        # Try to fetch a date from filename
        # and use as the calibration dates if not already set
        found = re.search(r'(\d\d\d\d-\d\d-\d\d)', filename)
        for item in infoList:
            try:
                item['calib_hdu'] = item['hdu']
            except KeyError:  # workaround for pre- DM-19730 defect ingestion
                item['calib_hdu'] = 1
        if not found:
            return phuInfo, infoList
        date = found.group(1)
        for info in infoList:
            if 'calibDate' not in info or info['calibDate'] == "unknown":
                info['calibDate'] = date
        return phuInfo, infoList