'Function to minimize.
Parameters
fps : list
parameters returned by the fitter
args : list
[model, [weights], [input coordinates]]'

def objective_function(self, fps, *args):

    model = args[0]
    weights = args[1]
    _fitter_to_model_params(model, fps)
    meas = args[(-1)]
    if (weights is None):
        return np.ravel((model(*args[2:(-1)]) - meas))
    else:
        return np.ravel((weights * (model(*args[2:(-1)]) - meas)))
