def bound_params_from_dict(bound_param_dict):
    """Define `~lmfit.parameter.Parameters` object from dictionary.

    Parameters
    ----------
    bound_param_dict : dictionary
        Dictionary containing the JSON contents of a boundary
        parameter file.

    Returns
    -------
    params : :class:`~lmfit.parameter.Parameters`
        Parameters object.

    """

    params = Parameters()
    for mainpar in EXPECTED_PARAMETER_LIST:
        if mainpar not in bound_param_dict['contents'].keys():
            raise ValueError('Parameter ' + mainpar + ' not found!')
        if bound_param_dict['meta_info']['parmodel'] == "longslit":
            dumdict = bound_param_dict['contents'][mainpar]
            params.add(mainpar, value=dumdict["value"],
                       vary=dumdict["vary"])
        elif bound_param_dict['meta_info']['parmodel'] == 'multislit':
            for subpar in ['a0s', 'a1s', 'a2s']:
                if subpar not in bound_param_dict['contents'][mainpar].keys():
                    raise ValueError('Subparameter ' + subpar + ' not found' +
                                     ' under parameter ' + mainpar)
                cpar = mainpar + '_' + subpar
                dumdict = bound_param_dict['contents'][mainpar][subpar]
                params.add(cpar, value=dumdict["value"],
                           vary=dumdict["vary"])
        else:
            print('parmodel: ', bound_param_dict['meta_info']['parmodel'])
            raise ValueError('Unexpected parmodel')
    return params
def bound_params_from_dict ( bound_param_dict ) : params = Parameters ( ) for mainpar in EXPECTED_PARAMETER_LIST : if mainpar not in bound_param_dict [ 'contents' ] . keys ( ) : raise ValueError ( 'Parameter ' + mainpar + ' not found!' ) if bound_param_dict [ 'meta_info' ] [ 'parmodel' ] == "longslit" : dumdict = bound_param_dict [ 'contents' ] [ mainpar ] params . add ( mainpar , value = dumdict [ "value" ] , vary = dumdict [ "vary" ] ) elif bound_param_dict [ 'meta_info' ] [ 'parmodel' ] == 'multislit' : for subpar in [ 'a0s' , 'a1s' , 'a2s' ] : if subpar not in bound_param_dict [ 'contents' ] [ mainpar ] . keys ( ) : raise ValueError ( 'Subparameter ' + subpar + ' not found' + ' under parameter ' + mainpar ) cpar = mainpar + '_' + subpar dumdict = bound_param_dict [ 'contents' ] [ mainpar ] [ subpar ] params . add ( cpar , value = dumdict [ "value" ] , vary = dumdict [ "vary" ] ) else : print ( 'parmodel: ' , bound_param_dict [ 'meta_info' ] [ 'parmodel' ] ) raise ValueError ( 'Unexpected parmodel' ) return params
Define `~lmfit.parameter.Parameters` object from dictionary.

    Parameters
    ----------
    bound_param_dict : dictionary
        Dictionary containing the JSON contents of a boundary
        parameter file.

    Returns
    -------
    params : :class:`~lmfit.parameter.Parameters`
        Parameters object.