def trend(self):
"""Subtract the trend specified in
``Plotter.plot_properties['detrend']`` from each plot. Trend can be
the 'mean' value of the plot, the 'linear' least squares best fit, a
custom-specified number, or simply 'none' if no trend should be
removed."""
if self.plot_properties['detrend'] == 'mean':
# delete bad indices before calculating the trend, since they
# can skew the trend.
cleandata = np.delete(self.plot_vars.means, self.bad_indices.means)
if len(cleandata) != 0:
trend = cleandata.mean()
else:
trend = 0
elif self.plot_properties['detrend'] == 'none':
trend = 0
elif self.plot_properties['detrend'] == 'linear':
trend, driftcoeff, linregress = self.linregress
else:
trend = self.plot_properties['detrend']
return trend
评论列表
文章目录