diff --git a/redPoscdaq.py b/redPoscdaq.py index 7d56c5307a052b49540af3537f5dc6ab4b33527f..a5155e1b9f03076c3fe87a03c63080243a495d74 100755 --- a/redPoscdaq.py +++ b/redPoscdaq.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 -"""rpPoscdaq: fast data acquistion using the oscilloscope client of the MCPHA +"""redPoscdaq: fast data acquistion using the oscilloscope client of the MCPHA application running on a RedPitaya FPGA board - When the network connection is established, the oscilloscope window - is activated in data-acquisition mode, i.e. restarted continously. - - Optionally, triggered waveforms can be stored a file. + Contains a button to run the oscilloscope in daq mode, i.e. it is restarted + continously. If defined, data is eported to a callback function. A callback + class redP_mimocorb() implements an interface to the daq rinbuffer mimoCoRB. + Optionally, triggered waveforms can be stored a numpy binary file + (.npy format). Code derived from mcpha.py by Pavel Demin @@ -13,6 +14,8 @@ https://github.com/pavel-demin/red-pitaya-notes/releases/tag/20240204 """ +script_name = 'redPoscidaq.py' + # Communication with server process is achieved via command codes: # command(code, number, data) # number typically is channel number # @@ -49,10 +52,13 @@ import matplotlib from matplotlib.figure import Figure from multiprocessing import Event -from npy_append_array import NpyAppendArray - from mimocorb.buffer_control import rbPut +# !!! for conditional import from npy_append_array !!! +def import_npy_append_array(): + global NpyAppendArray + from npy_append_array import NpyAppendArray + from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar @@ -115,7 +121,7 @@ class rpControl(QMainWindow, Ui_MCPHA): self.confd = {} if conf_dict is None else conf_dict self.parse_confd() # get configuration from command line - if conf_dict is None: + if os.path.split(sys.argv[0])[1]=='redPoscdaq.py': self.parse_args() self.callback = True if callback is not None else False @@ -239,6 +245,8 @@ class rpControl(QMainWindow, Ui_MCPHA): self.trigger_slope = 0 if args.trigger_slope == 'rising' else 1 # other parameters self.filename = args.file + if self.filename: + import_npy_append_array() def get_physical_units(self):