Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Production Test Suite
Commits
85096b1a
Commit
85096b1a
authored
Jul 24, 2013
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
svec_test12: Use acquisition methods from fmc_adc class.
parent
8cf7047d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
64 deletions
+5
-64
svec_test12.py
test/fmcadc100m14b4cha/python/svec_test12.py
+5
-64
No files found.
test/fmcadc100m14b4cha/python/svec_test12.py
View file @
85096b1a
...
...
@@ -29,7 +29,7 @@ from numpy import *
"""
svec_test12: Takes an aqcuisition of all channels and print it to a file
Set UTC and read UTC time-tags
Set UTC and read UTC time-tags
Note: Requires svec_test00.py to run first to load the firmware!
"""
...
...
@@ -50,66 +50,6 @@ NB_SHOTS = 1
ACQ_LENGTH
=
10000
# in samples
def
open_all_channels
(
fmc
):
for
i
in
range
(
1
,
NB_CHANNELS
+
1
):
fmc
.
set_input_range
(
i
,
'OPEN'
)
time
.
sleep
(
SSR_SET_SLEEP
)
def
fmc_adc_init
(
bus
,
fmc
):
print
"Initialise FMC board.
\n
"
# Reset offset DACs
fmc
.
dc_offset_reset
()
# Make sure all switches are OFF
open_all_channels
(
fmc
)
# Set software trigger
fmc
.
set_soft_trig
()
# Set acquisition
fmc
.
set_pre_trig_samples
(
PRE_TRIG_SAMPLES
)
fmc
.
set_post_trig_samples
(
POST_TRIG_SAMPLES
)
fmc
.
set_shots
(
NB_SHOTS
)
# Converts two's complement hex to signed
def
hex2signed
(
value
):
if
(
value
&
0x8000
):
return
-
((
~
value
&
0xFFFF
)
+
1
)
else
:
return
value
# Converts digital value to volts
def
digital2volt
(
value
,
full_scale
,
nb_bit
):
return
float
(
value
)
*
float
(
full_scale
)
/
2
**
nb_bit
def
acq_channels
(
fmc
,
carrier
,
adc_fs
,
pause
):
# Make sure no acquisition is running
fmc
.
stop_acq
()
time
.
sleep
(
pause
)
# Start acquisition
fmc
.
start_acq
()
time
.
sleep
(
pause
)
# Trigger
fmc
.
sw_trig
()
# Wait end of acquisition
timeout
=
0
while
(
'IDLE'
!=
fmc
.
get_acq_fsm_state
()):
time
.
sleep
(
.1
)
timeout
+=
1
if
(
ACQ_TIMEOUT
<
timeout
):
print
"Acquisition timeout. Missing trigger?."
print
"Acq FSm state:
%
s"
%
fmc
.
get_acq_fsm_state
()
return
1
# Retrieve data trough DMA
trig_pos
=
fmc
.
get_trig_pos
()
# Read ACQ_LENGTH samples after the trigger for all channels
print
(
'Getting data from DDR...'
)
channels_data
=
fmc
.
get_data
((
trig_pos
<<
3
),
ACQ_LENGTH
*
8
)
#print [hex(val) for val in channels_data[0::4][:10]]
channels_data
=
[
hex2signed
(
item
)
for
item
in
channels_data
]
#print [hex(val) for val in channels_data[0::4][:10]]
channels_data
=
[
digital2volt
(
item
,
adc_fs
,
16
)
for
item
in
channels_data
]
#print channels_data[0::4][:10]
return
channels_data
def
main
(
default_directory
=
'.'
):
# Constants declaration
...
...
@@ -164,7 +104,8 @@ def main (default_directory='.'):
print
(
'[FMC slot
%
d]'
%
(
i
+
1
))
# Initialise fmc adc
fmc_adc_init
(
bus
,
fmc
[
i
])
#fmc_adc_init(bus, fmc[i])
fmc
[
i
]
.
acq_init
(
PRE_TRIG_SAMPLES
,
POST_TRIG_SAMPLES
,
NB_SHOTS
)
# Use test data instead of data from ADC
# fmc.test_data_en()
...
...
@@ -204,7 +145,7 @@ def main (default_directory='.'):
# Perform an acquisition
print
"
\n
Acquiring channels"
acq_data
=
acq_channels
(
fmc
[
i
],
carrier
,
ADC_FS
[
IN_RANGE
]
,
ACQ_PAUSE
)
acq_data
=
fmc
[
i
]
.
acq_channels
(
'svec'
,
carrier
,
ADC_FS
[
IN_RANGE
],
ACQ_LENGTH
,
ACQ_PAUSE
)
for
ch
in
range
(
NB_CHANNELS
):
channels_data
[
ch
]
=
acq_data
[
ch
::
4
]
# Get time-tags
...
...
@@ -225,7 +166,7 @@ def main (default_directory='.'):
ch_mean
.
append
(
mean
(
channels_data
[
ch
]))
# Make sure all switches are OFF
open_all_channels
(
fmc
[
i
]
)
fmc
[
i
]
.
open_all_channels
(
)
fmc_channels
[
i
]
=
channels_data
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment