def _model_to_fit_params(model):
 fitparam_indices = list(range(len(model.param_names)))
 if (any(model.fixed.values()) or any(model.tied.values())):
  params = list(model.parameters)
  param_metrics = model._param_metrics
  for (idx, name) in list(enumerate(model.param_names))[::(-1)]:
   if (model.fixed[name] or model.tied[name]):
    slice_ = param_metrics[name][u'slice']
    del params[slice_]
    del fitparam_indices[idx]
  return (np.array(params), fitparam_indices)
 else:
  return (model.parameters, fitparam_indices)

def _model_to_fit_params ( model ) : fitparam_indices = list ( range ( len ( model . param_names ) ) ) if ( any ( model . fixed . values ( ) ) or any ( model . tied . values ( ) ) ) : params = list ( model . parameters ) param_metrics = model . _param_metrics for ( idx , name ) in list ( enumerate ( model . param_names ) ) [ : : ( - 1 ) ] : if ( model . fixed [ name ] or model . tied [ name ] ) : slice_ = param_metrics [ name ] [ u'slice' ] del params [ slice_ ] del fitparam_indices [ idx ] return ( np . array ( params ) , fitparam_indices ) else : return ( model . parameters , fitparam_indices )
convert a model instances parameter array to an array that can be used with a fitter that doesnt natively support fixed or tied parameters .