Example #1
0
    def load_LEEM(self):
        """
        Load raw binary LEEM-IV data to a 3d numpy array
        emit the numpy array as a custom SIGNAL to be retrieved in gui.py
        :return:
        """
        # requires params: path, imht, imwd
        if ( 'path' not in self.params.keys() or
             'imht' not in self.params.keys() or
             'imwd' not in self.params.keys()):

            print('Terminating - ERROR: incorrect parameters for LOAD task')
            print('Required Parameters: path, imht, imwd')
            self.quit()
            self.exit()

        if 'bits' not in self.params.keys():
            # if bit size is not specified, use default values in process_LEEM_Data()
            self.params['bits'] = None

        if 'byte' not in self.params.keys():
            self.params['byte'] = 'L'  # default to Little Endian

        # load raw data
        dat_3d = LF.process_LEEM_Data(dirname=self.params['path'],
                                      ht=self.params['imht'],
                                      wd=self.params['imwd'],
                                      bits=self.params['bits'],
                                      byte=self.params['byte'])

        # emit output signal with np array as generic pyobject type
        self.emit(QtCore.SIGNAL('output(PyQt_PyObject)'), dat_3d)
Example #2
0
    def load_LEEM(self):
        """Load raw binary LEEM-IV data to a 3d numpy array.

        Emit the numpy array as a custom SIGNAL to be retrieved in gui.py
        :return: None
        """
        # requires params: path, imht, imwd
        if ('path' not in self.params.keys()
                or ('imht' not in self.params.keys())
                or ('imwd' not in self.params.keys())):

            print('Terminating - ERROR: incorrect parameters for LOAD task')
            print('Required Parameters: path, imht, imwd')
            self.quit()
            self.exit()

        if 'bits' not in self.params.keys():
            # if bit size is not specified, use default values in process_LEEM_Data()
            self.params['bits'] = None

        if 'byte' not in self.params.keys():
            self.params['byte'] = 'L'  # default to Little Endian

        # load raw data
        dat_3d = None
        try:
            dat_3d = LF.process_LEEM_Data(dirname=self.params['path'],
                                          ht=self.params['imht'],
                                          wd=self.params['imwd'],
                                          bits=self.params['bits'],
                                          byte=self.params['byte'])
        except IOError as e:
            print("Error Loading LEEM Data:")
            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 LF.InvalidParameterError as e:
            print(e.message)
            return

        if dat_3d is None:
            self.quit()
            self.exit()
        else:
            self.outputSIGNAL.emit(dat_3d)  # type: np.ndarray
Example #3
0
    def load_LEED_RAW(self, dirname):
        """
        Load RAW binary files into 3d numpy array
        This is the fastest method for loading data
        This should only be called from load_LEED_Data()

        :return: 3d numpy array
        """
        # maybe not needed
        prev_dir = self.data_dir
        files = [name for name in os.listdir(dirname) if name.endswith('.dat')]
        print('Number of Files found: {}'.format(len(files)))
        if self.ht >= 2 and self.wd >= 2:
            # image parameters were correctly set through GUI
            return LF.process_LEEM_Data(dirname, self.ht, self.wd)
        else:
            # image parameters were not set through GUI
            print('!Warning: Invalid Image Parameters while loading RAW data!')
            print('Returning Empty array ...')
            return np.zeros((500, 500, 100))  # placeholder array
Example #4
0
    def load_LEED_RAW(self, dirname):
        """
        Load RAW binary files into 3d numpy array
        This is the fastest method for loading data
        This should only be called from load_LEED_Data()

        :return: 3d numpy array
        """
        # maybe not needed
        prev_dir = self.data_dir
        files = [name for name in os.listdir(dirname) if name.endswith('.dat')]
        print('Number of Files found: {}'.format(len(files)))
        if self.ht >= 2 and self.wd >= 2:
            # image parameters were correctly set through GUI
            return LF.process_LEEM_Data(dirname, self.ht, self.wd)
        else:
            # image parameters were not set through GUI
            print('!Warning: Invalid Image Parameters while loading RAW data!')
            print('Returning Empty array ...')
            return np.zeros((500, 500, 100))  # placeholder array