Exemple #1
0
    def understand(image_file):
        try:
            tag = FormatHDF5.open_file(image_file, 'rb').read(8)
        except IOError:
            return False

        # check that this is a HDF5 file (should not have got here if not
        # anyway...)

        if tag != "\211HDF\r\n\032\n":
            return False

        import h5py
        h5_handle = h5py.File(image_file, 'r')

        try:
            desc = h5_handle['entry/instrument/detector/description']
        except KeyError:
            h5_handle.close()
            return False

        if 'Lambda' in desc.value[0]:
            h5_handle.close()
            return True

        return False
Exemple #2
0
    def understand(image_file):
        try:
            tag = FormatHDF5.open_file(image_file, "rb").read(8)
        except IOError:
            return False

        # check that this is a HDF5 file (should not have got here if not
        # anyway...)

        if tag != "\211HDF\r\n\032\n":
            return False

        with h5py.File(image_file, "r") as h5_handle:
            try:
                desc = h5_handle["entry/instrument/detector/description"]
            except KeyError:
                return False

            if "Lambda" in desc[()][0]:
                return True

        return False
 def understand(image_file):
   try:
     tag = FormatHDF5.open_file(image_file, 'rb').read(8)
   except IOError, e:
     return False