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
4a936acc
Commit
4a936acc
authored
Sep 01, 2011
by
Federico Asara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various bugfixes.
parent
f6bab201
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
228 additions
and
11 deletions
+228
-11
SingleToneSignal.py
SignalProcessing/SingleToneSignal.py
+11
-3
TwoToneSignal.py
SignalProcessing/TwoToneSignal.py
+8
-3
MainWindow.py
qtGUI/MainWindow.py
+10
-5
setup.ui
qtGUI/setup.ui
+199
-0
No files found.
SignalProcessing/SingleToneSignal.py
View file @
4a936acc
...
...
@@ -83,18 +83,27 @@ class SingleToneSignal(Signal):
# index of the biggest peak nearest to `first`
# can only be first +-1.
second
=
first
+
(
argmax
(
fdft
[
first
-
1
:
first
+
2
:
2
])
*
2
)
-
1
second
=
first
+
((
fdft
[
first
-
1
]
<
fdft
[
first
+
1
])
*
2
)
-
1
ratio
=
(
fdft
[
second
]
/
fdft
[
first
])
print
first
,
second
print
ratio
# save first in self
self
.
first
=
first
# self.beta quantifies the sampling incoherency, defining the
# fraction of a period sampled in excess.
self
.
beta
=
N
/
pi
*
arctan
(
sin
(
pi
/
N
)
/
(
cos
(
pi
/
N
)
+
1.
/
ratio
))
print
self
.
beta
# the position the peak between first and second
self
.
w0index
=
first
+
self
.
beta
if
first
>
second
:
self
.
w0index
=
first
-
self
.
beta
else
:
self
.
w0index
=
first
+
self
.
beta
print
self
.
w0index
# sampling frequency
freqSample
=
2
*
pi
*
self
.
rate
...
...
@@ -154,7 +163,6 @@ class SingleToneSignal(Signal):
if
self
.
nsamples
==
0
:
return
output
output
.
nsamples
=
self
.
nsamples
output
.
rate
=
self
.
rate
...
...
SignalProcessing/TwoToneSignal.py
View file @
4a936acc
...
...
@@ -78,9 +78,14 @@ class TwoToneSignal(Signal):
delta
=
abs
(
self
.
w1
-
self
.
w2
)
i1
=
min
([
self
.
w1
,
self
.
w2
])
-
delta
i2
=
max
([
self
.
w1
,
self
.
w2
])
+
delta
fw1
,
fw2
=
self
.
fft
[
self
.
toi
(
self
.
w1
)],
self
.
fft
[
self
.
toi
(
self
.
w2
)]
fi1
,
fi2
=
max
(
self
.
fft
[
self
.
toi
(
i1
)
-
1
:
self
.
toi
(
i1
)
+
2
]),
max
(
self
.
fft
[
self
.
toi
(
i2
)
-
1
:
self
.
toi
(
i2
)
+
2
])
i2
=
max
([
self
.
w1
,
self
.
w2
])
+
delta
temp1
,
temp2
=
self
.
toi
(
self
.
w1
),
self
.
toi
(
self
.
w2
)
fw1
,
fw2
=
max
(
self
.
fft
[
temp1
-
1
:
temp1
+
2
]),
max
(
self
.
fft
[
temp2
-
1
:
temp2
+
2
])
temp1
,
temp2
=
self
.
toi
(
i1
),
self
.
toi
(
i2
)
fi1
,
fi2
=
max
(
self
.
fft
[
temp1
-
1
:
temp1
+
2
]),
max
(
self
.
fft
[
temp2
-
1
:
temp2
+
2
])
print
fw1
,
fw2
print
fi1
,
fi2
meaningful
=
hypot
(
fw1
,
fw2
)
...
...
qtGUI/MainWindow.py
View file @
4a936acc
...
...
@@ -82,7 +82,7 @@ class MainWindow(QMainWindow):
self
.
ui
.
wgFSR
.
setValue
(
5.
)
self
.
ui
.
wgBits
.
setValue
(
24
)
self
.
ui
.
wgFs
.
setValue
(
50e6
)
self
.
ui
.
wgSamples
.
setValue
(
10
000
)
self
.
ui
.
wgSamples
.
setValue
(
8
000
)
# populate window box
windows
=
SignalProcessing
.
WindowFunction
.
windows
.
keys
()
...
...
@@ -176,7 +176,7 @@ class MainWindow(QMainWindow):
############################################################################
## Plans
############################################################################
def
waveGenerate
(
self
):
def
waveGenerate
(
self
,
rate
=
None
,
bits
=
None
,
samples
=
None
):
rate
=
float
(
self
.
ui
.
wgFs
.
value
())
bits
=
int
(
self
.
ui
.
wgBits
.
value
())
...
...
@@ -394,10 +394,15 @@ class MainWindow(QMainWindow):
# if the generator cannot directly support this
playable
=
self
.
generator
.
adaptKeys
()
if
type
(
self
.
wave
)
not
in
playable
:
fsr
=
float
(
self
.
ui
.
wgFSR
.
value
())
bits
=
self
.
adc
.
get
(
'nrBits'
)
data
,
f
=
self
.
wave
.
generatePeriod
(
bits
,
1000
,
fsr
)
self
.
generator
.
set
(
'frequency'
,
f
)
self
.
generator
.
play
(
data
)
def
play
():
bits
,
rate
,
wave
=
self
.
waveGenerate
()
self
.
generator
.
set
(
'frequency'
,
rate
)
self
.
generator
.
play
(
wave
)
data
,
f
=
self
.
wave
.
generatePeriod
(
bits
,
1000
,
fsr
)
self
.
generator
.
set
(
'frequency'
,
f
)
else
:
def
play
():
self
.
generator
.
play
(
self
.
wave
)
...
...
qtGUI/setup.ui
0 → 100644
View file @
4a936acc
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
Form
</class>
<widget
class=
"QWidget"
name=
"Form"
>
<property
name=
"windowModality"
>
<enum>
Qt::ApplicationModal
</enum>
</property>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
583
</width>
<height>
528
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Setup test environment
</string>
</property>
<widget
class=
"QGroupBox"
name=
"groupBox"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
10
</y>
<width>
291
</width>
<height>
114
</height>
</rect>
</property>
<property
name=
"title"
>
<string>
Signal Generation and Acquisition
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QRadioButton"
name=
"radioButton"
>
<property
name=
"text"
>
<string>
Full chain
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QRadioButton"
name=
"radioButton_2"
>
<property
name=
"text"
>
<string>
ADC only
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QRadioButton"
name=
"radioButton_3"
>
<property
name=
"text"
>
<string>
Synthetic chain
</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget
class=
"QGroupBox"
name=
"groupBox_2"
>
<property
name=
"geometry"
>
<rect>
<x>
320
</x>
<y>
10
</y>
<width>
131
</width>
<height>
114
</height>
</rect>
</property>
<property
name=
"title"
>
<string>
Modality
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<widget
class=
"QRadioButton"
name=
"radioButton_6"
>
<property
name=
"text"
>
<string>
Single tone
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QRadioButton"
name=
"radioButton_5"
>
<property
name=
"text"
>
<string>
Two tone
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QRadioButton"
name=
"radioButton_4"
>
<property
name=
"text"
>
<string>
Sweep
</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget
class=
"QGroupBox"
name=
"groupBox_3"
>
<property
name=
"geometry"
>
<rect>
<x>
20
</x>
<y>
130
</y>
<width>
551
</width>
<height>
129
</height>
</rect>
</property>
<property
name=
"title"
>
<string>
Output signal description
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Waveform
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"comboBox"
/>
</item>
<item
row=
"0"
column=
"2"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
257
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"0"
column=
"3"
>
<widget
class=
"QPushButton"
name=
"pushButton"
>
<property
name=
"text"
>
<string>
Configure..
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Generator
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"comboBox_2"
/>
</item>
<item
row=
"1"
column=
"2"
>
<spacer
name=
"horizontalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
257
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"1"
column=
"3"
>
<widget
class=
"QPushButton"
name=
"pushButton_2"
>
<property
name=
"text"
>
<string>
Configure..
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string>
ADC
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"comboBox_3"
/>
</item>
<item
row=
"2"
column=
"2"
>
<spacer
name=
"horizontalSpacer_3"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
257
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"2"
column=
"3"
>
<widget
class=
"QPushButton"
name=
"pushButton_3"
>
<property
name=
"text"
>
<string>
Configure..
</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
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