@ValidateLarchPlugin
def fit_peak(x, y, model, dy=None, background=None, step=None,
             negative=False, use_gamma=False, _larch=None):
    out = Group(x=x*1.0, y=y*1.0, dy=1.0, model=model,
                background=background, step=step)
    if dy is not None:
        out.dy = 1.0*dy
    if model.lower() not in MODELS:
        _larch.writer.write('Unknown fit model: %s ' % model)
        return None

    kwargs = dict(negative=negative, background=background,
                  step=step, _larch=_larch)

    fitclass = MODELS[model.lower()]
    if fitclass == VoigtModel:
        kwargs['use_gamma'] = use_gamma

    mod = fitclass(**kwargs)
    mod.guess_starting_values(out.y, out.x)

    out.fit_init = mod.model(x=out.x)
    if background is not None:
        out.bkg_init = mod.calc_background(out.x)
        out.fit_init += out.bkg_init

    mod.fit(out.y, x=out.x, dy=out.dy, _larch=_larch)

    out.fit = mod.model(x=out.x)
    if background is not None:
        out.bkg = mod.calc_background(out.x)
        out.fit += out.bkg
    out.params = mod.params
    return out
Removes all items from this hash.
dataset/ETHPy150Open xraypy/xraylarch/plugins/math/fitpeak.py/fit_peak--crossover with--dataset/ETHPy150Open dahlia/sider/sider/hash.py/Hash.clear