Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Thomas Bruns
SineTools
Commits
d2756ec6
Commit
d2756ec6
authored
Dec 18, 2020
by
Thomas Bruns
Browse files
start optimize seq_multisine...
parent
59aebeca
Changes
1
Hide whitespace changes
Inline
Side-by-side
SineTools.py
View file @
d2756ec6
...
...
@@ -766,7 +766,7 @@ def seq_multi_threeparam_Dmatrix(f,t,periods=1):
D
=
coo_matrix
((
data
,(
ri
,
ci
)),
shape
=
(
len
(
t
),
col
)).
tocsr
()
return
np
.
array
(
fr
),
D
def
seq_multi_threeparsinefit
(
f
,
y
,
t
,
periods
=
1
,
D_fr
=
None
):
def
seq_multi_threeparsinefit
(
f
,
y
,
t
,
periods
=
1
,
D_fr
=
None
,
abc0
=
None
):
"""
performs a simultanius, sliced three-parameter fit on a multisine signal y
...
...
@@ -797,7 +797,7 @@ def seq_multi_threeparsinefit(f,y,t,periods=1, D_fr=None):
D
=
D_fr
[
0
]
fr
=
D_fr
[
1
]
abc
=
sp_lsqr
(
D
,
y
)
abc
=
sp_lsqr
(
D
,
y
,
x0
=
abc0
,
atol
=
1.0e-9
,
btol
=
1.0e-9
)
y0
=
D
.
dot
(
abc
[
0
])
#print(abc)
...
...
@@ -894,8 +894,10 @@ def seq_multi_amplitude(f_ab_c):
frequency and associated amplitude.
"""
amp
=
[
np
.
abs
(
f_ab_c
[
i
,
1
]
+
1j
*
f_ab_c
[
i
][
2
])
for
i
in
range
(
f_ab_c
.
shape
[
0
]
-
1
)]
return
np
.
vstack
((
f_ab_c
[:
-
1
,
0
],
np
.
array
(
amp
))).
T
print
(
"Test"
)
N
=
f_ab_c
.
shape
[
0
]
-
1
amp
=
np
.
array
([
np
.
abs
(
f_ab_c
[
i
,
1
]
+
1j
*
f_ab_c
[
i
][
2
])
for
i
in
range
(
f_ab_c
.
shape
[
0
]
-
1
)]).
reshape
((
N
,
1
))
return
np
.
hstack
((
f_ab_c
[:
-
1
,
0
].
reshape
((
N
,
1
)),
amp
))
def
seq_multi_phase
(
f_ab_c
,
deg
=
True
):
"""
...
...
@@ -916,8 +918,9 @@ def seq_multi_phase(f_ab_c, deg=True):
frequency and associated initial phase.
"""
amp
=
[
np
.
angle
(
1j
*
f_ab_c
[
i
,
1
]
+
f_ab_c
[
i
][
2
],
deg
=
deg
)
for
i
in
range
(
f_ab_c
.
shape
[
0
]
-
1
)]
return
np
.
vstack
((
f_ab_c
[:
-
1
,
0
],
np
.
array
(
amp
))).
T
N
=
f_ab_c
.
shape
[
0
]
-
1
phase
=
np
.
array
([
np
.
angle
(
1j
*
f_ab_c
[
i
,
1
]
+
f_ab_c
[
i
][
2
],
deg
=
deg
)
for
i
in
range
(
f_ab_c
.
shape
[
0
]
-
1
)]).
reshape
((
N
,
1
))
return
np
.
hstack
((
f_ab_c
[:
-
1
,
0
].
reshape
((
N
,
1
)),
phase
))
def
seq_multi_bias
(
f_ab_c
):
"""
...
...
Write
Preview
Supports
Markdown
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