'Perform sigma clipping on the provided data.
Parameters
data : array-like
The data to be sigma clipped.
axis : int or `None`, optional
If not `None`, clip along the given axis.  For this case,
``axis`` will be passed on to ``cenfunc`` and ``stdfunc``,
which are expected to return an array with the axis
dimension removed (like the numpy functions).  If `None`,
clip over all axes.  Defaults to `None`.
copy : bool, optional
If `True`, the ``data`` array will be copied.  If `False`,
the returned masked array data will contain the same array
as ``data``.  Defaults to `True`.
Returns
filtered_data : `numpy.ma.MaskedArray`
A masked array with the same shape as ``data`` input, where
the points rejected by the algorithm have been masked.'

def __call__(self, data, axis=None, copy=True):

    if (self.sigma_lower is None):
        self.sigma_lower = self.sigma
    if (self.sigma_upper is None):
        self.sigma_upper = self.sigma
    if np.any((~ np.isfinite(data))):
        data = np.ma.masked_invalid(data)
        warnings.warn(u'Input    data    contains    invalid    values    (NaNs    or    infs),    which    were    automatically    masked.', AstropyUserWarning)
    filtered_data = np.ma.array(data, copy=copy)
    if (self.iters is None):
        lastrej = (filtered_data.count() + 1)
        while (filtered_data.count() != lastrej):
            lastrej = filtered_data.count()
            self._perform_clip(filtered_data, axis=axis)
    else:
        for i in range(self.iters):
            self._perform_clip(filtered_data, axis=axis)
    if (filtered_data.mask.shape == ()):
        filtered_data.mask = False
    return filtered_data
