Commit b8944c75 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][dataset] Modify shift functions

parent a12ba691
Pipeline #48761 failed with stage
in 4 minutes and 12 seconds
......@@ -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, steps=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, steps)
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, steps=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, steps, 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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment