def fitting_model(q_values, sample, output_preprocessor):

    def log_refl_curve(q, *prep_labels):
        generator = ReflectivityGenerator(q_values, sample)
        restored_labels = output_preprocessor.restore_labels(np.atleast_2d(prep_labels))
        model = generator.simulate_reflectivity(restored_labels, progress_bar=False)[0]
        return np.log10(model)
    return log_refl_curve
def fitting_model(q_values, sample, output_preprocessor):

    def log_refl_curve(q, *prep_labels):
        generator = ReflectivityGenerator(q_values, sample)
        restored_labels = output_preprocessor.restore_labels(np.atleast_2d(prep_labels))
        model = generator.simulate_reflectivity(restored_labels, progress_bar=False)[0]
        return np.log10(model)
    return log_refl_curve