Esempio n. 1
0
    def save(self, filename=None, directory=None, date_dir=True):

        generic_save(
            data=self.data,
            filename=f'{filename}_{self.name}',
            directory=directory,
            date_dir=date_dir
        )
        if self.x is not None:
            generic_save(
                data=self.x,
                filename=f'{filename}_{self.name}_x',
                directory=directory,
                date_dir=date_dir
            )

        if hasattr(self, 'graph'):
            pyqtgraph_save(
                self.graph.getView(),
                f'{filename}_{self.name}',
                directory,
                date_dir
            )

        for child in self.children.values():
            child.save(filename, directory, date_dir)

        save_metadata(self.log, filename, directory, date_dir)
Esempio n. 2
0
    def save(self, filename=None, directory=None):
        """ Saves the current data """

        generic_save(data=np.array([
            self.ctr.get_x_axis(self.hist) / 1e12,
            self.ctr.get_counts(self.hist)[0]
        ]),
                     filename=filename,
                     directory=directory,
                     date_dir=True)

        for gate_name, gate in self.gates.items():
            generic_save(data=np.array([
                gate.ctr.get_x_axis(gate.hist) / 1e12,
                gate.ctr.get_counts(gate.hist)[0]
            ]),
                         filename=gate_name,
                         directory=directory,
                         date_dir=True)

        pyqtgraph_save(widget=self.gui.graph.getPlotItem(),
                       filename=filename,
                       directory=directory,
                       date_dir=True)

        self.log.info('Saved histogram data')
Esempio n. 3
0
    def save(self, filename=None, directory=None, date_dir=True):

        generic_save(data=self.data,
                     filename=f'{filename}_{self.name}',
                     directory=directory,
                     date_dir=date_dir)
        if self.x is not None:
            generic_save(data=self.x,
                         filename=f'{filename}_{self.name}_x',
                         directory=directory,
                         date_dir=date_dir)

        if hasattr(self, 'graph'):
            pyqtgraph_save(self.graph.getPlotItem(), f'{filename}_{self.name}',
                           directory, date_dir)

        # if the dataset is important, save it again in the important dataset folder.
        if self.is_important:
            generic_save(data=self.data,
                         filename=f'{filename}_{self.name}',
                         directory=directory + "\\important_data",
                         date_dir=date_dir)
            if self.x is not None:
                generic_save(data=self.x,
                             filename=f'{filename}_{self.name}_x',
                             directory=directory + "\\important_data",
                             date_dir=date_dir)

            if hasattr(self, 'graph'):
                pyqtgraph_save(self.graph.getPlotItem(),
                               f'{filename}_{self.name}',
                               directory + "\\important_data", date_dir)

        for child in self.children.values():
            child.save(filename, directory, date_dir)
Esempio n. 4
0
    def save(self, filename=None, directory=None, date_dir=True):
        """ Saves the dataset

        :param filename: (str) name of file identifier
        :param directory: (str) filepath to save to
        :param date_dir: (bool) whether or not to store in date-specific sub-directory
        """

        if filename is None:
            filename = self.widgets['save_name'].text()
        if directory is None:
            directory = self.config['save_path']

        # Save heatmap
        generic_save(data=fill_2dlist(self.data_fwd),
                     filename=f'{filename}_fwd_scans',
                     directory=directory,
                     date_dir=date_dir)
        pyqtgraph_save(widget=self.widgets['hmap'][0].getView(),
                       filename=f'{filename}_fwd_scans',
                       directory=directory,
                       date_dir=date_dir)

        # Save average
        generic_save(data=np.vstack((self.x_fwd, np.array([self.avg_fwd]))),
                     filename=f'{filename}_fwd_avg',
                     directory=directory,
                     date_dir=date_dir)
        pyqtgraph_save(widget=self.widgets['graph'][0].getPlotItem(),
                       filename=f'{filename}_fwd_avg',
                       directory=directory,
                       date_dir=date_dir)

        if self.sweep_type != 'sawtooth':

            # Save heatmap
            generic_save(data=fill_2dlist(self.data_bwd),
                         filename=f'{filename}_bwd_scans',
                         directory=directory,
                         date_dir=date_dir)
            pyqtgraph_save(widget=self.widgets['hmap'][1].getView(),
                           filename=f'{filename}_bwd_scans',
                           directory=directory,
                           date_dir=date_dir)
            # Save average
            generic_save(data=np.vstack(
                (self.x_bwd, np.array([self.avg_bwd]))),
                         filename=f'{filename}_bwd_avg',
                         directory=directory,
                         date_dir=date_dir)
            pyqtgraph_save(widget=self.widgets['graph'][1].getPlotItem(),
                           filename=f'{filename}_bwd_avg',
                           directory=directory,
                           date_dir=date_dir)
        '''else: