'Return an instance of the model for which the parameter values have been
converted to the right units for the data, then the units have been
stripped away.
The input and output Quantity objects should be given as keyword
arguments.
Notes
This method is needed in order to be able to fit models with units in
the parameters, since we need to temporarily strip away the units from
the model during the fitting (which might be done by e.g. scipy
functions).
The units that the parameters should be converted to are not necessarily
the units of the input data, but are derived from them. Model subclasses
that want fitting to work in the presence of quantities need to define a
_parameter_units_for_data_units method that takes the input and output
units (as two dictionaries) and returns a dictionary giving the target
units for each parameter.'

def without_units_for_data(self, **kwargs):

    model = self.copy()
    inputs_unit = {inp: getattr(kwargs[inp], u'unit', dimensionless_unscaled) for inp in self.inputs if (kwargs[inp] is not None)}
    outputs_unit = {out: getattr(kwargs[out], u'unit', dimensionless_unscaled) for out in self.outputs if (kwargs[out] is not None)}
    parameter_units = self._parameter_units_for_data_units(inputs_unit, outputs_unit)
    for (name, unit) in parameter_units.items():
        parameter = getattr(model, name)
        if (parameter.unit is not None):
            parameter.value = parameter.quantity.to(unit).value
            parameter._set_unit(None, force=True)
    return model
