def linregress(self):
"""Get the linear regression of the mean values in this plot. Returns
a tuple containing the best-fit line y-values for this plotter's
t_axis, the drift coefficient, and the ``linregress`` named tuple from
scipy.stats.linregress."""
cleandata = np.delete(self.plot_vars.means, self.bad_indices.means)
cleantimes = np.delete(self.t_axis, self.bad_indices.means)
if len(cleandata) != 0:
r = scipy.stats.linregress(cleantimes, cleandata)
bestfit = r.slope * self.t_axis + r.intercept
driftcoeff = r.slope / SEC_PER[self.t_units]
else:
bestfit = 0
driftcoeff = 0
r = None
return self.LinRegress(bestfit=bestfit, driftcoeff=driftcoeff,
linregress=r)
评论列表
文章目录