Skip to content
Snippets Groups Projects
Commit aee174a7 authored by Guenter Quast's avatar Guenter Quast
Browse files

added initial verson of a mimoCoRB client (not working yet ...)

parent d50ef540
No related branches found
No related tags found
No related merge requests found
......@@ -95,7 +95,7 @@ class rpControl(QMainWindow, Ui_MCPHA):
"""
Args:
interactive: if True run in interactive mode, else run as mimoCoRB client
callback: function receiving recorded waveforms
"""
super(rpControl, self).__init__()
self.callback_function = callback
......@@ -175,7 +175,7 @@ class rpControl(QMainWindow, Ui_MCPHA):
help='trigger channel')
parser.add_argument('--trigger_mode', type=str, choices={'norm','auto'}, default='norm',
help='trigger mode')
parser.add_argument('-s', '--sample_size', type=int, default=4096,
parser.add_argument('-s', '--sample_size', type=int, default=2048,
help='size of waveform sample')
parser.add_argument('-p', '--pretrigger_fraction', type=float, default=0.05,
help='pretrigger fraction')
......@@ -643,13 +643,6 @@ class OscDAQ(QWidget, Ui_OscDisplay):
self.ax.set_xlabel("sample number " + self.xunit)
self.canvas.draw()
def yield_data(self):
""" for mimoCoRB interface:
data as a numpy array of shape (n_channels, n_samples_per_channel)
"""
yield (self.data, None)
def update_osci_display(self):
self.curve1.set_ydata(self.buffer[0::2])
self.curve2.set_ydata(self.buffer[1::2])
......@@ -851,7 +844,27 @@ class redP_consumer():
status_txt = "active: {:.1f}s trigger rate: {:.2f} Hz, data rate: {:.4g} MB/s".format(T_active, r, r*l_tot*4e-6)
print(status_txt, end='\r')
from mimocorb.buffer_control import rbPut
class redP_mimocorb():
def __init__(self, source_list=None, sink_list=None, observe_list=None, config_dict=None,
**rb_info):
# initialize mimoCoRB interface
self.action = rbPut(config_dict=config_dict, sink_list=sink_list, **rb_info)
self.number_of_channels = len(self.action.sink.dtype)
self.events_required = 1000 if "eventcount" not in config_dict else config_dict["eventcount"]
self.event_count = 0
self.active=True
def data_sink(self, data):
"""function called by redPoscdaq
this simple version calculates statistics only
"""
while (self.events_required == 0 or self.event_count < self.events_required) and self.active:
# deliver pulse data and no metadata
active = self.action(data/5000., None)
self.event_count += 1
def run_rpControl(callback=None):
# start redPidaya GUI under Qt5
app = QApplication(sys.argv)
......@@ -866,4 +879,5 @@ if __name__ == '__main__': # --------------------------------------------
# run_rpControl()
sink = redP_consumer()
print(sys.argv)
run_rpControl(callback=sink.data_sink)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment