def find_expcoef(self, nsd_below=<NUM_LIT:0.>, plot=False,<EOL>trimlim=None, autorange_kwargs={}):
print('<STR_LIT>')<EOL>def findtrim(tr, lim=None):<EOL><INDENT>trr = np.roll(tr, -<NUM_LIT:1>)<EOL>trr[-<NUM_LIT:1>] = <NUM_LIT:0><EOL>if lim is None:<EOL><INDENT>lim = <NUM_LIT:0.5> * np.nanmax(tr - trr)<EOL><DEDENT>ind = (tr - trr) >= lim<EOL>return np.arange(len(ind))[ind ^ np.roll(ind, -<NUM_LIT:1>)][<NUM_LIT:0>]<EOL><DEDENT>if not hasattr(self.stds[<NUM_LIT:0>], '<STR_LIT>'):<EOL><INDENT>for s in self.stds:<EOL><INDENT>s.autorange(**autorange_kwargs, ploterrs=False)<EOL><DEDENT><DEDENT>trans = []<EOL>times = []<EOL>for v in self.stds:<EOL><INDENT>for trnrng in v.trnrng[-<NUM_LIT:1>::-<NUM_LIT:2>]:<EOL><INDENT>tr = minmax_scale(v.data['<STR_LIT>'][(v.Time > trnrng[<NUM_LIT:0>]) & (v.Time < trnrng[<NUM_LIT:1>])])<EOL>sm = np.apply_along_axis(np.nanmean, <NUM_LIT:1>,<EOL>rolling_window(tr, <NUM_LIT:3>, pad=<NUM_LIT:0>))<EOL>sm[<NUM_LIT:0>] = sm[<NUM_LIT:1>]<EOL>trim = findtrim(sm, trimlim) + <NUM_LIT:2><EOL>trans.append(minmax_scale(tr[trim:]))<EOL>times.append(np.arange(tr[trim:].size) *<EOL>np.diff(v.Time[<NUM_LIT:1>:<NUM_LIT:3>]))<EOL><DEDENT><DEDENT>times = np.concatenate(times)<EOL>times = np.round(times, <NUM_LIT:2>)<EOL>trans = np.concatenate(trans)<EOL>ti = []<EOL>tr = []<EOL>for t in np.unique(times):<EOL><INDENT>ti.append(t)<EOL>tr.append(np.nanmin(trans[times == t]))<EOL><DEDENT>def expfit(x, e):<EOL><INDENT>"""<STR_LIT>"""<EOL>return np.exp(e * x)<EOL><DEDENT>ep, ecov = curve_fit(expfit, ti, tr, p0=(-<NUM_LIT:1.>))<EOL>eeR2 = R2calc(trans, expfit(times, ep))<EOL>if plot:<EOL><INDENT>fig, ax = plt.subplots(<NUM_LIT:1>, <NUM_LIT:1>, figsize=[<NUM_LIT:6>, <NUM_LIT:4>])<EOL>ax.scatter(times, trans, alpha=<NUM_LIT>, color='<STR_LIT:k>', marker='<STR_LIT:x>', zorder=-<NUM_LIT:2>)<EOL>ax.scatter(ti, tr, alpha=<NUM_LIT:1>, color='<STR_LIT:k>', marker='<STR_LIT:o>')<EOL>fitx = np.linspace(<NUM_LIT:0>, max(ti))<EOL>ax.plot(fitx, expfit(fitx, ep), color='<STR_LIT:r>', label='<STR_LIT>')<EOL>ax.plot(fitx, expfit(fitx, ep - nsd_below * np.diag(ecov)**<NUM_LIT>, ),<EOL>color='<STR_LIT:b>', label='<STR_LIT>')<EOL>ax.text(<NUM_LIT>, <NUM_LIT>,<EOL>('<STR_LIT>'<EOL>'<STR_LIT>') % (ep,<EOL>np.diag(ecov)**<NUM_LIT>,<EOL>eeR2,<EOL>ep - nsd_below * np.diag(ecov)**<NUM_LIT>),<EOL>transform=ax.transAxes, ha='<STR_LIT:right>', va='<STR_LIT>', size=<NUM_LIT:12>)<EOL>ax.set_xlim(<NUM_LIT:0>, ax.get_xlim()[-<NUM_LIT:1>])<EOL>ax.set_xlabel('<STR_LIT>')<EOL>ax.set_ylim(-<NUM_LIT>, <NUM_LIT>)<EOL>ax.set_ylabel('<STR_LIT>')<EOL>plt.legend()<EOL>if isinstance(plot, str):<EOL><INDENT>fig.savefig(plot)<EOL><DEDENT><DEDENT>self.expdecay_coef = ep - nsd_below * np.diag(ecov)**<NUM_LIT><EOL>print('<STR_LIT>'.format(self.expdecay_coef[<NUM_LIT:0>]))<EOL>return<EOL>
Determines exponential decay coefficient for despike filter.

Fits an exponential decay function to the washout phase of standards
to determine the washout time of your laser cell. The exponential
coefficient reported is `nsd_below` standard deviations below the
fitted exponent, to ensure that no real data is removed.

Total counts are used in fitting, rather than a specific analyte.

Parameters
----------
nsd_below : float
    The number of standard deviations to subtract from the fitted
    coefficient when calculating the filter exponent.
plot : bool or str
    If True, creates a plot of the fit, if str the plot is to the
    location specified in str.
trimlim : float
    A threshold limit used in determining the start of the
    exponential decay region of the washout. Defaults to half
    the increase in signal over background. If the data in
    the plot don't fall on an exponential decay line, change
    this number. Normally you'll need to increase it.

Returns
-------
None