#
# This file is part of Hooke.
#
-# Hooke is free software: you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation, either
-# version 3 of the License, or (at your option) any later version.
+# Hooke is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
#
-# Hooke is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
+# Hooke is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with Hooke. If not, see
"""
return self.index + len(self.values)
-def mask_to_peaks(data, mask, name):
+def mask_to_peaks(data, mask, name='peak'):
"""Convert a mask array to a list of :class:`Peak`\s.
Parameters
if cut_side == 'both':
def new_mask(data, mask, masked_mean):
- mask[((data-masked_mean).abs()*mask).argmax()] = 0
+ mask[(numpy.absolute(data-masked_mean)*mask).argmax()] = 0
return mask
elif cut_side == 'positive':
def new_mask(data, mask, masked_mean):
--------
>>> data = numpy.arange(-3, 4)
- >>> above_noise(data, side='both', min_deviations=1.0, mean=0, std=1.0)
- array([ True, False, False, False, False, False, True], dtype=bool)
- >>> above_noise(data, side='positive', min_deviations=1.0, mean=0, std=1.0)
- array([False, False, False, False, False, False, True], dtype=bool)
- >>> above_noise(data, side='negative', min_deviations=1.0, mean=0, std=1.0)
- array([ True, False, False, False, False, False, False], dtype=bool)
+ >>> above_noise(data, side='both', min_deviations=1.1, mean=0, std=1.0)
+ array([ True, True, False, False, False, True, True], dtype=bool)
+ >>> above_noise(data, side='positive', min_deviations=1.1, mean=0, std=1.0)
+ array([False, False, False, False, False, True, True], dtype=bool)
+ >>> above_noise(data, side='negative', min_deviations=1.1, mean=0, std=1.0)
+ array([ True, True, False, False, False, False, False], dtype=bool)
"""
if mean == None:
mean = data.mean()
elif side == 'both':
data = numpy.absolute(data-mean)
mean = 0
- return data > (min_deviations + std)
+ return data > (min_deviations * std)
above_noise_arguments = [
Argument('side', type='string', default='both',