Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
redpitaya-MCPHA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Günter Quast
redpitaya-MCPHA
Commits
f0be7835
Commit
f0be7835
authored
9 months ago
by
Günter Quast
Browse files
Options
Downloads
Patches
Plain Diff
moved mimoCoRB callback function redP_mimoCoRB.py
parent
6ab8b7eb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
redP_mimoCoRB.py
+27
-2
27 additions, 2 deletions
redP_mimoCoRB.py
redPoscdaq.py
+1
-36
1 addition, 36 deletions
redPoscdaq.py
with
28 additions
and
38 deletions
redP_mimoCoRB.py
+
27
−
2
View file @
f0be7835
"""
**redP_mimoCoRB**:
a simple template to
use mimoCoRB with the RedPitaya and redPoscdaq.py
**redP_mimoCoRB**: use mimoCoRB with the RedPitaya and redPoscdaq.py
Input data is provided as numpy-arry of shape (number_of_channels, number_of_samples).
"""
...
...
@@ -8,8 +8,33 @@ import time
import
sys
import
redPoscdaq
as
rp
from
mimocorb.buffer_control
import
rbPut
class
redP_mimocorb
():
"""
Interface to the daq rinbuffer mimoCoRB for redPoscdaq
"""
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
"""
if
(
self
.
events_required
==
0
or
self
.
event_count
<
self
.
events_required
)
and
self
.
active
:
# deliver pulse data and no metadata
active
=
self
.
action
(
data
,
None
)
# send data
self
.
event_count
+=
1
else
:
active
=
self
.
action
(
None
,
None
)
# send None to signal end
print
(
"
redPoscdaq exiting
"
)
sys
.
exit
()
def
redP_to_rb
(
source_list
=
None
,
sink_list
=
None
,
observe_list
=
None
,
config_dict
=
None
,
**
rb_info
):
"""
Get data from RedPitaya and pass data to buffer
...
...
@@ -27,7 +52,7 @@ def redP_to_rb(source_list=None, sink_list=None, observe_list=None, config_dict=
"""
# initialize mimocorb class inside redPoscidaq
datasource
=
rp
.
redP_mimocorb
(
config_dict
=
config_dict
,
sink_list
=
sink_list
,
**
rb_info
)
datasource
=
redP_mimocorb
(
config_dict
=
config_dict
,
sink_list
=
sink_list
,
**
rb_info
)
#print("data source initialized")
# start oscilloscope
...
...
This diff is collapsed.
Click to expand it.
redPoscdaq.py
+
1
−
36
View file @
f0be7835
...
...
@@ -3,8 +3,7 @@
application running on a RedPitaya FPGA board
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.
continously. If defined, data is exported via calling a callback function.
Optionally, triggered waveforms can be stored a numpy binary file
(.npy format).
...
...
@@ -52,11 +51,6 @@ import matplotlib
from
matplotlib.figure
import
Figure
from
multiprocessing
import
Event
# !!! for conditional import from npy_append_array !!!
def
import_mimocorb
():
global
rbPut
from
mimocorb.buffer_control
import
rbPut
# !!! for conditional import from npy_append_array !!!
def
import_npy_append_array
():
global
NpyAppendArray
...
...
@@ -897,36 +891,7 @@ 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
'
)
class
redP_mimocorb
():
def
__init__
(
self
,
source_list
=
None
,
sink_list
=
None
,
observe_list
=
None
,
config_dict
=
None
,
**
rb_info
):
# import rbPut() from mimoCoRB
import_mimocorb
()
# 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
"""
if
(
self
.
events_required
==
0
or
self
.
event_count
<
self
.
events_required
)
and
self
.
active
:
# deliver pulse data and no metadata
active
=
self
.
action
(
data
,
None
)
# send data
self
.
event_count
+=
1
else
:
active
=
self
.
action
(
None
,
None
)
# send None to signal end
print
(
"
redPoscdaq exiting
"
)
sys
.
exit
()
def
run_rpControl
(
callback
=
None
,
conf_dict
=
None
):
if
conf_dict
is
not
None
:
# need module rbPut() from mimoCoRB, import here
import_mimocorb
()
# start redPidaya GUI under Qt5
app
=
QApplication
(
sys
.
argv
)
dpi
=
app
.
primaryScreen
().
logicalDotsPerInch
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment