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
f7099bb3
Commit
f7099bb3
authored
Jan 26, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plot frequency response in dB.
parent
b8629c15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
36 deletions
+33
-36
test10.py
test/fmcadc100m14b4cha/python/test10.py
+33
-36
No files found.
test/fmcadc100m14b4cha/python/test10.py
View file @
f7099bb3
...
...
@@ -17,53 +17,50 @@ from ptsexcept import *
"""
test10: Plot frequency response summary data from test09
log
file
test10: Plot frequency response summary data from test09
_freq_resp.txt
file
Note: Requires test00.py to run first to load the firmware and
test09.py to generate the
log
file.
test09.py to generate the file.
"""
def
show_result_graph
(
points
,
ch_att
):
pt
=
array
(
points
)
freq
=
pt
[:,
0
]
a_min
=
pt
[:,
1
]
-
pt
[:,
2
]
a_max
=
pt
[:,
1
]
+
pt
[:,
2
]
cutoff
=
[
-
3
]
*
len
(
points
)
semilogx
(
freq
,
ch_att
[
0
],
'b'
,
label
=
'Channel 1'
)
semilogx
(
freq
,
ch_att
[
1
],
'g'
,
label
=
'Channel 2'
)
semilogx
(
freq
,
ch_att
[
2
],
'm'
,
label
=
'Channel 3'
)
semilogx
(
freq
,
ch_att
[
3
],
'c'
,
label
=
'Channel 4'
)
semilogx
(
freq
,
a_min
,
'r:'
)
semilogx
(
freq
,
a_max
,
'r:'
)
semilogx
(
freq
,
cutoff
,
'r'
,
label
=
'-3dB'
)
grid
(
color
=
'k'
,
linestyle
=
'--'
,
linewidth
=
1
)
legend
(
loc
=
'upper left'
)
show
()
return
0
def
main
(
default_directory
=
'.'
):
# open test09 log file in read mode
file_name
=
raw_input
(
'Enter a file name (default=log_test09.txt):'
)
if
file_name
==
""
:
file_name
=
"log_test09.txt"
file
=
open
(
file_name
,
'r+'
)
# Open test09_freq_resp.txt file in read mode
file_name
=
"test09_freq_resp.txt"
f
=
open
(
file_name
,
'r+'
)
# Read file
points
=
[]
ch_diff
=
[]
for
line
in
file
:
#print('Line:%s')%line
ch_att
=
[[],[],[],[]]
for
line
in
f
:
freq
,
expect_val
,
tol
,
ch1
,
ch2
,
ch3
,
ch4
=
line
.
split
(
','
)
#print('%s %s %s %s %s %s %s')%(freq,expect_val,tol,ch1,ch2,ch3,ch4)
#print('%3.3f %d %d %d %d %d %d')%(float(freq),int(expect_val),int(tol),int(ch1),int(ch2),int(ch3),int(ch4))
points
.
append
([
float
(
freq
),
int
(
expect_val
),
int
(
tol
)])
ch_diff
.
append
(
int
(
ch1
))
ch_diff
.
append
(
int
(
ch2
))
ch_diff
.
append
(
int
(
ch3
))
ch_diff
.
append
(
int
(
ch4
))
points
.
append
([
float
(
freq
),
float
(
expect_val
),
float
(
tol
)])
ch_att
[
0
]
.
append
(
float
(
ch1
))
ch_att
[
1
]
.
append
(
float
(
ch2
))
ch_att
[
2
]
.
append
(
float
(
ch3
))
ch_att
[
3
]
.
append
(
float
(
ch4
))
f
.
close
()
#print points
#print('##########')
#print ch_diff
#sys.exit()
# The following code is to show a graph of the test results
# !! Don't forget to import numpy and pylab !!
pt
=
array
(
points
)
freq
=
pt
[:,
0
]
a_min
=
pt
[:,
1
]
-
pt
[:,
2
]
a_max
=
pt
[:,
1
]
+
pt
[:,
2
]
semilogx
(
freq
,
ch_diff
[
0
::
4
],
'b'
,
label
=
'Channel 1'
)
semilogx
(
freq
,
ch_diff
[
1
::
4
],
'g'
,
label
=
'Channel 2'
)
semilogx
(
freq
,
ch_diff
[
2
::
4
],
'r'
,
label
=
'Channel 3'
)
semilogx
(
freq
,
ch_diff
[
3
::
4
],
'c'
,
label
=
'Channel 4'
)
semilogx
(
freq
,
a_min
,
'r:'
,
label
=
'Lower limit'
)
semilogx
(
freq
,
a_max
,
'r:'
,
label
=
'Upper limit'
)
legend
()
show
()
# Plot results
show_result_graph
(
points
,
ch_att
)
if
__name__
==
'__main__'
:
...
...
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