def autorange_components(t, sig, transform='<STR_LIT>', gwin=<NUM_LIT:7>, swin=None,<EOL>win=<NUM_LIT:30>, on_mult=(<NUM_LIT>, <NUM_LIT:1.>), off_mult=(<NUM_LIT:1.>, <NUM_LIT>),<EOL>thresh=None):
failed = []<EOL>if swin is not None:<EOL><INDENT>sigs = fastsmooth(sig, swin)<EOL><DEDENT>else:<EOL><INDENT>sigs = sig<EOL><DEDENT>if transform == '<STR_LIT>':<EOL><INDENT>tsigs = np.log10(sigs)<EOL>tsig = np.log10(sig)<EOL><DEDENT>else:<EOL><INDENT>tsigs = sigs<EOL>tsig = sig<EOL><DEDENT>if thresh is None:<EOL><INDENT>bins = <NUM_LIT:50><EOL>kde_x = np.linspace(tsigs.min(), tsigs.max(), bins)<EOL>kde = gaussian_kde(tsigs)<EOL>yd = kde.pdf(kde_x)<EOL>mins = findmins(kde_x, yd)  <EOL>if len(mins) > <NUM_LIT:0>:<EOL><INDENT>bkg = tsigs < (mins[<NUM_LIT:0>])  <EOL>thresh = mins[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>bkg = np.ones(tsigs.size, dtype=bool)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>bkg = tsigs < thresh<EOL><DEDENT>fbkg = bkg<EOL>fsig = ~bkg<EOL>zeros = bool_2_indices(fsig)<EOL>g = abs(fastgrad(sigs, gwin))  <EOL>if zeros is not None:<EOL><INDENT>zeros = zeros.flatten()<EOL>trans = dict(zeros=zeros.flatten(),<EOL>lohi=[],<EOL>pgs=[],<EOL>excl=[],<EOL>tps=[],<EOL>failed=[],<EOL>xs=[],<EOL>ys=[])<EOL>for z in zeros:  <EOL><INDENT>if z - win < <NUM_LIT:0>:<EOL><INDENT>lo = gwin // <NUM_LIT:2><EOL>hi = int(z + win)<EOL><DEDENT>elif z + win > (len(sig) - gwin // <NUM_LIT:2>):<EOL><INDENT>lo = int(z - win)<EOL>hi = len(sig) - gwin // <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>lo = int(z - win)<EOL>hi = int(z + win)<EOL><DEDENT>xs = t[lo:hi]<EOL>ys = g[lo:hi]<EOL>trans['<STR_LIT>'].append(xs)<EOL>trans['<STR_LIT>'].append(ys)<EOL>trans['<STR_LIT>'].append([lo, hi])<EOL>mid = (hi + lo) // <NUM_LIT:2><EOL>tp = sigs[mid + <NUM_LIT:3>] > sigs[mid - <NUM_LIT:3>]  <EOL>trans['<STR_LIT>'].append(tp)<EOL>c = t[z]  <EOL>width = (t[<NUM_LIT:1>] - t[<NUM_LIT:0>]) * <NUM_LIT:2>  <EOL>try:<EOL><INDENT>pg, _ = curve_fit(gauss, xs, ys,<EOL>p0=(np.nanmax(ys),<EOL>c,<EOL>width),<EOL>sigma=(xs - c)**<NUM_LIT:2> + <NUM_LIT>)<EOL>trans['<STR_LIT>'].append(pg)<EOL>fwhm = abs(<NUM_LIT:2> * pg[-<NUM_LIT:1>] * np.sqrt(<NUM_LIT:2> * np.log(<NUM_LIT:2>)))<EOL>if tp:<EOL><INDENT>lim = np.array([-fwhm, fwhm]) * on_mult + pg[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>lim = np.array([-fwhm, fwhm]) * off_mult + pg[<NUM_LIT:1>]<EOL><DEDENT>trans['<STR_LIT>'].append(lim)<EOL>fbkg[(t > lim[<NUM_LIT:0>]) & (t < lim[<NUM_LIT:1>])] = False<EOL>fsig[(t > lim[<NUM_LIT:0>]) & (t < lim[<NUM_LIT:1>])] = False<EOL>failed.append(False)<EOL><DEDENT>except RuntimeError:<EOL><INDENT>failed.append(True)<EOL>trans['<STR_LIT>'].append([np.nan, np.nan])<EOL>trans['<STR_LIT>'].append([np.nan, np.nan, np.nan])<EOL>trans['<STR_LIT>'].append([np.nan, np.nan])<EOL>trans['<STR_LIT>'].append(tp)<EOL>pass<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>zeros = []<EOL><DEDENT>return t, sig, sigs, tsig, tsigs, kde_x, yd, g, trans, thresh<EOL>
Returns the components underlying the autorange algorithm.

Returns
-------
t : array-like
    Time axis (independent variable)
sig : array-like
    Raw signal (dependent variable)
sigs : array-like
    Smoothed signal (swin)
tsig : array-like
    Transformed raw signal (transform)
tsigs : array-like
    Transformed smoothed signal (transform, swin)
kde_x : array-like
    kernel density estimate of smoothed signal.
yd : array-like
    bins of kernel density estimator.
g : array-like
    gradient of smoothed signal (swin, gwin)
trans : dict
    per-transition data.
thresh : float
    threshold identified from kernel density plot