Skip to content

Commit

Permalink
Added extra post-processors to ACQ and refactored WaveformAWG for upc…
Browse files Browse the repository at this point in the history
…oming feature updates.
  • Loading branch information
PP501 committed Aug 7, 2024
1 parent 382ddbf commit 0ee741e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
13 changes: 11 additions & 2 deletions UnitTests/testLaboratory.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,15 @@ def test_PROCs(self):
new_proc.add_stage(CPU_FIR([{'Type' : 'low', 'Taps' : 40, 'fc' : 0.01, 'Win' : 'hamming'}]*2))
new_proc.add_stage_end(CPU_Mean('repetition'))
self.lab.HAL("dum_acq").set_data_processor(new_proc)
new_proc = ProcessorCPU('cpu_test2', self.lab)
new_proc.add_stage(CPU_DDC([0.14]))
new_proc.add_stage(CPU_FIR([{'Type' : 'low', 'Taps' : 40, 'fc' : 0.01, 'Win' : 'hamming'}]*2))
new_proc.add_stage_end(CPU_Mean('repetition'))
new_proc = ProcessorCPU('cpu_test3', self.lab)
new_proc.add_stage(CPU_DDC([0.14]))
new_proc.add_stage(CPU_FIR([{'Type' : 'low', 'Taps' : 40, 'fc' : 0.01, 'Win' : 'hamming'}]*2))
new_proc.add_stage_end(CPU_Mean('repetition'))
self.lab.HAL("dum_acq").set_extra_post_processors([self.lab.PROC('cpu_test2'), self.lab.PROC('cpu_test3')])
self.lab.CONFIG('testConf4').save_config()
#
self.lab.save_laboratory_config('UnitTests/', 'laboratory_configuration4.txt')
Expand Down Expand Up @@ -1274,6 +1283,6 @@ def test_SnakeExp(self):
self.cleanup()

if __name__ == '__main__':
temp = TestExpSweeps()
temp.test_SnakeExp()
temp = TestColdReload()
temp.test_VARs()
unittest.main()
24 changes: 22 additions & 2 deletions sqdtoolz/HAL/ACQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def __init__(self, hal_name, lab, instr_acq_name):
#
self._trig_src_obj = None
self.data_processor = None
self._post_processors = []
self.decision_blocks = []

@classmethod
Expand Down Expand Up @@ -91,8 +92,16 @@ def set_decision_block(self, DEC_objs):
def set_data_processor(self, proc_obj):
self.data_processor = proc_obj

def set_extra_post_processors(self, list_proc_objs):
assert self.data_processor != None, "Set/use set_data_processor first to set the primary driver-integrated processor. This function is to set extra/auxiliary processors."
self._post_processors = list_proc_objs[:]

def get_data(self):
return self._instr_acq.get_data(data_processor = self.data_processor, decision_blocks = self.decision_blocks)
ret_data = self._instr_acq.get_data(data_processor = self.data_processor, decision_blocks = self.decision_blocks)
for cur_proc in self._post_processors:
cur_proc.push_data(ret_data['data'])
ret_data['data'] = cur_proc.get_all_data()
return ret_data

def set_trigger_source(self, trig_src_obj):
assert isinstance(trig_src_obj, TriggerOutput) or trig_src_obj == None, "Must supply a valid Trigger Output object (i.e. digital trigger output like a marker)."
Expand All @@ -109,6 +118,12 @@ def get_trigger_source(self):
'''
return self._trig_src_obj

def _get_all_PROC_dependencies(self):
ret_list = []
if self.data_processor:
ret_list.append(self.data_processor)
return ret_list + self._post_processors

def _get_trigger_sources(self):
return [self._trig_src_obj]

Expand All @@ -122,7 +137,8 @@ def _get_current_config(self):
'instrument' : self._instr_id,
'Type' : self.__class__.__name__,
'TriggerSource' : self._get_trig_src_params_dict(),
'Processor' : proc_name
'Processor' : proc_name,
'ExProcessors' : [x.Name for x in self._post_processors]
}
self.pack_properties_to_dict(['NumSamples', 'NumSegments', 'NumRepetitions', 'SampleRate', 'InputTriggerEdge', 'ChannelStates'], ret_dict)
if len(self.decision_blocks) > 0:
Expand All @@ -141,6 +157,10 @@ def _set_current_config(self, dict_config, lab):
self.set_trigger_source(trig_src_obj)
if dict_config['Processor'] != '':
self.data_processor = lab.PROC(dict_config['Processor'])
self._post_processors = []
if 'ExProcessors' in dict_config:
for cur_proc in dict_config['ExProcessors']:
self._post_processors.append(lab.PROC(cur_proc))
if 'DecisionBlocks' in dict_config:
self.decision_block = []
for cur_dec_block in dict_config['DecisionBlocks']:
Expand Down
4 changes: 3 additions & 1 deletion sqdtoolz/HAL/AWG.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ def __init__(self, sample_rate, total_time, global_factor):
self._auto_comp_linked = False
self._auto_comp_algos = ['None', 'Basic']
self._total_time = total_time
self._global_factor = global_factor
self._global_factor = global_factor
if not hasattr(self, '_awg_chan_list'):
self._awg_chan_list = []

@property
def AutoCompression(self):
Expand Down

0 comments on commit 0ee741e

Please sign in to comment.