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")
} log.debug("Produced numbers: %s" % data) self.emit('results', data) self.emit('progress', 100.*i/self.iterations) sleep(self.delay) if self.should_stop(): log.warning("Catch stop command in procedure") break def shutdown(self): log.info("Finished") 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()
data = {'Iteration': i, 'Random Number': random.random()} log.debug("Produced numbers: %s" % data) self.emit('results', data) self.emit('progress', 100. * i / self.iterations) sleep(self.delay) if self.should_stop(): log.warning("Catch stop command in procedure") break def shutdown(self): log.info("Finished") 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()
'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)
#from thor_stepm import ThorlabsStageWithStepMotors from pymeasure.log import console_log from pymeasure.experiment import Results, Worker #from pymeasure.experiment import IntegerParameter,FloatParameter #from instrumental import instrument,list_instruments,u, Q_ #from instrumental.drivers.spectrometers.thorlabs_ccs import CCS from pymeasure.pymeas_class import XYmove #paramsets = list_instruments() #print(paramsets) #ccs = instrument(paramsets[0]) #print(ccs) #stage = ThorlabsStageWithStepMotors() #stage.set_stage() if __name__ == "__main__": console_log(log) log.info("Constructing an x scan") procedure = XYmove() log.info("Starting up the stage") procedure.startup() averages = 5 step = 0.1 final_x = 1.0 initial_x = 0.0 sleep(0.1) data_filename = 'example.csv' log.info("Constructing the Results with a data file: %s" % data_filename) results = Results(procedure, data_filename) log.info("Constructing the Worker")