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--')
|
default={ 'reals': [], 'imags': [], 't': [] }, readonly=True, visibility='w--')
|
||||||
|
|
||||||
status = fc.Parameter(datatype=frappy.datatypes.StatusType(fc.Drivable, "DISABLED", 'PREPARED', 'BUSY'), default=('IDLE', 'ok - uncompiled'))
|
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
|
# basic
|
||||||
title = fc.Parameter('title', fc.StringType(), default='sequence', readonly=False)
|
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='%'),
|
pulse_height=fc.FloatRange(unit='%'),
|
||||||
delay_time=fc.FloatRange(unit='usecs'),
|
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)
|
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
|
# 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
|
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
|
||||||
@@ -163,14 +164,6 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
pass
|
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
|
### READ/WRITE
|
||||||
|
|
||||||
def read_status(self):
|
def read_status(self):
|
||||||
@@ -279,6 +272,7 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
|||||||
newvals['t'] = []
|
newvals['t'] = []
|
||||||
return newvals
|
return newvals
|
||||||
|
|
||||||
|
#@fc.Command('pulls the number of acquisitions live. Better than waiting for a poll')
|
||||||
def read_num_acqs_actual(self):
|
def read_num_acqs_actual(self):
|
||||||
try:
|
try:
|
||||||
n = self.tnmr().get_nmrparameter('Actual Scans 1D')
|
n = self.tnmr().get_nmrparameter('Actual Scans 1D')
|
||||||
@@ -287,7 +281,7 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
### PRIVATE (Utility)
|
### PRIVATE (Utility)
|
||||||
def __compile_sequence(self):
|
def __compile_sequence(self, lockstatus=False):
|
||||||
'''Compiles the sequence loaded in sequence_data.
|
'''Compiles the sequence loaded in sequence_data.
|
||||||
|
|
||||||
This involves:
|
This involves:
|
||||||
@@ -362,7 +356,8 @@ class TNMRModule(fc.Drivable): # Drivable only for kill() funcitonality
|
|||||||
self.tnmr().set_nmrparameter(key, val)
|
self.tnmr().set_nmrparameter(key, val)
|
||||||
|
|
||||||
# finally, let ourselves know we're ready
|
# 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:
|
else:
|
||||||
traceback.print_exc()
|
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().'''
|
'''Tells TNMR to acquire data. Only call after __compile_sequence().'''
|
||||||
if(self.status[0] != 'BUSY' or self.starting):
|
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.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):
|
def __compile_and_run(self, thread=True):
|
||||||
'''Compiles and runs the currently-loaded sequence
|
'''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
|
thread: bool, determines if this should open a child thread and detach the process
|
||||||
'''
|
'''
|
||||||
self.starting = True
|
self.starting = True
|
||||||
self.__compile_sequence()
|
self.__compile_sequence(lockstatus=True)
|
||||||
time.sleep(1.0)
|
|
||||||
self.__zero_go()
|
self.__zero_go()
|
||||||
self.starting = False
|
self.starting = False
|
||||||
|
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ def create_sequence_file(filename, data, author='NA'):
|
|||||||
for i in column_names:
|
for i in column_names:
|
||||||
evnt_data_values += [ str(data['columns'][i][evnt]['value']) ]
|
evnt_data_values += [ str(data['columns'][i][evnt]['value']) ]
|
||||||
evnt_data_tables += [ data['columns'][i][evnt]['table'] ]
|
evnt_data_tables += [ data['columns'][i][evnt]['table'] ]
|
||||||
content += get_event_header(evnt, evnt_data_values, evnt_data_tables, data['tables'], tuning_number, column_delays, data['num_acq_points'])
|
content += get_event_header(evnt, evnt_data_values, evnt_data_tables, data['tables'], tuning_number, column_delays, int(data['num_acq_points']))
|
||||||
|
|
||||||
content += ' '
|
content += ' '
|
||||||
content += get_table_spec(data['tables'])
|
content += get_table_spec(data['tables'])
|
||||||
|
|||||||
@@ -236,7 +236,6 @@ class TNMR:
|
|||||||
print("Application locked during acquisition. Waiting...")
|
print("Application locked during acquisition. Waiting...")
|
||||||
while self.acquisition_running():
|
while self.acquisition_running():
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
# TODO: https://stackoverflow.com/questions/27586411/how-do-i-close-window-with-handle-using-win32gui-in-python to close any tecmag dialogues that show up. Need to determine proper search string, so next time it pops up, run some tests.
|
|
||||||
print("Acquisition done")
|
print("Acquisition done")
|
||||||
|
|
||||||
def acquisition_running(self):
|
def acquisition_running(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user