Skip to content

Commit

Permalink
Renamed operation _apply methods to _process_layer
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 5, 2017
1 parent 1c64c4d commit d5faecb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions holoviews/operation/element.py
Expand Up @@ -575,7 +575,7 @@ class decimate(ElementOperation):
The x_range as a tuple of min and max y-value. Auto-ranges
if set to None.""")

def _apply(self, element, key=None):
def _process_layer(self, element, key=None):
if not isinstance(element, Dataset):
raise ValueError("Cannot downsample non-Dataset types.")
if element.interface not in column_interfaces:
Expand Down Expand Up @@ -605,7 +605,7 @@ def _apply(self, element, key=None):
return sliced

def _process(self, element, key=None):
return element.map(self._apply, Element)
return element.map(self._process_layer, Element)


class interpolate_curve(ElementOperation):
Expand Down Expand Up @@ -647,7 +647,7 @@ def pts_to_poststep(cls, x, y):
steps[1:, 1::2] = steps[1:, 0:-2:2]
return steps

def _apply(self, element, key=None):
def _process_layer(self, element, key=None):
INTERPOLATE_FUNCS = {'steps-pre': self.pts_to_prestep,
'steps-mid': self.pts_to_midstep,
'steps-post': self.pts_to_poststep}
Expand All @@ -659,7 +659,7 @@ def _apply(self, element, key=None):
return element.clone((array[0, :], array[1, :])+dvals)

def _process(self, element, key=None):
return element.map(self._apply, Element)
return element.map(self._process_layer, Element)


#==================#
Expand Down
16 changes: 8 additions & 8 deletions holoviews/operation/timeseries.py
Expand Up @@ -32,9 +32,9 @@ class rolling(ElementOperation):
'barthann', 'kaiser', 'gaussian', 'general_gaussian',
'slepian'], doc="The type of the window to apply")

def _apply(self, element, key=None):
def _process_layer(self, element, key=None):
xdim = element.kdims[0].name
df = PandasInterface.as_df(element)
df = PandasInterface.as_dframe(element)
roll_kwargs = {'window': self.p.rolling_window,
'center': self.p.center,
'win_type': self.p.window_type,
Expand All @@ -53,7 +53,7 @@ def _apply(self, element, key=None):
return element.clone(rolled.reset_index())

def _process(self, element, key=None):
return element.map(self._apply, Element)
return element.map(self._process_layer, Element)


class resample(ElementOperation):
Expand All @@ -73,16 +73,16 @@ class resample(ElementOperation):
rule = param.String(default='D', doc="""
A string representing the time interval over which to apply the resampling""")

def _apply(self, element, key=None):
df = PandasInterface.as_df(element)
def _process_layer(self, element, key=None):
df = PandasInterface.as_dframe(element)
xdim = element.kdims[0].name
resample_kwargs = {'rule': self.p.rule, 'label': self.p.label,
'closed': self.p.closed}
df = df.set_index(xdim).resample(**resample_kwargs)
return element.clone(df.apply(self.p.function).reset_index())

def _process(self, element, key=None):
return element.map(self._apply, Element)
return element.map(self._process_layer, Element)


class rolling_outlier_std(ElementOperation):
Expand All @@ -99,7 +99,7 @@ class rolling_outlier_std(ElementOperation):
sigma = param.Number(default=2.0, doc="""
Minimum sigma before a value is considered an outlier.""")

def _apply(self, element, key=None):
def _process_layer(self, element, key=None):
sigma, window = self.p.sigma, self.p.rolling_window
ys = element.dimension_values(1)

Expand All @@ -113,4 +113,4 @@ def _apply(self, element, key=None):
return element[outliers].clone(new_type=Scatter)

def _process(self, element, key=None):
return element.map(self._apply, Element)
return element.map(self._process_layer, Element)

0 comments on commit d5faecb

Please sign in to comment.