Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
FMC ADC 100M 14b 4cha - Testing
Commits
768724ee
Commit
768724ee
authored
Feb 27, 2013
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test19: add ploting feature for debug.
parent
391f4a18
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
21 deletions
+41
-21
test19.py
test/fmcadc100m14b4cha/python/test19.py
+41
-21
No files found.
test/fmcadc100m14b4cha/python/test19.py
View file @
768724ee
...
...
@@ -136,6 +136,40 @@ def volt2digital_without_offset(value, full_scale, nb_bit):
#print('volt2digital: %2.9f > %2.9f')%(value,digital)
return
int
(
digital
)
# Plot data from all channels
def
plot_all
(
data
,
mean
,
ylimit
):
sample
=
arange
(
len
(
data
)
/
4
)
clf
()
plot
(
sample
,
data
[
0
::
4
],
'b'
,
label
=
'Channel 1'
)
plot
(
sample
,
data
[
1
::
4
],
'g'
,
label
=
'Channel 2'
)
plot
(
sample
,
data
[
2
::
4
],
'c'
,
label
=
'Channel 3'
)
plot
(
sample
,
data
[
3
::
4
],
'm'
,
label
=
'Channel 4'
)
plot
(
sample
,
[
mean
[
0
]]
*
len
(
sample
),
'r'
)
plot
(
sample
,
[
mean
[
1
]]
*
len
(
sample
),
'r'
)
plot
(
sample
,
[
mean
[
2
]]
*
len
(
sample
),
'r'
)
plot
(
sample
,
[
mean
[
3
]]
*
len
(
sample
),
'r'
)
ylim
(
-
ylimit
-
(
ylimit
/
10.0
),
ylimit
+
(
ylimit
/
10.0
))
grid
(
which
=
'both'
)
legend
()
draw
()
show
()
return
0
# Plot data from all channels
def
plot_channel
(
ch
,
data
,
mean
,
ylimit
):
print
(
"nb of samples to plot:
%
d"
%
len
(
data
))
sample
=
arange
(
len
(
data
))
lbl
=
"Channel
%
d"
%
ch
clf
()
plot
(
sample
,
data
,
'b'
,
label
=
lbl
)
plot
(
sample
,
[
mean
]
*
len
(
sample
),
'r'
)
ylim
(
-
ylimit
-
(
ylimit
/
10.0
),
ylimit
+
(
ylimit
/
10.0
))
grid
(
which
=
'both'
)
legend
()
draw
()
show
()
return
0
# Make an acquisition of a channel
def
acq_channel
(
carrier
,
fmc
,
ch
,
adc_fs
,
adc_nbits
=
16
,
pause
=
0.01
):
# Make sure no acquisition is running
...
...
@@ -165,27 +199,10 @@ def acq_channel(carrier, fmc, ch, adc_fs, adc_nbits=16, pause=0.01):
carrier
.
set_irq_en_mask
(
0x0
)
channels_data
=
[
hex2signed
(
item
)
for
item
in
channels_data
]
channels_data
=
[
digital2volt
(
item
,
adc_fs
,
adc_nbits
)
for
item
in
channels_data
]
#plot_all(channels_data, [mean(channels_data[0::4]),mean(channels_data[1::4]),mean(channels_data[2::4]),mean(channels_data[3::4])], 0.1)
#raw_input("press enter")
channel_data
=
channels_data
[
ch
-
1
::
4
]
return
mean
(
channel_data
)
# Plot data from all channels
def
plot_all
(
data
,
mean
,
ylimit
):
sample
=
arange
(
len
(
data
)
/
4
)
clf
()
plot
(
sample
,
data
[
0
::
4
],
'b'
,
label
=
'Channel 1'
)
plot
(
sample
,
data
[
1
::
4
],
'g'
,
label
=
'Channel 2'
)
plot
(
sample
,
data
[
2
::
4
],
'c'
,
label
=
'Channel 3'
)
plot
(
sample
,
data
[
3
::
4
],
'm'
,
label
=
'Channel 4'
)
plot
(
sample
,
[
mean
[
0
]]
*
len
(
sample
),
'r'
)
plot
(
sample
,
[
mean
[
1
]]
*
len
(
sample
),
'r'
)
plot
(
sample
,
[
mean
[
2
]]
*
len
(
sample
),
'r'
)
plot
(
sample
,
[
mean
[
3
]]
*
len
(
sample
),
'r'
)
ylim
(
-
ylimit
-
(
ylimit
/
10.0
),
ylimit
+
(
ylimit
/
10.0
))
grid
(
which
=
'both'
)
legend
()
draw
()
show
()
return
0
return
channel_data
# Set channel offset with the DAC
def
set_offset_dac
(
fmc
,
channel
,
offset_volt
,
dac_fs
=
10.0
,
dac_nbits
=
16
,
dac_corr_flag
=
False
):
...
...
@@ -228,7 +245,10 @@ def make_meas(carrier, fmc, box, dac_value, in_value, in_range, adc_fs, repeat):
# Perform an acquisition
meas
=
[]
for
i
in
range
(
repeat
):
meas
.
append
(
acq_channel
(
carrier
,
fmc
,
ch
,
adc_fs
))
data
=
acq_channel
(
carrier
,
fmc
,
ch
,
adc_fs
)
#plot_channel(ch, data, mean(data), adc_fs)
#raw_input("press enter")
meas
.
append
(
mean
(
data
))
# Calculate mean and delta of acquisitions
ch_meas
.
append
(
mean
(
meas
))
ch_diff
.
append
(
max
(
meas
)
-
min
(
meas
))
...
...
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