Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Experimental Physics
Quantum Circuits
python-repo
Commits
d08cd59e
Commit
d08cd59e
authored
Aug 11, 2020
by
Oscar Gargiulo
Browse files
added gaussian fit
parent
2185301f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
DataModule/fit_functions.py
DataModule/fit_functions.py
+33
-0
Instruments/Drivers/Valon/VALON.py
Instruments/Drivers/Valon/VALON.py
+1
-1
ziUtilities.py
ziUtilities.py
+4
-4
No files found.
DataModule/fit_functions.py
View file @
d08cd59e
...
...
@@ -251,6 +251,38 @@ def sqrt_lorentzian_fit(x,*p):
return
p
[
3
]
*
np
.
sqrt
(
y
)
+
p
[
2
]
gaussian_fit_pars_labels
=
[
'center'
,
'sigma'
,
'offset'
,
'peak'
]
def
gaussian_fit
(
x
,
*
p
):
"""Gaussian function
.. math::
y(x) = N * exp(-0.5*(x-p[0])/p[1])**2) #N is normalization such that the peak is 1
returns p[3]*y+p[2]
Function parameters:
| p[0] = center
| p[1] = sigma
| p[2] = baseline/vertical offset
| p[3] = peak distance from offset
Parameters
-----------
x : float
x value
*p : args
Initial parameter guesses
Returns
--------
float, np.array, list
Function values. List size depends of given number of parameters
"""
y
=
np
.
exp
(
-
0.5
*
((
x
-
p
[
0
])
/
p
[
1
])
**
2
)
#/(np.sqrt(2*np.pi)*p[1])
return
p
[
3
]
*
y
/
y
.
max
()
+
p
[
2
]
cos_fit_pars_labels
=
[
'amplitude'
,
'period'
,
'phase'
,
'offset'
]
def
cos_fit
(
x
,
*
p
):
"""Cosine function
...
...
@@ -340,3 +372,4 @@ def T2_beating_fit(x,*p):
"""
return
p
[
0
]
*
np
.
sin
(
2
*
np
.
pi
/
p
[
1
]
*
x
+
p
[
2
])
*
np
.
sin
(
2
*
np
.
pi
/
p
[
3
]
*
x
+
p
[
4
])
*
\
np
.
exp
(
-
x
/
p
[
5
])
+
p
[
6
]
Instruments/Drivers/Valon/VALON.py
View file @
d08cd59e
...
...
@@ -17,7 +17,7 @@ class V5015(object):
self
.
__version__
=
VERSION
self
.
ip
=
ip
rm
=
visa
.
ResourceManager
()
self
.
_inst
=
rm
.
open_resource
(
'TCPIP
0
::{}::SOCKET'
.
format
(
ip
))
self
.
_inst
=
rm
.
open_resource
(
'TCPIP::{}::SOCKET'
.
format
(
ip
))
self
.
_inst
.
read_termination
=
'
\r\n
'
# define amount of lines a single query takes
...
...
ziUtilities.py
View file @
d08cd59e
...
...
@@ -67,13 +67,13 @@ def apply_correction(dev,device_id,cal_dict,amplitude):
if
cal_dict
[
'Amplitude corrected channel'
]
==
'chI'
:
dev
.
setDouble
(
'/{}/sines/{}/amplitudes/0'
.
format
(
device_id
,
chI
),
0
)
dev
.
setDouble
(
'/{}/sines/{}/amplitudes/1'
.
format
(
device_id
,
chI
+
1
),
0
)
dev
.
setDouble
(
'/{}/awgs/{}/outputs/0/
amplitude
'
.
format
(
device_id
,
int
(
chI
/
2
)),
amplitude
*
cal_dict
[
'Amplitude ratio'
]);
dev
.
setDouble
(
'/{}/awgs/{}/outputs/1/
amplitude
'
.
format
(
device_id
,
int
(
chI
/
2
)),
amplitude
)
dev
.
setDouble
(
'/{}/awgs/{}/outputs/0/
gains/0
'
.
format
(
device_id
,
int
(
chI
/
2
)),
amplitude
*
cal_dict
[
'Amplitude ratio'
]);
dev
.
setDouble
(
'/{}/awgs/{}/outputs/1/
gains/1
'
.
format
(
device_id
,
int
(
chI
/
2
)),
amplitude
)
elif
cal_dict
[
'Amplitude corrected channel'
]
==
'chQ'
:
dev
.
setDouble
(
'/{}/sines/{}/amplitudes/0'
.
format
(
device_id
,
chI
),
0
)
dev
.
setDouble
(
'/{}/sines/{}/amplitudes/1'
.
format
(
device_id
,
chI
+
1
),
0
)
dev
.
setDouble
(
'/{}/awgs/
0
/outputs/
{}/amplitude
'
.
format
(
device_id
,
chI
+
1
),
amplitude
*
cal_dict
[
'Amplitude ratio'
]);
dev
.
setDouble
(
'/{}/awgs/
0
/outputs/
{}/amplitude
'
.
format
(
device_id
,
chI
),
amplitude
)
dev
.
setDouble
(
'/{}/awgs/
{}
/outputs/
1/gains/1
'
.
format
(
device_id
,
chI
+
1
),
amplitude
*
cal_dict
[
'Amplitude ratio'
]);
dev
.
setDouble
(
'/{}/awgs/
{}
/outputs/
0/gains/0
'
.
format
(
device_id
,
chI
),
amplitude
)
else
:
print
(
'Amplitude corrected channel and used channels don
\'
t match
\n
'
)
raise
ValueError
...
...
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