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
10a5112c
Commit
10a5112c
authored
9 months ago
by
Guenter Quast
Browse files
Options
Downloads
Patches
Plain Diff
streamlining of code in redP_mimocorb.py, fixed docu
parent
bc9f81b2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
redP_mimoCoRB.py
+21
-39
21 additions, 39 deletions
redP_mimoCoRB.py
redPoscdaq.py
+4
-6
4 additions, 6 deletions
redPoscdaq.py
setup.yaml
+2
-2
2 additions, 2 deletions
setup.yaml
with
27 additions
and
47 deletions
redP_mimoCoRB.py
+
21
−
39
View file @
10a5112c
...
...
@@ -7,66 +7,48 @@ via callback of function data_sink() in class redP_mimoCoRB.
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
"""
Interface
for redPoscdaq.py
to the daq rinbuffer 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
.
rb_exporter
=
rbPut
(
config_dict
=
config_dict
,
sink_list
=
sink_list
,
**
rb_info
)
self
.
number_of_channels
=
len
(
self
.
rb_exporter
.
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
):
def
__call__
(
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
# deliver pulse data and no metadata
active
=
self
.
rb_exporter
(
data
,
None
)
# send data
self
.
event_count
+=
1
else
:
active
=
self
.
action
(
None
,
None
)
# send None
to signal end
print
(
"
redPoscdaq exiting
"
)
sys
.
exit
()
active
=
self
.
rb_exporter
(
None
,
None
)
# send None
when done
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
The class mimocorb.buffer_control/rbImport is used to interface to the
newBuffer and Writer classes of the package mimoCoRB.mimo_buffer
This example may serve as a template for other data sources
:param config_dict: configuration dictionary
- events_required: number of events to taken
- number_of_samples, sample_time_ns, pretrigger_samples and analogue_offset
- decimation index, invert fags, trigger mode and trigger direction for RedPitaya
"""
Main function,
executed as a multiprocessing Process, to pass data from RedPitaya to a mimoCoRB buffer
:param config_dict: configuration dictionary
- events_required: number of events to be taken
- number_of_samples, sample_time_ns, pretrigger_samples and analogue_offset
- decimation index, invert flags, trigger mode and trigger direction for RedPitaya
"""
# initialize mimocorb class
inside redPoscidaq
data
source
=
redP_mimocorb
(
config_dict
=
config_dict
,
sink_list
=
sink_list
,
**
rb_info
)
# initialize mimocorb class
rb_
source
=
redP_mimocorb
(
config_dict
=
config_dict
,
sink_list
=
sink_list
,
**
rb_info
)
#print("data source initialized")
# start oscilloscope
# start oscilloscope
in callback mode
#print("starting osci")
rp
.
run_rpControl
(
callback
=
datasource
.
data_sink
,
conf_dict
=
config_dict
)
rp
.
run_rpControl
(
callback
=
rb_source
,
conf_dict
=
config_dict
)
#daq = run_mimoDAQ('redP_mimoCoRB.yaml')
#daq.setup()
#RB_1 = daq.ringbuffers['RB_1']
#sink_dict = RB_1.new_writer()
#datasource= rp.redP_mimocorb(config_dict={}, sink_list=[sink_dict], RB_1='write')
#print("data source initialized")
#rp.run_rpControl(callback=datasource.data_sink)
#print("starting DAQ")
#daq.run()
This diff is collapsed.
Click to expand it.
redPoscdaq.py
+
4
−
6
View file @
10a5112c
...
...
@@ -3,13 +3,11 @@
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 exported via calling a callback function.
Optionally, triggered waveforms can be stored a numpy binary file
(.npy format).
continously. Triggered wave forms can be exported via calling a callback
function stored in a numpy binary file in .npy format.
Code derived from mcpha.py by Pavel Demin
This code is compatible with release 20240204 of the alpine linux image
This code is derived from mcpha.py by Pavel Demin and
compatible with release 20240204 of the alpine linux image
https://github.com/pavel-demin/red-pitaya-notes/releases/tag/20240204
"""
...
...
This diff is collapsed.
Click to expand it.
setup.yaml
+
2
−
2
View file @
10a5112c
...
...
@@ -23,14 +23,14 @@ RingBuffer:
# define ring buffers
-
RB_1
:
# raw input data buffer (from picoScope, file or simulation)
number_of_slots
:
1
6
number_of_slots
:
1
00
channel_per_slot
:
1000
data_type
:
1
:
[
'
ch1'
,
"
float32"
]
2
:
[
'
ch2'
,
"
float32"
]
-
RB_2
:
# buffer with correct signature double pulse parameters
number_of_slots
:
1
6
number_of_slots
:
1
00
channel_per_slot
:
1
data_type
:
data_type
:
...
...
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