From e63477569343a87cb248ae7ab945496cd76ea468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Quast?= <guenter.quast@online.de> Date: Thu, 20 Jun 2024 13:33:10 +0200 Subject: [PATCH] got rid of run_daq.py, now contained in redP_mimoCoRB.py --- README.md | 11 ++++++----- redP_mimoCoRB.py | 37 ++++++++++++++++++++++++++++++------- run_daq.py | 31 ------------------------------- 3 files changed, 36 insertions(+), 43 deletions(-) mode change 100644 => 100755 redP_mimoCoRB.py delete mode 100755 run_daq.py diff --git a/README.md b/README.md index 81d05da..5b18709 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,6 @@ the faculty of physics at Karlsruhe Institute of Technology. - *examples/peakFitter.py* code to find and fit peaks in spectum data - *read_npy.py* a simple example to read waveforms saved in *.npy* format - *redP_mimocorb.py* runs *redPdaq* as a client of the buffer manager *mimoCoRB* - - *run_daq.py* script to strat the *mimoCoRB* application - *setup.yaml* coniguration script defining the *mimoCoRB* application - *modules/* and *config/* contain code and configuration files for the *redP_mimoCoRB* application - *mcpha.ui* qt5 graphical user interface for *mcpha* application @@ -125,11 +124,13 @@ An examples of call-back functions callable from within redPdaq is provided with calculates and displays statistics on trigger rate and data volume -*redP_mimocorb.py* is script called as sub-process within the *mimiCoRB* frame-work +*redP_mimocorb.py* is script containing code to be started from the command line and +a function, *redP_to_rb* called as sub-process within the *mimiCoRB* frame-work for more advanced data analysis tasks requiring multiple processes running in parallel. -A *mimoCoRB* setup-file is also provided and can be started by *./run_daq setup.yaml*; -modules and configuration files for a pulse-height analysis of recorded signals are -contained in the subdirectories *modules/* and *config/*, respectively. +A *mimoCoRB* setup-file is also provided and can be started by running +typing `redP_mimoCoRB.py setup.yaml` on the command line. Modules and configuration +files for a pulse-height analysis of recorded signals are contained as exampless +in the sub-directories *modules/* and *config/*, respectively. ## Installation diff --git a/redP_mimoCoRB.py b/redP_mimoCoRB.py old mode 100644 new mode 100755 index 6b776d0..36f7f12 --- a/redP_mimoCoRB.py +++ b/redP_mimoCoRB.py @@ -5,18 +5,18 @@ Input data is provided as numpy-arry of shape (number_of_channels, number_of_sam via callback of the __call__() function in class redP_mimoCoRB. This script depends on redPdaq.py and is started as a sup-process within the mimoCoRB -framework. The detailes set-up of ring buffers and the associated funtions is specified -in a configuration file in *.yaml* format. The process suite is started using the script -start-up script from the *mimiCoRB* package, *run_daq.py*, a copy of which is provided -as part of this package. +framework. The detailed set-up of ring buffers and the associated funtions is specified +in a configuration file, *setup.yaml*. The process suite is started by running this +script from the command line, possibly specifying the name of the configutation file +as an argument. As a demonstration, a configuration *setup.yaml* is contained in this package to import waveforms from the RedPitaya, display a sub-set of the waveforms and perform a pulse-height analysis with updating results shown as histograms. To run this example, connect the out1 of the RedPitaya to one or both of the inputs, -type "./run_daq.py* and use the graphical interface to connect the RedPitaya to the -network, start the pulse generator, and finally press the *StartDAQ" button in the -oscilloscope tag to start data transfer to the *mimiCoRB* input buffer. +type "./redP_mimoCoRB.py* to run the example and use the graphical interface to connect +the RedPitaya to the network, start the pulse generator, and finally press the *StartDAQ" +button in the oscilloscope tag to start data transfer to the *mimiCoRB* input buffer. Stop data taking with the button "End run" in the *mimoCoRB* conotrol window to cleanly shut down all processes. @@ -73,3 +73,26 @@ def redP_to_rb(source_list=None, sink_list=None, observe_list=None, config_dict= #print("starting osci") rp.run_rpControl(callback=rb_source, conf_dict=config_dict) +if __name__ == "__main__": # -------------------------------------- +#run mimoCoRB data acquisition suite + # the code below is idenical to the mimoCoRB script run_daq.py + import argparse + import sys, time + from mimocorb.buffer_control import run_mimoDAQ + + # define command line arguments ... + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('filename', nargs='?', default = "setup.yaml", + help = "configuration file") + parser.add_argument('-v','--verbose', type=int, default=2, + help="verbosity level (2)") + parser.add_argument('-d','--debug', action='store_true', + help="switch on debug mode (False)") + # ... and parse command line input + args = parser.parse_args() + + print("\n*==* script " + sys.argv[0] + " running \n") + daq = run_mimoDAQ(args.filename, verbose=args.verbose, debug=args.debug) + daq.setup() + daq.run() + print("\n*==* script " + sys.argv[0] + " finished " + time.asctime() + "\n") diff --git a/run_daq.py b/run_daq.py deleted file mode 100755 index c5a2c3b..0000000 --- a/run_daq.py +++ /dev/null @@ -1,31 +0,0 @@ -#! /usr/bin/env python3 -""" -run mimoCoRB data acquisition suite -""" - -import argparse -import sys, time -from mimocorb.buffer_control import run_mimoDAQ - -# define command line arguments ... -parser = argparse.ArgumentParser(description=__doc__) -parser.add_argument('filename', nargs='?', default = "setup.yaml", - help = "configuration file") -parser.add_argument('-v','--verbose', type=int, default=2, - help="verbosity level (2)") -parser.add_argument('-d','--debug', action='store_true', - help="switch on debug mode (False)") -# ... and parse command line input -args = parser.parse_args() - -print("\n*==* script " + sys.argv[0] + " running \n") -daq = run_mimoDAQ(args.filename, verbose=args.verbose, debug=args.debug) - -daq.setup() - -daq.run() - -# wait for user confirmation (useful if started via GUI) -# input(30*' '+'Finished, good bye ! Type <ret> to exit -> ') - -print("\n*==* script " + sys.argv[0] + " finished " + time.asctime() + "\n") -- GitLab