Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
XRD
darfix
Commits
8283ae8c
Commit
8283ae8c
authored
Jul 05, 2021
by
Julia Garriga Ferrer
Browse files
[core][dataset] Set linear shift if shift is bigger than 1
parent
cc759976
Changes
1
Hide whitespace changes
Inline
Side-by-side
darfix/core/dataset.py
View file @
8283ae8c
...
...
@@ -26,7 +26,7 @@
__authors__
=
[
"J. Garriga"
]
__license__
=
"MIT"
__date__
=
"
16
/0
6
/2021"
__date__
=
"
05
/0
7
/2021"
import
copy
import
glob
...
...
@@ -737,7 +737,7 @@ class Dataset():
return
Dataset
(
_dir
=
roi_dir
,
data
=
new_data
,
dims
=
self
.
__dims
,
transformation
=
transformation
,
in_memory
=
self
.
_in_memory
)
def
find_shift
(
self
,
dimension
=
None
,
steps
=
10
0
,
indices
=
None
):
def
find_shift
(
self
,
dimension
=
None
,
steps
=
5
0
,
indices
=
None
):
"""
Find shift of the data or part of it.
...
...
@@ -797,6 +797,8 @@ class Dataset():
if
not
self
.
operations_state
[
Operation
.
SHIFT
]:
return
filename
=
_dir
+
"/data"
+
str
(
i
).
zfill
(
4
)
+
".npy"
if
shift
[:,
i
]
>
1
:
shift_approach
=
"linear"
img
=
apply_shift
(
data
[
i
],
shift
[:,
i
],
shift_approach
)
numpy
.
save
(
filename
,
img
)
urls
.
append
(
DataUrl
(
file_path
=
filename
,
scheme
=
'fabio'
))
...
...
@@ -828,6 +830,8 @@ class Dataset():
if
not
self
.
operations_state
[
Operation
.
SHIFT
]:
return
filename
=
_dir
+
"/data"
+
str
(
i
).
zfill
(
4
)
+
".npy"
if
shift
[:,
i
]
>
1
:
shift_approach
=
"linear"
img
=
apply_shift
(
data
[
i
],
shift
[:,
i
],
shift_approach
)
numpy
.
save
(
filename
,
img
)
urls
.
append
(
DataUrl
(
file_path
=
filename
,
scheme
=
'fabio'
))
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment