Beispiel #1
0
 def load_data(self):
     self.data, self.fname, self.node_path = browse_data(ret_all=True)
     if self.data is not None:
         self.settings.child('xaxis', 'xoffset').setValue(
             (-self.data.shape[1] / 2))
         self.settings.child('yaxis', 'yoffset').setValue(
             (-self.data.shape[0] / 2))
         self.viewer2D.setImage(self.data)
         self.viewer2D.get_action('histo').trigger()
         self.viewer2D.get_action('roi').trigger()
         QtWidgets.QApplication.processEvents()
Beispiel #2
0
 def load_data(self):
     self.data, self.fname, self.node_path = browse_data(ret_all=True)
     if self.data is not None:
         self.settings.child('xaxis', 'xoffset').setValue(
             (-self.data.shape[1] / 2))
         self.settings.child('yaxis', 'yoffset').setValue(
             (-self.data.shape[0] / 2))
         self.viewer2D.setImage(self.data)
         self.viewer2D.ui.Show_histogram.click()
         self.viewer2D.ui.roiBtn.click()
         self.viewer2D.ui.ROIs_widget.setVisible(False)
         QtWidgets.QApplication.processEvents()
 def load_file(self):
     data, fname, node_path = browse_data(ret_all=True)
     if data is not None:
         h5utils = H5BrowserUtil()
         h5utils.open_file(fname)
         data, axes, nav_axes, is_spread = h5utils.get_h5_data(node_path)
         data_node = h5utils.get_node(node_path)
         if data_node.attrs['type'] == 'data':
             if data_node.attrs['data_dimension'] == '1D':
                 data_dict = OrderedDict(data1D=dict(
                     raw=dict(data=data, x_axis=axes['x_axis'])))
                 self.show_data(data_dict)
         h5utils.close_file()
 def load_calibration(self, fname):
     (root, ext) = os.path.splitext(fname)
     if 'h5' in ext:
         self.calibration = browse_data(
             fname
         )  #phase values corresponding to grey levels (256 elements in array)
     elif 'txt' in ext or 'dat' in ext:
         self.calibration = np.loadtxt(
             fname)[:, 1]  # to update in order to select what data in file
     else:
         self.calibration = None
         self.emit_status(
             ThreadCommand('Update_Status',
                           ['No calibration has been loaded', 'log']))
    def add_spectrum_h5(self):
        data, fname, node_path = browse_data(ret_all=True)
        if data is not None:
            file = Path(fname).parts[-1]
            self.filenames.append(file)
            self.raw_datas[file] = data
            self.raw_axis = np.linspace(0, len(data) - 1, len(data))

            # with tables.open_file(fname) as h5file:
            #     data_node = h5file.get_node(node_path)
            #
            #
            #     if 'X_axis' in list(data_node._v_parent._v_children):
            #         self.raw_axis = data_node._v_parent._f_get_child('X_axis').read()

            self.viewer_data.show_data(self.raw_datas.values(),
                                       x_axis=self.raw_axis,
                                       labels=self.filenames)
Beispiel #6
0
    def load_image(self):
        #image_filepath = str(utils.select_file(start_path=None, save=False, ext='h5'))
        data, fname, node_path = browse_data(ret_all=True)
        if data is not None and fname != '':
            self.h5module_image = H5BrowserUtil()
            self.h5module_image.open_file(fname, 'a')
            node = self.h5module_image.get_node(node_path)
            pixmaps = self.h5module_image.get_h5file_scans(node.parent_node)

            self.settings.child('settings', 'imagepath').setValue(fname)
            other_child = [
                child for child in self.settings.child(('scans')).children()
                if 'Scan' not in child.name()
            ]
            if len(other_child) >= 1:
                for child in other_child:
                    self.settings.child(('scans')).removeChild(child)
            params = []
            for pixmap in pixmaps:
                params.append({
                    'name':
                    pixmap['scan_name'],
                    'type':
                    'pixmap_check',
                    'value':
                    dict(data=pixmap['data'],
                         checked=False,
                         path=pixmap['path'])
                })
            self.settings.child(('scans')).addChildren(params)

            val = self.settings.child('scans', pixmaps[0]['scan_name']).value()
            val.update(dict(checked=True))
            self.settings.child('scans', pixmaps[0]['scan_name']).setValue(val)
            self.settings.child(
                'scans', pixmaps[0]['scan_name']).sigValueChanged.emit(
                    self.settings.child('scans', pixmaps[0]['scan_name']),
                    self.settings.child('scans',
                                        pixmaps[0]['scan_name']).value())