Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xsocs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kmap
xsocs
Commits
598c0d7e
Commit
598c0d7e
authored
Nov 21, 2018
by
Thomas Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code style
parent
aaa91dda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
xsocs/process/fit/peak_fit.py
xsocs/process/fit/peak_fit.py
+18
-14
No files found.
xsocs/process/fit/peak_fit.py
View file @
598c0d7e
...
...
@@ -347,7 +347,7 @@ def _fit_process(index,
qspace_f
,
fit_type
=
FitTypes
.
GAUSSIAN
,
background_type
=
BackgroundTypes
.
NONE
,
roi
I
ndices
=
None
):
roi
_i
ndices
=
None
):
"""Run fit processing.
It loads a QSpace, extracts a ROI from it, project to axes,
...
...
@@ -360,7 +360,7 @@ def _fit_process(index,
:param FitTypes fit_type: The kind of fit to perform
:param BackgroundTypes background_type:
The kind of background subtraction to perform
:param Union[List[List[int]],None] roi
I
ndices:
:param Union[List[List[int]],None] roi
_i
ndices:
Optional QSpace ROI start:end in the 3 dimensions
:return: Fit results as a list of results for dim0, dim1 and dim2
:rtype: List[List[Union[float,bool]]]
...
...
@@ -378,15 +378,15 @@ def _fit_process(index,
qspace
=
qspace_h5
.
qspace_slice
(
index
)
# apply Qspace ROI
if
roi
I
ndices
is
not
None
:
dim0
Slice
=
slice
(
roiIndices
[
0
][
0
],
roiI
ndices
[
0
][
1
],
1
)
dim1
Slice
=
slice
(
roiIndices
[
1
][
0
],
roiI
ndices
[
1
][
1
],
1
)
dim2
Slice
=
slice
(
roiIndices
[
2
][
0
],
roiI
ndices
[
2
][
1
],
1
)
if
roi
_i
ndices
is
not
None
:
dim0
_slice
=
slice
(
roi_indices
[
0
][
0
],
roi_i
ndices
[
0
][
1
],
1
)
dim1
_slice
=
slice
(
roi_indices
[
1
][
0
],
roi_i
ndices
[
1
][
1
],
1
)
dim2
_slice
=
slice
(
roi_indices
[
2
][
0
],
roi_i
ndices
[
2
][
1
],
1
)
axes
=
[
axis
[
roi
]
for
axis
,
roi
in
zip
(
axes
,
(
dim0
Slice
,
dim1Slice
,
dim2S
lice
))]
hits
=
hits
[
dim0
Slice
,
dim1Slice
,
dim2S
lice
]
qspace
=
qspace
[
dim0
Slice
,
dim1Slice
,
dim2S
lice
]
zip
(
axes
,
(
dim0
_slice
,
dim1_slice
,
dim2_s
lice
))]
hits
=
hits
[
dim0
_slice
,
dim1_slice
,
dim2_s
lice
]
qspace
=
qspace
[
dim0
_slice
,
dim1_slice
,
dim2_s
lice
]
# Normalize with hits and project to axes
projections
=
project
(
qspace
,
hits
)
...
...
@@ -396,12 +396,16 @@ def _fit_process(index,
for
array
in
projections
:
array
-=
background_estimation
(
background_type
,
array
)
# Fit/COM
fit
=
{
FitTypes
.
CENTROID
:
centroid
,
FitTypes
.
GAUSSIAN
:
gaussian_fit
}[
fit_type
]
result
=
[
fit
(
axis
,
values
)
for
axis
,
values
in
zip
(
axes
,
projections
)]
# Select Fit/COM function
if
fit_type
==
FitTypes
.
CENTROID
:
fit_func
=
centroid
elif
fit_type
==
FitTypes
.
GAUSSIAN
:
fit_func
=
gaussian_fit
else
:
raise
RuntimeError
(
"Unsupported fit type: %s"
%
fit_type
)
return
result
# Fit/COM for projections on each axes
return
[
fit_func
(
axis
,
signal
)
for
axis
,
signal
in
zip
(
axes
,
projections
)]
# Center of mass
...
...
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