Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
ADC 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
ADC Testing
Commits
acbdb473
Commit
acbdb473
authored
Sep 02, 2011
by
Federico Asara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes.
parent
65c841ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
25 deletions
+21
-25
TTWaveform.py
PAGE/TTWaveform.py
+1
-0
TwoToneSignal.py
SignalProcessing/TwoToneSignal.py
+20
-25
No files found.
PAGE/TTWaveform.py
View file @
acbdb473
...
...
@@ -6,6 +6,7 @@ import Pyro4
import
Pyro4.util
import
sys
import
commands
def
gcd
(
a
,
b
):
"""Return greatest common divisor using Euclid's Algorithm."""
while
b
:
...
...
SignalProcessing/TwoToneSignal.py
View file @
acbdb473
from
Signal
import
*
def
gcd
(
a
,
b
):
"""Return greatest common divisor using Euclid's Algorithm."""
while
b
:
a
,
b
=
b
,
a
%
b
return
a
def
lcm
(
a
,
b
):
"""Return lowest common multiple."""
return
a
*
b
//
gcd
(
a
,
b
)
class
TwoToneSignal
(
Signal
):
"""A class that represent a time-domain sampled signal with two sinusoids
with similiar frequenciess.
...
...
@@ -75,6 +85,14 @@ class TwoToneSignal(Signal):
self
.
phase1
=
arctan2
(
self
.
b1
,
self
.
a1
)
self
.
phase2
=
arctan2
(
self
.
b2
,
self
.
a2
)
# cut right now
N1
=
floor
(
0.5
+
2
*
pi
*
self
.
rate
/
self
.
w1
)
N2
=
floor
(
0.5
+
2
*
pi
*
self
.
rate
/
self
.
w2
)
N0
=
lcm
(
N1
,
N2
)
N
=
N
-
(
N
%
N0
)
# while (N0 % 2) == 1 and N
delta
=
abs
(
self
.
w1
-
self
.
w2
)
i1
=
min
([
self
.
w1
,
self
.
w2
])
-
delta
...
...
@@ -94,7 +112,8 @@ class TwoToneSignal(Signal):
self
.
imd
=
10
*
log10
(
meaningful
/
interferences
)
# fix incoherency
self
.
report
()
# self.report()
fd
=
abs
(
self
.
w1
+
self
.
w2
)
/
4.
/
pi
print
"fd is"
,
fd
...
...
@@ -106,30 +125,6 @@ class TwoToneSignal(Signal):
limit
=
floor
(
self
.
nsamples
*
factor
)
print
"limit is"
,
limit
return
self
.
data
=
self
.
fulldata
[:
limit
]
self
.
nsamples
=
limit
ff
=
abs
(
fft
.
fft
(
self
.
data
))
lbnd
=
max
(
ff
)
*
10e-12
self
.
fft
=
ff
=
where
(
ff
<
lbnd
,
10e-12
,
ff
)
hff
=
ff
[:
len
(
ff
)
/
2
]
self
.
lfft
=
lff
=
10
*
log10
(
ff
)
self
.
m1
=
m1
=
argmax
(
hff
);
self
.
m2
=
m2
=
argmax
(
hstack
([
hff
[:
m1
-
1
],
array
([
0
,
0
,
0
]),
hff
[
m1
+
2
:]]))
self
.
tow1
=
tow1
=
2
*
pi
*
self
.
rate
*
float
(
m1
)
/
self
.
nsamples
self
.
tow2
=
tow2
=
2
*
pi
*
self
.
rate
*
float
(
m2
)
/
self
.
nsamples
(
self
.
w1
,
self
.
a1
,
self
.
b1
),
(
self
.
w2
,
self
.
a2
,
self
.
b2
),
self
.
c0
=
\
Sinefit
.
doubleSinefit4matrix
(
self
.
data
,
self
.
rate
**-
1
,
tow1
,
tow2
)
fd
=
abs
(
self
.
w1
-
self
.
w2
)
/
2.
/
pi
print
"fd is"
,
fd
return
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