Can now change the number of acquired points. This, with the ability to change the acquisition length, allows one to control dwell time indirectly

This commit is contained in:
2025-08-12 11:23:35 +02:00
parent 904db04447
commit 7e5b47d45f
3 changed files with 24 additions and 7 deletions

View File

@@ -95,6 +95,7 @@ class ProgrammedSequence(fc.Drivable): # Drivable only for kill() funcitonality
# 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
num_acq_points = fc.Parameter('num_acq_points', fc.IntRange(), readonly=False, group='sequence_editor', default=1024)
ringdown_time = fc.Parameter('ringdown_time', fc.FloatRange(unit='usecs'), readonly=False, group='sequence_editor', default=1)
pre_acquisition_time = fc.Parameter('pre_acquisition_time', fc.FloatRange(unit='usecs'), readonly=False, group='sequence_editor', default=1)
post_acquisition_time = fc.Parameter('post_acquisition_time', fc.FloatRange(unit='msecs'), readonly=False, group='sequence_editor', default=500)
@@ -224,6 +225,12 @@ class ProgrammedSequence(fc.Drivable): # Drivable only for kill() funcitonality
self.status = ('IDLE', 'ok - uncompiled')
return self.read_num_acqs()
def write_num_acq_points(self, t):
if(self.status[0] != 'BUSY'):
self.status = ('IDLE', 'ok - uncompiled')
self.num_points = t
return self.read_num_acq_points()
def read_obs_freq(self):
return self.tnmr().get_nmrparameter('Observe Freq.')
@@ -294,7 +301,8 @@ class ProgrammedSequence(fc.Drivable): # Drivable only for kill() funcitonality
str(self.pre_acquisition_time) + 'u',
str(self.acquisition_time) + 'u',
str(self.post_acquisition_time) + 'm',
str(self.acq_phase_cycle)))
str(self.acq_phase_cycle),
str(self.num_acq_points)))
self.approx_sequence_length += float(self.acquisition_time)*1e-6
self.approx_sequence_length += float(self.post_acquisition_time)*1e-6
@@ -316,6 +324,7 @@ class ProgrammedSequence(fc.Drivable): # Drivable only for kill() funcitonality
self.compiled_parameters['post_acquisition_time'] = self.post_acquisition_time
self.compiled_parameters['acq_phase_cycle'] = self.acq_phase_cycle
self.compiled_parameters['num_acqs'] = self.read_num_acqs()
self.compiled_parameters['num_acq_points'] = self.read_num_acq_points()
self.compiled_parameters['obs_freq'] = self.read_obs_freq()
self.compiled_parameters['title'] = self.read_title()
self.compiled_parameters['comments'] = self.read_comments()

View File

@@ -194,7 +194,7 @@ def get_delay_header(col_delays, tuning_number):
headerstr += Z*56
return headerstr
def get_event_header(event_type, vals, tables, table_reg, tuning_number, col_delays):
def get_event_header(event_type, vals, tables, table_reg, tuning_number, col_delays, num_acq_points):
'''Generates the file information for the events section. This should come after the delay header (see get_delay_header())
Params
@@ -225,7 +225,7 @@ def get_event_header(event_type, vals, tables, table_reg, tuning_number, col_del
for i in range(len(vals)):
headerstr += fm(str(vals[i]))
if(event_type == 'Acq' and str(vals[i]) == '1'):
acq_points = 1024
acq_points = num_acq_points
acq_time = col_delays[i]
if('u' in acq_time):
acq_time = float(acq_time.strip()[:-1])
@@ -300,6 +300,7 @@ def generate_default_sequence(col_names, col_delays):
sub_dict[e] = { 'value': str(event_defaults[e]), 'table': '' }
sub_dict['Delay'] = delay
full_dict['columns'][c] = sub_dict.copy()
full_dict['num_acq_points'] = 1024
return full_dict
def create_sequence_file(filename, data, author='NA'):
@@ -308,7 +309,14 @@ def create_sequence_file(filename, data, author='NA'):
Parameters
----------
filename: str, where to write this.
data: a dictionary in the form { 'columns': { [column_name_0]: { 'F1_Ampl': [value], ..., 'Rx_Blank': [value], 'Delay': [value] }, ... }, 'tables': { 'table_1': {...}, ... } }. If any sub-entries are empty, they will be given default values (requires that all event_types are present). See event_types and event_defaults. This is best generated using generate_default_sequence and then modifying the given sequence.
data: a dictionary in the form { 'columns': {
[column_name_0]: {
'F1_Ampl': [value], ..., 'Rx_Blank': [value], 'Delay': [value] }
, ... },
'tables': {
'table_1': {...}, ... } ,
'num_acq_points': [integer]
}. Any column with Acq enabled should also have a field "num_acq_points". If any sub-entries are empty, they will be given default values (requires that all event_types are present). See event_types and event_defaults. This is best generated using generate_default_sequence and then modifying the given sequence.
author [optional]: str to describe the file creator.
'''
content = ''
@@ -328,7 +336,7 @@ def create_sequence_file(filename, data, author='NA'):
for i in column_names:
evnt_data_values += [ str(data['columns'][i][evnt]['value']) ]
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)
content += get_event_header(evnt, evnt_data_values, evnt_data_tables, data['tables'], tuning_number, column_delays, data['num_acq_points'])
content += ' '
content += get_table_spec(data['tables'])

View File

@@ -84,7 +84,7 @@ def get_initial_block():
return block
def get_final_block(ringdown_time, preacquire_time, acquire_time, cooldown_time, acq_phase_cycle='0'):
def get_final_block(ringdown_time, preacquire_time, acquire_time, cooldown_time, acq_phase_cycle='0', num_acq_points=1024):
'''Generates the final block of data to create a sequence with.
Parameters
@@ -100,7 +100,7 @@ def get_final_block(ringdown_time, preacquire_time, acquire_time, cooldown_time,
a dictionary which can be updated with others to generate a larger, more complex sequence.
'''
block = se.generate_default_sequence(['Ringdown', 'RX On', 'Acquisition', 'Finish', ''], [ringdown_time, preacquire_time, acquire_time, cooldown_time, '1u'])
block = se.generate_default_sequence(['Ringdown', 'RX On', 'Acquisition', 'Finish', ''], [ringdown_time, preacquire_time, acquire_time, cooldown_time, '1u'])
block['num_acq_points'] = num_acq_points
# ringdown
block['columns']['Ringdown']['Rx_Blank']['value'] = '1'