Esempio n. 1
0
    def load_LEED_Images(self):
        """
        Load LEED data from image files
        Supported formats are TIFF, PNG, JPG
        emit the 3d data array as a custom SIGNAL to be retrieved in gui.py
        """
        if ('path' not in self.params.keys() or
            'ext' not in self.params.keys()):
            print('Terminating - ERROR: incorrect parameters for LOAD task')
            print('Required Parameters: path, ext')
        print('Loading LEED Data from Images via QThread ...')

        """
        if 'byte' in self.params.keys():
            if self.params['byte'] == 'L':
                swap = False
            elif self.params['byte'] == 'B':
                print("Byte order set as Big-Endian - swapping order when plotting data ...")
                swap = True
            else:
                swap = False
                print("Error reading byte order from experimental config ...")
        """
        data = LF.get_img_array(self.params['path'], ext=self.params['ext'], swap=False)
        if data is None:
            self.quit()
            self.exit()
        else:
            self.emit(QtCore.SIGNAL('output(PyQt_PyObject)'), data)
Esempio n. 2
0
    def load_LEED_TIFF(self, dirname):
        """
        Load LEED data from TIFF files into 3d numpy array
        This is the slowest data loading method
        There is much overhead in processing tiff image files
        This function should only be called from load_LEED_Data()

        :param dirname: path to directory containing tiff files
        :return: 3d numpy array where 3rd axis corresponds to Energy via self.elist
        """
        # maybe not needed
        prev_dir = self.data_dir

        return np.array(LF.get_img_array(dirname, ext='.tif'))
Esempio n. 3
0
    def load_LEED_PNG(self, dirname):
        """
        Load LEED-I(V) image files into numpy array
        This function uses PIL to parse the png files
        This is slower than loading raw binary data due to the overhead in parsing
        image files, however, it is faster than loading TIFF files

        :param dirname: path to directory containing png files
        :return: 3d numpy array
        """
        # maybe not needed
        prev_dir = self.data_dir

        return np.array(LF.get_img_array(dirname, ext='.png'))
Esempio n. 4
0
    def load_LEED_TIFF(self, dirname):
        """
        Load LEED data from TIFF files into 3d numpy array
        This is the slowest data loading method
        There is much overhead in processing tiff image files
        This function should only be called from load_LEED_Data()

        :param dirname: path to directory containing tiff files
        :return: 3d numpy array where 3rd axis corresponds to Energy via self.elist
        """
        # maybe not needed
        prev_dir = self.data_dir

        return np.array(LF.get_img_array(dirname, ext='.tif'))
Esempio n. 5
0
    def load_LEED_PNG(self, dirname):
        """
        Load LEED-I(V) image files into numpy array
        This function uses PIL to parse the png files
        This is slower than loading raw binary data due to the overhead in parsing
        image files, however, it is faster than loading TIFF files

        :param dirname: path to directory containing png files
        :return: 3d numpy array
        """
        # maybe not needed
        prev_dir = self.data_dir

        return np.array(LF.get_img_array(dirname, ext='.png'))
Esempio n. 6
0
    def load_LEED_Images(self):
        """Load LEED data from image files.

        Supported formats are TIFF, PNG, JPG
        Emit the 3d data array as a custom SIGNAL to be retrieved in please.py
        """
        if ('path' not in self.params.keys()
                or ('ext' not in self.params.keys())):
            print('Terminating - ERROR: incorrect parameters for LOAD task')
            print('Required Parameters: path, ext')
        print('Loading LEED Data from Images via QThread ...')
        """
        if 'byte' in self.params.keys():
            if self.params['byte'] == 'L':
                swap = False
            elif self.params['byte'] == 'B':
                print("Byte order set as Big-Endian - swapping order when plotting data ...")
                swap = True
            else:
                swap = False
                print("Error reading byte order from experimental config ...")
        """
        data = None
        try:
            data = LF.get_img_array(self.params['path'],
                                    ext=self.params['ext'],
                                    swap=False)
        except IOError as e:
            print("Error Loading LEED Images:")
            print(e)
            print(
                "LEED image files not found in directory specified in YAML experiment config file."
            )
            print(
                "Please re-check the settings in your YAML experiment config file."
            )
            print(
                "Ensure that the path setting points to the correct directory."
            )
            return
        if data is None:
            self.quit()
            self.exit()
        else:
            self.outputSIGNAL.emit(data)  # type: np.ndarray
Esempio n. 7
0
    def load_LEEM_Images(self):
        """
        """
        if ('path' not in self.params.keys() and
                    'ext' not in self.params.keys()):
            print('Terminating - ERROR: incorrect parameters for LOAD task')
            print('Required Parameters: path, ext')
        print('Loading LEEM Data from Images via QThread ...')
        try:
            data = LF.get_img_array(self.params['path'],
                                    ext=self.params['ext'])
        except IOError as e:
            print(e)
            print('Error occurred while loading LEEM data from images using a QThread')
            return
        except ValueError as e:
            print(e)
            print('Error occurred while loading LEEM data from images using a QThread')
            return

        self.emit(QtCore.SIGNAL('output(PyQt_PyObject)'), data)
Esempio n. 8
0
    def load_LEEM_Images(self):
        """Load LEEM data from image files.

        Supported formats are TIFF, PNG, JPG
        Emit the 3d data array as a custom SIGNAL to be retrieved in please.py
        """
        if ('path' not in self.params.keys()
                and ('ext' not in self.params.keys())):
            print('Terminating - ERROR: incorrect parameters for LOAD task')
            print('Required Parameters: path, ext')
        print('Loading LEEM Data from Images via QThread ...')
        data = None
        try:
            data = LF.get_img_array(self.params['path'],
                                    ext=self.params['ext'])
        except IOError as e:
            print("Error Loading LEEM Experiment:")
            print(e)
            print(
                "LEEM data files not found in directory specified in YAML experiment config file."
            )
            print(
                "Please re-check the settings in your YAML experiment config file."
            )
            print(
                "Ensure that the path setting points to the correct directory."
            )
            return
        except ValueError as e:
            print(e)
            print(
                'Error occurred while loading LEEM data from images using a QThread'
            )
            return

        if data is None:
            self.quit()
            self.exit()
        else:
            self.outputSIGNAL.emit(data)  # type: np.ndarray