From d514b83f2a62b2c47e8867d5324343805180f782 Mon Sep 17 00:00:00 2001 From: Guenter Quast <guenter.quast@online.de> Date: Sun, 9 Jun 2024 10:13:01 +0200 Subject: [PATCH] working config for RedPitaya pulse generator --- config/spectrum_config.yaml | 35 +++++++++++++++++++++-------------- modules/spectrum_filter.py | 3 ++- redPoscdaq.py | 6 +++--- setup.yaml | 18 +++++++++--------- 4 files changed, 35 insertions(+), 27 deletions(-) diff --git a/config/spectrum_config.yaml b/config/spectrum_config.yaml index a5971a8..2a6cfc1 100644 --- a/config/spectrum_config.yaml +++ b/config/spectrum_config.yaml @@ -2,28 +2,34 @@ general: runtime: 600 # desired runtime in seconds runevents: &number_of_events 100000 - number_of_samples: &number_of_samples 2048 + number_of_samples: &number_of_samples 1000 analogue_offset: &analogue_offset 0 - sample_time_ns: &sample_time_ns 32 + # special settings for RedPitaya + decimation_index: &decimation 4 # decimation 0:1, i:2^(i+1) # data decimation factor, 0 is 8 ns/sample + sample_time_ns: &sample_time_ns 256 # for decimation 4 + invert_channel1: &invert1 0 + invert_channel2: &invert2 0 trigger_level: &trigger_level 50 trigger_channel: &trigger_channel '1' - trigger_direction: &trigger_direction 'rising' + trigger_direction: &trigger_direction "rising" # or "falling" pre_trigger_samples: &pre_trigger_samples 103 # 5% +# dict for spectrum_filter, function find_peaks find_peaks: + # signal_characteristics: 256ns/sample, duration 50µs ( ~200 samples) sample_time_ns: *sample_time_ns analogue_offset: *analogue_offset number_of_samples: *number_of_samples pre_trigger_samples: *pre_trigger_samples - peak_minimal_prominence: 50 # has to be positive and higher than avg. noise peaks to not cause havoc! + peak_minimal_prominence: 200 # has to be positive and higher than avg. noise peaks to not cause havoc! trigger_channel: *trigger_channel - peak_minimal_distance: 10 # minimal distance between two peaks in number of samples - peak_minimal_width: 7 # in number of samples + peak_minimal_distance: 400 # minimal distance between two peaks in number of samples + peak_minimal_width: 100 # in number of samples trigger_channel: *trigger_channel - trigger_position_tolerance: 7 # in number of samples + trigger_position_tolerance: 20 # in number of samples -# dict for RedPitaya redPoscidaq +# dict for RedPitaya redPoscdaq redP_to_rb: ip_address: '192.168.0.103' eventcount: *number_of_events @@ -32,10 +38,11 @@ redP_to_rb: pre_trigger_samples: *pre_trigger_samples trigger_channel: *trigger_channel trigger_level: *trigger_level - trigger_mode: 'norm' - decimation_index: 0 - invert_channel1: 0 - invert_channel2: 0 + trigger_mode: "norm" # or "auto" + # special settings for RedPitaya + decimation_index: *decimation + invert_channel1: *invert1 + invert_channel2: *invert2 # Dict for simul_source.py simul_source: @@ -79,5 +86,5 @@ plot_histograms: # define histograms histograms: # name min max nbins ymax name lin/log - chA_height: [50., 3000., 250, 5.9, "ph 1A", 0] - chB_height: [50., 3000., 250, 5.9, "ph 1B", 0] + ch1_height: [50., 3000., 250, 20., "ph 1A", 0] + ch2_height: [50., 3000., 250, 20., "ph 1B", 0] diff --git a/modules/spectrum_filter.py b/modules/spectrum_filter.py index fc80228..aaa9962 100644 --- a/modules/spectrum_filter.py +++ b/modules/spectrum_filter.py @@ -53,7 +53,8 @@ def find_peaks(source_list=None, sink_list=None, observe_list=None, config_dict= peak_minimal_width = config_dict["peak_minimal_width"] pre_trigger_samples = config_dict["pre_trigger_samples"] trigger_channel = config_dict["trigger_channel"] - if trigger_channel not in ['A','B','C','D']: +# if trigger_channel not in ['A','B','C','D']: + if trigger_channel not in ['1','2']: trigger_channel = None trigger_position_tolerance = config_dict["trigger_position_tolerance"] diff --git a/redPoscdaq.py b/redPoscdaq.py index b8d7298..7d56c53 100755 --- a/redPoscdaq.py +++ b/redPoscdaq.py @@ -103,7 +103,7 @@ class rpControl(QMainWindow, Ui_MCPHA): """ Args: - callback: function receiving recorded waveforms + callback: function receiving recorded waveforms conf_dict: a configuration dictionary """ super(rpControl, self).__init__() @@ -190,12 +190,12 @@ class rpControl(QMainWindow, Ui_MCPHA): self.pretrigger_fraction = 0.05 if "pre_trigger_samples" not in self.confd \ else self.confd["pre_trigger_samples"]/self.sample_size self.trigger_mode = 0 if "trigger_mode" not in self.confd \ - else 1 if self.confd["trigger_mode"] == "auto" else 0 + else 1 if self.confd["trigger_mode"] == "auto" or self.confd["trigger_mode"] == 1 else 0 self.trigger_source = 0 if "trigger_channel" not in self.confd \ else int(self.confd["trigger_channel"])-1 self.trigger_level = 500 if "trigger_level" not in self.confd else self.confd["trigger_level"] self.trigger_slope = 0 if "trigger_direction" not in self.confd else\ - 0 if self.confd["trigger_direction"] == "rising" else 1 + 0 if self.confd["trigger_direction"]=="rising" or self.confd["trigger_direction"]=="1" else 1 self.decimation_index = 1 if "decimation_index" not in self.confd else \ self.confd["decimation_index"] self.invert1 = 0 if "invert_channel1" not in self.confd else self.confd["invert_channel1"] diff --git a/setup.yaml b/setup.yaml index a079387..a4c5088 100644 --- a/setup.yaml +++ b/setup.yaml @@ -24,22 +24,22 @@ RingBuffer: - RB_1: # raw input data buffer (from picoScope, file or simulation) number_of_slots: 16 - channel_per_slot: 2048 + channel_per_slot: 1000 data_type: - 1: ['chA', "float32"] - 2: ['chB', "float32"] + 1: ['ch1', "float32"] + 2: ['ch2', "float32"] - RB_2: # buffer with correct signature double pulse parameters number_of_slots: 16 channel_per_slot: 1 data_type: data_type: - 1: ['chA_height', "float32"] - 2: ['chA_position', "int32"] - 3: ['chA_integral', "float32"] - 4: ['chB_height', "float32"] - 5: ['chB_position', "int32"] - 6: ['chB_integral', "float32"] + 1: ['ch1_height', "float32"] + 2: ['ch1_position', "int32"] + 3: ['ch1_integral', "float32"] + 4: ['ch2_height', "float32"] + 5: ['ch2_position', "int32"] + 6: ['ch2_integral', "float32"] Functions: # define functions and ringbuffer assignment -- GitLab