Fixed weird bug where the length of pulse sequences could never increase. Now, they have a hard limit of 100 pulses. Not a big deal.

This commit is contained in:
2025-07-24 11:24:56 +02:00
parent 1777e4b7b1
commit d5d9d70713

View File

@@ -81,10 +81,11 @@ class ProgrammedSequence(fc.Readable):
comments = fc.Parameter('comments', fc.StringType(), default='', readonly=False)
nucleus = fc.Parameter('nucleus', fc.StringType(), default='', readonly=False)
sequence_length = fc.Parameter('sequence_length', fc.IntRange(), default=0, readonly=True)
sequence_data = fc.Parameter('sequence_config', fc.ArrayOf(fc.StructOf(pulse_width=fc.FloatRange(unit='usecs'),
pulse_height=fc.FloatRange(unit='%'),
delay_time=fc.FloatRange(unit='usecs'),
phase_cycle=fc.StringType())), default=[], readonly=False)
phase_cycle=fc.StringType()), minlen=0), default=[{'pulse_width':0,'pulse_height':0,'delay_time':0,'phase_cycle':''}]*100, readonly=False)
# 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
@@ -210,6 +211,16 @@ class ProgrammedSequence(fc.Readable):
self.tnmr().set_nmrparameter('Observe Freq.', t)
self.status = ('IDLE', 'ok - uncompiled')
return self.read_obs_freq()
def write_sequence_data(self, t):
self.sequence_length = len(t)
seq = []
seq += t
print(seq)
seq += [{'pulse_width':0,'pulse_height':0,'delay_time':0,'phase_cycle':''}] * (100-self.sequence_length) # because nicos will only send the smallest size it has ever sent...
self.sequence_data = seq
return self.read_sequence_data()
### PRIVATE (Utility)
def __compile_sequence(self):
@@ -229,7 +240,8 @@ class ProgrammedSequence(fc.Readable):
seq = seq_gen.get_initial_block()
i = 0
self.approx_sequence_length = 0
for s in self.sequence_data:
for si in range(self.sequence_length):
s = self.sequence_data[si]
seq = seq_gen.combine_blocks(seq, seq_gen.get_single_pulse_block(f'pulse_{i}', str(s['pulse_width']) + 'u',
str(s['pulse_height']),
str(s['delay_time']) + 'u',
@@ -252,7 +264,6 @@ class ProgrammedSequence(fc.Readable):
filename = filepath + '/sequences/' + filename.replace('.','')
seq_gen.save_sequence(filename, seq)
seq_gen.save_sequence_cfg(filename, seq)
print(filename)
dashboard_params = { 'Observe Freq.': self.read_obs_freq(),
'Scans 1D': self.read_num_scans(),