def new_experiment(self, c, script_name): ''' Queue an experiment for launching. Returns the scan ID of the queued experiment from a scheduler instance. Parameter --------- script: str, experiment to run. TODO: change name. The name itself should actually be something like add_new_experiment_to_queue Returns ------- scan_id: int ''' if script_name not in self.script_parameters.keys(): raise Exception("Script {} Not Found".format(script_name)) # Grabs an instance of script_class_parameters that holds # the experiment name, the experiment class, and the list of # required parameters for the experiment. script = self.script_parameters[script_name] # single_launch is an experiment instance. single_launch = scan_methods.single(script.cls) scan_id = self.scheduler.add_scan_to_queue(single_launch) return scan_id
def new_script(self, c, script_name): ''' Queue an experiment for launching. Returns the scan ID of the queued experiment from a scheduler instance. Parameter --------- script: str, experiment to run. TODO: change name. The name itself should actually be something like add_new_experiment_to_queue Returns ------- scan_id: int ''' if script_name not in self.script_parameters.keys(): raise Exception ("Script {} Not Found".format(script_name)) # Grabs an instance of script_class_parameters that holds # the experiment name, the experiment class, and the list of # required parameters for the experiment. script = self.script_parameters[script_name] # single_launch is an experiment instance. single_launch = scan_methods.single(script.cls) scan_id = self.scheduler.add_scan_to_queue(single_launch) return scan_id
def new_script(self, c, script_name): ''' Launch script. Returns ID of the queued scan. ''' if script_name not in self.script_parameters.keys(): raise Exception ("Script {} Not Found".format(script_name)) script = self.script_parameters[script_name] single_launch = scan_methods.single(script.cls) scan_id = self.scheduler.add_scan_to_queue(single_launch) return scan_id
def new_script(self, c, script_name): ''' Launch script. Returns ID of the queued scan. ''' if script_name not in self.script_parameters.keys(): raise Exception("Script {} Not Found".format(script_name)) script = self.script_parameters[script_name] single_launch = scan_methods.single(script.cls) scan_id = self.scheduler.add_scan_to_queue(single_launch) return scan_id
def new_script_schedule(self, c, script_name, duration, priority = 'Normal', start_now = True): ''' Schedule the script to run every spcified duration of seconds. Priority indicates the priority with which the scrpt is scheduled. ''' if script_name not in self.script_parameters.keys(): raise Exception ("Script {} Not Found".format(script_name)) if priority not in ['Normal','First in Queue','Pause All Others']: raise Exception ("Priority not recognized") script = self.script_parameters[script_name] single_launch = scan_methods.single(script.cls) schedule_id = self.scheduler.new_scheduled_scan(single_launch, duration['s'], priority, start_now) return schedule_id
def initialize(self, cxn, context, ident): print 'in initialize', self.name(), ident raise Exception ("In a case of a crash, real message would follow") if __name__ == '__main__': #normal way to launch cxn = labrad.connect() scanner = cxn.scriptscanner exprt = fft_spectrum(cxn = cxn) ident = scanner.register_external_launch(exprt.name) exprt.execute(ident) #testing single launch cxn = labrad.connect() scanner = cxn.scriptscanner from scan_methods import single exprt = single(fft_spectrum) ident = scanner.register_external_launch(exprt.name) exprt.execute(ident) #testing repeat launch cxn = labrad.connect() scanner = cxn.scriptscanner from scan_methods import repeat_reload exprt = repeat_reload(fft_spectrum, 10) ident = scanner.register_external_launch(exprt.name) exprt.execute(ident) #testing scan cxn = labrad.connect() scanner = cxn.scriptscanner from scan_methods import scan_experiment_1D exprt = scan_experiment_1D(fft_spectrum, ('TrapFrequencies', 'rf_drive_frequency'), 10.0, 20.0, 10, 'MHZ') ident = scanner.register_external_launch(exprt.name)
print 'in initialize', self.name(), ident raise Exception("In a case of a crash, real message would follow") if __name__ == '__main__': #normal way to launch cxn = labrad.connect() scanner = cxn.scriptscanner exprt = fft_spectrum(cxn=cxn) ident = scanner.register_external_launch(exprt.name) exprt.execute(ident) #testing single launch cxn = labrad.connect() scanner = cxn.scriptscanner from scan_methods import single exprt = single(fft_spectrum) ident = scanner.register_external_launch(exprt.name) exprt.execute(ident) #testing repeat launch cxn = labrad.connect() scanner = cxn.scriptscanner from scan_methods import repeat_reload exprt = repeat_reload(fft_spectrum, 10) ident = scanner.register_external_launch(exprt.name) exprt.execute(ident) #testing scan cxn = labrad.connect() scanner = cxn.scriptscanner from scan_methods import scan_experiment_1D exprt = scan_experiment_1D(fft_spectrum, ('TrapFrequencies', 'rf_drive_frequency'), 10.0,