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
b8944c75
Commit
b8944c75
authored
Jun 16, 2021
by
Julia Garriga Ferrer
Browse files
[core][dataset] Modify shift functions
parent
a12ba691
Pipeline
#48761
failed with stage
in 4 minutes and 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
darfix/core/dataset.py
View file @
b8944c75
...
...
@@ -26,7 +26,7 @@
__authors__
=
[
"J. Garriga"
]
__license__
=
"MIT"
__date__
=
"
07
/06/2021"
__date__
=
"
16
/06/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
,
h_max
=
0.5
,
h_
step
=
0.01
,
indices
=
None
):
def
find_shift
(
self
,
dimension
=
None
,
h_max
=
0.5
,
step
s
=
50
,
indices
=
None
):
"""
Find shift of the data or part of it.
...
...
@@ -751,7 +751,7 @@ class Dataset():
:type indices: Union[None, array_like]
:returns: Array with shift per frame.
"""
return
shift_detection
(
self
.
get_data
(
indices
,
dimension
),
h_max
,
h_
step
)
return
shift_detection
(
self
.
get_data
(
indices
,
dimension
),
h_max
,
step
s
)
def
apply_shift
(
self
,
shift
,
dimension
=
None
,
shift_approach
=
"fft"
,
indices
=
None
,
callback
=
None
,
_dir
=
None
):
...
...
@@ -846,7 +846,7 @@ class Dataset():
return
Dataset
(
_dir
=
_dir
,
data
=
data
,
dims
=
self
.
__dims
,
transformation
=
self
.
transformation
,
in_memory
=
self
.
_in_memory
)
def
find_and_apply_shift
(
self
,
dimension
=
None
,
h_max
=
0.5
,
h_
step
=
0.01
,
shift_approach
=
"fft"
,
def
find_and_apply_shift
(
self
,
dimension
=
None
,
h_max
=
0.5
,
step
s
=
50
,
shift_approach
=
"fft"
,
indices
=
None
,
callback
=
None
):
"""
Find the shift of the data or part of it and apply it.
...
...
@@ -863,7 +863,7 @@ class Dataset():
:param Union[function, None] callback: Callback
:returns: Dataset with the new data.
"""
shift
=
self
.
find_shift
(
dimension
,
h_max
,
h_
step
,
indices
=
indices
)
shift
=
self
.
find_shift
(
dimension
,
h_max
,
step
s
,
indices
=
indices
)
return
self
.
apply_shift
(
shift
,
dimension
,
indices
=
indices
)
def
_cascade_nmf
(
self
,
num_components
,
iterations
,
vstep
=
None
,
hstep
=
None
,
indices
=
None
):
...
...
@@ -949,7 +949,7 @@ class Dataset():
:return: (H, W): The components matrix and the mixing matrix.
"""
bss_dir
=
self
.
dir
+
"/bss
/
"
bss_dir
=
self
.
dir
+
"/bss"
if
not
os
.
path
.
isdir
(
bss_dir
):
os
.
mkdir
(
bss_dir
)
if
self
.
_in_memory
:
...
...
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