def queue(self):
        
        procedure = self.make_procedure()

        directory = procedure.fileroot
        

        if procedure.inverse_spacing:
            fields = np.linspace(1/procedure.field_start,1/procedure.field_stop,procedure.field_steps)
            fields = 1/fields
            for field in fields:
                filename = unique_filename(directory, prefix=procedure.filename, ext='txt', datetimeformat='')
                procedure.field = field
                results = Results(procedure, filename)
                experiment = self.new_experiment(results)

                self.manager.queue(experiment)

        else:
            filename = unique_filename(directory, prefix=procedure.filename, ext='txt', datetimeformat='')

            results = Results(procedure, filename)
            experiment = self.new_experiment(results)

            self.manager.queue(experiment)
Пример #2
0
 def queue(self):
     procedure = self.make_procedure()
     filename = unique_filename(procedure.save_dir, procedure.sample_name,
                                '_temp_monitor_')
     results = Results(procedure, filename)
     experiment = self.new_experiment(results)
     self.manager.queue(experiment)
Пример #3
0
 def queue(self):
     direc = '.'
     filename = unique_filename(direc,'test')
     procedure = self.make_procedure()
     results = Results(procedure, filename)
     experiment = self.new_experiment(results)
     self.manager.queue(experiment)
Пример #4
0
    def __init__(self, title, procedure, analyse=(lambda x: x)):
        self.title = title
        self.procedure = procedure
        self.measlist = []
        self.port = 5888
        self.plots = []
        self.figs = []
        self._data = []
        self.analyse = analyse
        self._data_timeout = 10

        config = get_config()
        set_mpl_rcparams(config)
        if 'Logging' in config._sections.keys():
            self.scribe = setup_logging(log, **config._sections['Logging'])
        else:
            self.scribe = console_log(log)
        self.scribe.start()

        self.filename = create_filename(self.title)
        log.info("Using data file: %s" % self.filename)

        self.results = Results(self.procedure, self.filename)
        log.info("Set up Results")

        self.worker = Worker(self.results, self.scribe.queue, logging.DEBUG)
        log.info("Create worker")
Пример #5
0
    def queue(self):

        maxcurrent = self.inputs.max_curr.value()
        mincurrent = self.inputs.min_curr.value()
        currentstep = self.inputs.curr_step.value()

        currents = np.arange(mincurrent, maxcurrent + currentstep, currentstep)

        for k, curr in enumerate(currents):
            # Change this to the desired directory
            directory = self.inputs.folder.text()

            filename = unique_filename(
                directory, prefix=self.inputs.samplename.text(),
                ext='txt', datetimeformat='')

            procedure = Measure2ndHarmonic()
            procedure.current = curr
            procedure.max_angle = self.inputs.max_angle.value()
            procedure.delay = self.inputs.delay.value()
            procedure.Lockin1_use = self.inputs.Lockin1_use.currentText()
            procedure.Lockin2_use = self.inputs.Lockin2_use.currentText()

            results = Results(procedure, filename)
            experiment = self.new_experiment(results)

            self.manager.queue(experiment)
Пример #6
0
    def queue(self):
        filename = tempfile.mktemp()

        procedure = self.make_procedure()
        results = Results(procedure, filename)
        experiment = self.new_experiment(results)

        self.manager.queue(experiment)
Пример #7
0
    def queue(self):
        filename = str(PotentiostaticProcedure.filename)

        procedure = self.make_procedure()
        results = Results(procedure, filename)
        experiment = self.new_experiment(results)

        self.manager.queue(experiment)
Пример #8
0
    def queue(self):
        directory = "./"  # Change this to the desired directory
        filename = unique_filename(directory, prefix='IV')

        procedure = self.make_procedure()
        results = Results(procedure, filename)
        experiment = self.new_experiment(results)

        self.manager.queue(experiment)
Пример #9
0
    def queue(self):
        filename = str(DepProcedure.filename)
        #        filename = unique_filename(directory, prefix='IV')

        procedure = self.make_procedure()
        results = Results(procedure, filename)
        experiment = self.new_experiment(results)

        self.manager.queue(experiment)
Пример #10
0
 def queue(self):
     fname = unique_filename(
         self.inputs.save_dir.text(),
         dated_folder=True,
         prefix=self.inputs.calib_name.text() + '_temperature_record_',
         suffix=''
     )
     procedure = self.make_procedure()
     results = Results(procedure, fname)
     experiment = self.new_experiment(results)
     self.manager.queue(experiment)
Пример #11
0
    def queue(self):
        filename = tempfile.mktemp()

        procedure = TestProcedure()
        procedure.seed = str(self.inputs.seed.text())
        procedure.iterations = self.inputs.iterations.value()
        procedure.delay = self.inputs.delay.value()

        results = Results(procedure, filename)

        experiment = self.new_experiment(results)

        self.manager.queue(experiment)
Пример #12
0
    def queue(self):
        # create filename based on procedure name, position in queue and a unique identifier
        procedure_string = re.search("'(?P<name>[^']+)'",
                                     repr(self.procedure_class)).group("name")
        main_str, basename = procedure_string.split('.')
        queue_position = len(self.manager.experiments.queue) + 1
        uidn = uuid.uuid4().clock_seq_hi_variant
        filename = f'{basename}-{queue_position}_{uidn}.csv'

        #create new experiment
        procedure = self.make_procedure()
        results = Results(procedure, filename)
        experiment = self.new_experiment(results)
        #que new experiment
        self.manager.queue(experiment)
Пример #13
0
    def queue(self):
        direc = self.inputs.save_dir.text()
        # create list of procedures to run
        procedure = self.make_procedure()

        # create files
        pre = (procedure.your_name + '_') if procedure.your_name else ''
        suf = 'SS9'
        filename = unique_filename(direc,
                                   dated_folder=True,
                                   suffix=suf,
                                   prefix=pre)
        # ensure *some* sample name exists so Results.load() works
        if procedure.your_name == '':
            procedure.your_name = 'undefined'

        # Queue experiment
        results = Results(procedure, filename)
        experiment = self.new_experiment(results)
        self.manager.queue(experiment)
    def queue(self, *, procedure=None):
        directory = os.getcwd() + '/' + self.directory

        if procedure is None:
            procedure = self.make_procedure()

        prefix = 'DUT{:s}_{:s}_{:s}'.format(str(procedure.dev_num),
                                            procedure.pd_type,
                                            procedure.pd_size)
        # suffix = strftime("%Y%m%d_%H%M%S")
        filename = unique_filename(
            directory,
            # prefix=prefix,
            # suffix=suffix,
            datetimeformat="%Y%m%d_%H%M%S")

        results = Results(procedure, filename)
        experiment = self.new_experiment(results)

        self.manager.queue(experiment)
Пример #15
0
    def queue(self):

        # create filename based on procedure name, position in queue and a unique identifier
        procedure_string = re.search("'(?P<name>[^']+)'",
                                     repr(self.procedure_class)).group("name")
        main_str, basename = procedure_string.split('.')
        queue_position = len(self.manager.experiments.queue) + 1
        uidn = uuid.uuid4().clock_seq_hi_variant
        filename = f'{basename}-{queue_position}_{uidn}.csv'

        # construct a new instance of procedure and define datapoints
        procedure = self.make_procedure()
        procedure.data_points = np.ceil(
            (procedure.max_voltage - procedure.min_voltage) /
            procedure.voltage_step)

        # construct a new instance of Results
        results = Results(procedure, filename)

        # construct new experiment (that contains the previously constructed procedure and results objects)
        experiment = self.new_experiment(results)

        # if its the first experiment don't start it right away
        if not self.manager.experiments.queue:
            self.manager._start_on_add = False
            self.manager._is_continuous = False
            self.manager.queue(experiment)

            # set the gui accordingly
            self.abort_button.setEnabled(False)
            self.abort_button.setText("Start")
            self.abort_button.clicked.disconnect()
            self.abort_button.clicked.connect(self.resume)
            self.abort_button.setEnabled(True)

        # add experiment to que
        else:
            self.manager.queue(experiment)
Пример #16
0

if __name__ == "__main__":

    scribe = console_log(log, level=logging.DEBUG)
    scribe.start()

    filename = tempfile.mktemp()
    log.info("Using data file: %s" % filename)

    procedure = TestProcedure()
    procedure.iterations = 200
    procedure.delay = 0.1
    log.info("Set up TestProcedure with %d iterations" % procedure.iterations)

    results = Results(procedure, filename)
    log.info("Set up Results")

    plotter = Plotter(results)
    plotter.start()

    worker = Worker(results, scribe.queue, log_level=logging.DEBUG)
    log.info("Created worker for TestProcedure")
    log.info("Starting worker...")
    worker.start()

    log.info("Joining with the worker in at most 20 min")
    worker.join(60 * 20)
    log.info("Waiting for Plotter to close")
    plotter.wait_for_close()
    log.info("Plotter closed")
Пример #17
0
                    'Reverse Current Dark': abs(trace_data_dark[i, 0]),
                    'Timestamp Dark': trace_data_dark[i, 1],
                    'Status Dark': trace_data_dark[i, 2],
                    'Reverse Voltage Light': abs(trace_data_light[i, 3]),
                    'Reverse Current Light': abs(trace_data_light[i, 0]),
                    'Timestamp Light': trace_data_light[i, 1],
                    'Status Light': trace_data_light[i, 2]
                }) for i in range(n_samples)
        ]
        log.info("Current data emitted")
        log.info("Turning off light source")
        self.power_supply.enabled = "OFF"
        log.info("Waiting for 30sec in between test.")
        sleep(30)


if __name__ == "__main__":
    console_log(log, level=logging.DEBUG)

    procedure = IVSweepProcedure()
    procedure.polarity = "Anode"
    # procedure.step = 1

    data_filename = 'example.csv'
    results = Results(procedure, data_filename)

    worker = Worker(results)
    worker.start()

    worker.join(timeout=3600)  # wait at most 1 hr (3600 sec)