Minor changes, final backup. It's been real nice here at PSI.
This commit is contained in:
@@ -85,7 +85,8 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
||||
default={ 'reals': [], 'imags': [], 't': [] }, readonly=True, visibility='w--')
|
||||
|
||||
status = fc.Parameter(datatype=frappy.datatypes.StatusType(fc.Drivable, "DISABLED", 'PREPARED', 'BUSY'), default=('IDLE', 'ok - uncompiled'))
|
||||
pollinterval = fc.Parameter(default=1)
|
||||
pollinterval = fc.Parameter(default=0.5)
|
||||
slowinterval = fc.Parameter('slowinterval', fc.FloatRange(), default=0.5)
|
||||
|
||||
# basic
|
||||
title = fc.Parameter('title', fc.StringType(), default='sequence', readonly=False)
|
||||
@@ -98,7 +99,7 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
||||
pulse_height=fc.FloatRange(unit='%'),
|
||||
delay_time=fc.FloatRange(unit='usecs'),
|
||||
phase_cycle=fc.StringType()), minlen=0), default=[{'pulse_width':0,'pulse_height':0,'delay_time':0,'phase_cycle':''}]*TNMR_MAX_PULSES, readonly=False)
|
||||
num_acqs_actual = fc.Parameter('num_acqs', fc.IntRange(), readonly=True, default=0)
|
||||
num_acqs_actual = fc.Parameter('actual_num_acqs', fc.IntRange(), readonly=True, default=0)
|
||||
|
||||
# final details
|
||||
acquisition_time = fc.Parameter('acquisition_time', fc.FloatRange(unit='usecs'), readonly=False, group='sequence_editor', default=204.8) # this is a limit set by the dwell limit and number of acquisition points
|
||||
@@ -162,14 +163,6 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
||||
except:
|
||||
traceback.print_exc()
|
||||
pass
|
||||
|
||||
@fc.Command(description='Updates any device parameters via a dictionary', argument={'type': 'dict'})
|
||||
def update_parameters(self, dct):
|
||||
for k, v in dct.items():
|
||||
if(hasattr(self, k)):
|
||||
setattr(self, k, v)
|
||||
else:
|
||||
self.logger.info(f'Bad TNMR parameter: {k}')
|
||||
|
||||
### READ/WRITE
|
||||
|
||||
@@ -278,7 +271,8 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
||||
newvals['imags'] = []
|
||||
newvals['t'] = []
|
||||
return newvals
|
||||
|
||||
|
||||
#@fc.Command('pulls the number of acquisitions live. Better than waiting for a poll')
|
||||
def read_num_acqs_actual(self):
|
||||
try:
|
||||
n = self.tnmr().get_nmrparameter('Actual Scans 1D')
|
||||
@@ -287,7 +281,7 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
||||
return 0
|
||||
|
||||
### PRIVATE (Utility)
|
||||
def __compile_sequence(self):
|
||||
def __compile_sequence(self, lockstatus=False):
|
||||
'''Compiles the sequence loaded in sequence_data.
|
||||
|
||||
This involves:
|
||||
@@ -362,7 +356,8 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
||||
self.tnmr().set_nmrparameter(key, val)
|
||||
|
||||
# finally, let ourselves know we're ready
|
||||
self.status = ('PREPARED', 'compiled')
|
||||
if not(lockstatus): # this is so that we don't get the weird situation of frappy thinking we're ready for new stuff before acquiring
|
||||
self.status = ('PREPARED', 'compiled')
|
||||
else:
|
||||
traceback.print_exc()
|
||||
|
||||
@@ -370,6 +365,7 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
||||
'''Tells TNMR to acquire data. Only call after __compile_sequence().'''
|
||||
if(self.status[0] != 'BUSY' or self.starting):
|
||||
self.tnmr().ZeroGo(lock=False, check_time=max(int(self.approx_sequence_length*1.5), 5))
|
||||
self.actual_num_acqs = self.read_num_acqs_actual()
|
||||
|
||||
def __compile_and_run(self, thread=True):
|
||||
'''Compiles and runs the currently-loaded sequence
|
||||
@@ -379,8 +375,7 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
||||
thread: bool, determines if this should open a child thread and detach the process
|
||||
'''
|
||||
self.starting = True
|
||||
self.__compile_sequence()
|
||||
time.sleep(1.0)
|
||||
self.__compile_sequence(lockstatus=True)
|
||||
self.__zero_go()
|
||||
self.starting = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user