Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
experiment-control
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
whuie2
experiment-control
Commits
c199ff62
Commit
c199ff62
authored
3 years ago
by
whooie
Browse files
Options
Downloads
Patches
Plain Diff
account for possible angling in lmfit_gaussian
parent
28a28a9d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/imaging.py
+8
-1
8 additions, 1 deletion
lib/imaging.py
with
8 additions
and
1 deletion
lib/imaging.py
+
8
−
1
View file @
c199ff62
...
@@ -299,8 +299,13 @@ def lmfit_gaussian(data, dA, k=None):
...
@@ -299,8 +299,13 @@ def lmfit_gaussian(data, dA, k=None):
sx
=
params
[
"
sx
"
]
sx
=
params
[
"
sx
"
]
y0
=
params
[
"
y0
"
]
y0
=
params
[
"
y0
"
]
sy
=
params
[
"
sy
"
]
sy
=
params
[
"
sy
"
]
th
=
params
[
"
theta
"
]
B
=
params
[
"
B
"
]
B
=
params
[
"
B
"
]
return
A
*
np
.
exp
(
-
((
_X
-
x0
)
/
sx
)
**
2
-
((
_Y
-
y0
)
/
sy
)
**
2
)
+
B
_Xrel
=
_X
-
x0
_Yrel
=
_Y
-
y0
_Xrot
=
np
.
cos
(
th
)
*
_Xrel
+
np
.
sin
(
th
)
*
_Yrel
_Yrot
=
-
np
.
sin
(
th
)
*
_Xrel
+
np
.
cos
(
th
)
*
_Yrel
return
A
*
np
.
exp
(
-
(
_Xrot
/
sx
)
**
2
-
(
_Yrot
/
sy
)
**
2
)
+
B
def
residual
(
params
:
lmfit
.
Parameters
):
def
residual
(
params
:
lmfit
.
Parameters
):
m
=
model
(
params
)
m
=
model
(
params
)
...
@@ -312,6 +317,7 @@ def lmfit_gaussian(data, dA, k=None):
...
@@ -312,6 +317,7 @@ def lmfit_gaussian(data, dA, k=None):
params
.
add
(
"
sx
"
,
value
=
(
x
.
max
()
-
x
.
min
())
/
12
)
params
.
add
(
"
sx
"
,
value
=
(
x
.
max
()
-
x
.
min
())
/
12
)
params
.
add
(
"
y0
"
,
value
=
y0
)
params
.
add
(
"
y0
"
,
value
=
y0
)
params
.
add
(
"
sy
"
,
value
=
(
y
.
max
()
-
y
.
min
())
/
12
)
params
.
add
(
"
sy
"
,
value
=
(
y
.
max
()
-
y
.
min
())
/
12
)
params
.
add
(
"
theta
"
,
value
=
0.0
,
min
=
0.0
,
max
=
np
.
pi
/
2
)
params
.
add
(
"
B
"
,
value
=
data
.
mean
())
params
.
add
(
"
B
"
,
value
=
data
.
mean
())
fit
=
lmfit
.
minimize
(
residual
,
params
)
fit
=
lmfit
.
minimize
(
residual
,
params
)
if
not
fit
.
success
:
if
not
fit
.
success
:
...
@@ -331,5 +337,6 @@ def lmfit_gaussian(data, dA, k=None):
...
@@ -331,5 +337,6 @@ def lmfit_gaussian(data, dA, k=None):
print
(
fit
.
params
[
"
sx
"
])
print
(
fit
.
params
[
"
sx
"
])
print
(
fit
.
params
[
"
y0
"
])
print
(
fit
.
params
[
"
y0
"
])
print
(
fit
.
params
[
"
sy
"
])
print
(
fit
.
params
[
"
sy
"
])
print
(
fit
.
params
[
"
theta
"
])
return
float
(
fit
.
params
[
"
sx
"
]),
float
(
fit
.
params
[
"
sy
"
])
return
float
(
fit
.
params
[
"
sx
"
]),
float
(
fit
.
params
[
"
sy
"
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment