def fit(bins, samp, samperr, maps, mapserr, scale=1.0, sampler=None, log=False, pos=None, pose=None, nwalkers=100, nsteps=10000.0, boot=1000, burnin=200, threshold=False, threshold2=False, verbose=True):
    "\n    # # # A Schmidt Law fitting Function using EMCEE by D.F.M.\n    fit(bins, samp, samperr, maps, mapserr, scale=1.,\n            pos=None, pose=None, nwalkers=100, nsteps=1e4)\n    bins: bin edges for binning data (I know it's bad to bin)\n    samp : values for your sample\n    samperr : errors on values for you sample\n    maps: map of values from which you drew your sample\n    mapserr: error on maps...\n    pos : initial location of ball of walkers\n    pose : initial spread of walkers\n    "
    x = avg(bins)
    (y, yerr) = surfd(samp, maps, bins, scale=scale, return_err=True)
    bins2 = shift_bins(bins, 0.5)
    bin
    x2 = avg(bins2)
    (y2, yerr2) = surfd(samp, maps, bins2, scale=scale, return_err=True)
    concatx = np.concatenate((x, x2))
    concaty = np.concatenate((y, y2))
    concatyerr = np.concatenate((yerr, yerr2))
    srt = np.argsort(concatx)
    x = concatx[srt]
    y = concaty[srt]
    yerr = concatyerr[srt]
    nonzero = ((np.isfinite((1.0 / y)) & np.isfinite(yerr)) & np.isfinite((1.0 / yerr)))
    y = y[nonzero]
    yerr = yerr[nonzero]
    x = x[nonzero]
    init = alpha(y, x, return_kappa=True, cov=True)
    if (pos is None):
        pos = init[:2]
    if (pose is None):
        if np.isnan((init[2] + init[3])):
            pose = (1, 1)
        else:
            pose = (init[2], init[3])
    if (threshold | threshold2):
        pos = (pos + (0.4,))
        pose = (pose + (0.2,))
    if threshold2:
        pos = (pos + (8.0,))
        pose = (pose + (0.5,))
    pos = np.asarray(pos)
    pose = (0.1 * pos)
    if (sampler is None):
        if verbose:
            print('Sampler autocorrelation times . . .')
        (sampler, theta, theta_std) = emcee_schmidt(x, np.log(y), (yerr / y), pos=pos, pose=pose, nwalkers=nwalkers, nsteps=nsteps, burnin=burnin, verbose=verbose)
    else:
        print((("Next time don't give me a " + str(type(sampler))) + '.'))
    try:
        return (sampler, x, y, yerr, theta, theta_std)
    except:
        return (sampler, x, y, yerr)
# # # A Schmidt Law fitting Function using EMCEE by D.F.M.
fit(bins, samp, samperr, maps, mapserr, scale=1.,
        pos=None, pose=None, nwalkers=100, nsteps=1e4)
bins: bin edges for binning data (I know it's bad to bin)
samp : values for your sample
samperr : errors on values for you sample
maps: map of values from which you drew your sample
mapserr: error on maps...
pos : initial location of ball of walkers
pose : initial spread of walkers
def fit(bins, samp, samperr, maps, mapserr, scale=1.0, sampler=None, log=False, pos=None, pose=None, nwalkers=100, nsteps=10000.0, boot=1000, burnin=200, threshold=False, threshold2=False, verbose=True):
    "\n    # # # A Schmidt Law fitting Function using EMCEE by D.F.M.\n    fit(bins, samp, samperr, maps, mapserr, scale=1.,\n            pos=None, pose=None, nwalkers=100, nsteps=1e4)\n    bins: bin edges for binning data (I know it's bad to bin)\n    samp : values for your sample\n    samperr : errors on values for you sample\n    maps: map of values from which you drew your sample\n    mapserr: error on maps...\n    pos : initial location of ball of walkers\n    pose : initial spread of walkers\n    "
    x = avg(bins)
    (y, yerr) = surfd(samp, maps, bins, scale=scale, return_err=True)
    bins2 = shift_bins(bins, 0.5)
    bin
    x2 = avg(bins2)
    (y2, yerr2) = surfd(samp, maps, bins2, scale=scale, return_err=True)
    concatx = np.concatenate((x, x2))
    concaty = np.concatenate((y, y2))
    concatyerr = np.concatenate((yerr, yerr2))
    srt = np.argsort(concatx)
    x = concatx[srt]
    y = concaty[srt]
    yerr = concatyerr[srt]
    nonzero = ((np.isfinite((1.0 / y)) & np.isfinite(yerr)) & np.isfinite((1.0 / yerr)))
    y = y[nonzero]
    yerr = yerr[nonzero]
    x = x[nonzero]
    init = alpha(y, x, return_kappa=True, cov=True)
    if (pos is None):
        pos = init[:2]
    if (pose is None):
        if np.isnan((init[2] + init[3])):
            pose = (1, 1)
        else:
            pose = (init[2], init[3])
    if (threshold | threshold2):
        pos = (pos + (0.4,))
        pose = (pose + (0.2,))
    if threshold2:
        pos = (pos + (8.0,))
        pose = (pose + (0.5,))
    pos = np.asarray(pos)
    pose = (0.1 * pos)
    if (sampler is None):
        if verbose:
            print('Sampler autocorrelation times . . .')
        (sampler, theta, theta_std) = emcee_schmidt(x, np.log(y), (yerr / y), pos=pos, pose=pose, nwalkers=nwalkers, nsteps=nsteps, burnin=burnin, verbose=verbose)
    else:
        print((("Next time don't give me a " + str(type(sampler))) + '.'))
    try:
        return (sampler, x, y, yerr, theta, theta_std)
    except:
        return (sampler, x, y, yerr)