#NEWLINE# def update_parameter_dict( param , fit_results ) : #NEWLINE# #INDENT# '\n    Update fitting parameters dictionary according to given fitting results,\n    usually obtained from previous run.\n\n    .. warning :: This function mutates param.\n\n    Parameters\n    ----------\n    param : dict\n        saving all the fitting values and their bounds\n    fit_results : object\n        ModelFit object from lmfit\n    ' #NEWLINE# elastic_list = [ 'coherent_sct_amplitude' , 'coherent_sct_energy' ] #NEWLINE# for ( k , v ) in six . iteritems ( param ) : #NEWLINE# #INDENT# if ( k in elastic_list ) : #NEWLINE# #INDENT# k_temp = ( 'elastic_' + k ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# k_temp = k . replace ( '-' , '_' ) #NEWLINE# #UNINDENT# if ( k_temp in fit_results . values ) : #NEWLINE# #INDENT# param [ k ] [ 'value' ] = float ( fit_results . values [ k_temp ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( k == 'non_fitting_values' ) : #NEWLINE# #INDENT# logger . debug ( 'Ignore non fitting values.' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . warning ( 'values not updated: {}' . format ( k ) )