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
47a507ab
Commit
47a507ab
authored
Mar 28, 2014
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test39: Set and test real hardware variable saturation.
parent
04236759
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
6 deletions
+39
-6
test39.py
test/fmcadc100m14b4cha/python/test39.py
+39
-6
No files found.
test/fmcadc100m14b4cha/python/test39.py
View file @
47a507ab
...
...
@@ -145,11 +145,14 @@ def plot_channel(ncal_ch_data, cal_ch_data, scal_ch_data, ncal_ch_mean, cal_ch_m
plot
(
sample
,
[
scal_ch_mean
]
*
len
(
sample
),
'm--'
,
label
=
'Corrected & saturated middle'
)
plot
(
sample
,
[
sat
]
*
len
(
sample
),
'm'
)
plot
(
sample
,
[
-
sat
]
*
len
(
sample
),
'm'
)
plot
(
sample
,
[
32764
]
*
len
(
sample
),
'
r
'
)
plot
(
sample
,
[
-
32765
]
*
len
(
sample
),
'
r
'
)
plot
(
sample
,
[
32764
]
*
len
(
sample
),
'
g
'
)
plot
(
sample
,
[
-
32765
]
*
len
(
sample
),
'
g
'
)
ylim
(
-
ylimit
-
(
ylimit
/
10.0
),
ylimit
+
(
ylimit
/
10.0
))
grid
(
color
=
'k'
,
linestyle
=
':'
,
linewidth
=
1
)
legend
(
loc
=
'upper left'
)
xlabel
(
'Samples'
)
ylabel
(
'Raw ADC values (two
\'
s complement)'
)
title
(
'Variable saturation, limit:
%
d'
%
sat
)
#draw()
show
()
return
0
...
...
@@ -247,8 +250,8 @@ def main (default_directory='.'):
# Set awg sine params to make adc saturate
##################################################
sine
.
frequency
=
1E6
sine
.
amplitude
=
1.2
*
ADC_FS
[
IN_RANGE
]
sine
.
dc
=
0
sine
.
amplitude
=
0.5
*
ADC_FS
[
IN_RANGE
]
sine
.
dc
=
0
#ADC_FS[IN_RANGE]/4.0
print
"
\n
Sine frequency:
%3.3
fMHz amplitude:
%2.3
fVp offset:
%2.3
fV"
%
(
sine
.
frequency
/
1E6
,
sine
.
amplitude
,
sine
.
dc
)
# Set AWG
...
...
@@ -261,7 +264,7 @@ def main (default_directory='.'):
##################################################
# Acquire channel 1
and print
# Acquire channel 1
##################################################
print
"
\n
Acquiring channel 1"
# Configure analogue input
...
...
@@ -395,7 +398,7 @@ def main (default_directory='.'):
get_corr_values
(
fmc
)
##################################################
# Acquire channel 1
and print
# Acquire channel 1
##################################################
print
"
\n
Acquiring channel 1"
# Perform an acquisition
...
...
@@ -413,6 +416,35 @@ def main (default_directory='.'):
cal_ch_mean
=
ch_mid
cal_ch_data
=
channel_data
##################################################
# Set saturation
##################################################
sat_thres
=
10000
fmc
.
fmc_adc_csr
.
set_field
(
'CH1_SAT'
,
'VAL'
,
sat_thres
)
fmc
.
fmc_adc_csr
.
set_field
(
'CH2_SAT'
,
'VAL'
,
sat_thres
)
fmc
.
fmc_adc_csr
.
set_field
(
'CH3_SAT'
,
'VAL'
,
sat_thres
)
fmc
.
fmc_adc_csr
.
set_field
(
'CH4_SAT'
,
'VAL'
,
sat_thres
)
##################################################
# Acquire channel 1
##################################################
print
"
\n
Acquiring channel 1"
# Perform an acquisition
acq_data
,
trig_timetag
=
acq_channels
(
fmc
,
carrier
,
ADC_FS
[
IN_RANGE
],
ACQ_PAUSE
)
channel_data
=
acq_data
[
0
::
4
]
print
(
"Number of samples:
%
d"
%
(
len
(
channel_data
)))
# Calculate middle value
ch_max
=
max
(
channel_data
)
ch_min
=
min
(
channel_data
)
ch_mid
=
(
abs
(
ch_max
)
-
abs
(
ch_min
))
ch_mean
=
mean
(
channel_data
)
print
(
"Channel max=
%
d, min=
%
d, mid=
%
d, mean=
%
d"
%
(
ch_max
,
ch_min
,
ch_mid
,
ch_mean
))
sat_cal_ch_mean
=
ch_mid
sat_cal_ch_data
=
channel_data
"""
##################################################
# Artificially saturate corrected data
##################################################
...
...
@@ -432,6 +464,7 @@ def main (default_directory='.'):
ch_mean = mean(sat_cal_ch_data)
sat_cal_ch_mean = ch_mid
"""
##################################################
# Plot channel
...
...
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