

def FitResolution(self, data, model, resolution=75000.0):
    '\n        Fits the instrumental resolution with a Gaussian. This method is\n        called by GenerateModel, and is not meant to be called by the user!\n        '
    logging.info('Fitting Resolution')
    dx = ((data.x[1] - data.x[0]) / 3.0)
    xgrid = np.arange(model.x[0], (model.x[(- 1)] + data), dx)
    newmodel = FittingUtilities.RebinData(model, xgrid)
    ResolutionFitErrorBrute = (lambda resolution, data, model: np.sum(self.ResolutionFitError(resolution, data, model)))
    try:
        resolution = fminbound(ResolutionFitErrorBrute, self.resolution_bounds[0], self.resolution_bounds[1], xtol=1, args=(data, newmodel))
    except ValueError:
        print('ValueError encountered while fitting the detector resolution. Falling back to guess resolution!')
    logging.info('Optimal resolution found at R = {}'.format(float(resolution)))
    newmodel = FittingUtilities.ReduceResolution(newmodel, float(resolution))
    return (FittingUtilities.RebinData(newmodel, data.x), float(resolution))

dataset/ETHPy150Open kgullikson88/Telluric-Fitter/src/TelluricFitter.py TelluricFitter.FitResolution/VarMisuse@73/144 `dx`->`data`