firecrown.likelihood.likelihood.NamedParameters#
- class firecrown.likelihood.likelihood.NamedParameters(mapping=None)[source]#
Bases:
object
Provides access to a set of parameters of a given set of types.
Access to the parameters is provided by a type-safe interface. Each of the access functions assures that the parameter value it returns is of the specified type.
- Parameters:
mapping (
Optional
[Mapping
[str
,Union
[str
,int
,bool
,float
,ndarray
[Any
,dtype
[int64
]],ndarray
[Any
,dtype
[float64
]]]]]) –
Public Methods:
__init__
([mapping])Initialize the object from the supplied mapping of values.
get_bool
(name[, default_value])Return the named parameter as a bool.
get_string
(name[, default_value])Return the named parameter as a string.
get_int
(name[, default_value])Return the named parameter as an int.
get_float
(name[, default_value])Return the named parameter as a float.
get_int_array
(name)Return the named parameter as a numpy array of int.
get_float_array
(name)Return the named parameter as a numpy array of float.
to_set
()Return the contained data as a set.
set_from_basic_dict
(basic_dict)Set the contained data from a dictionary of basic types.
Convert a NamedParameters object to a dictionary of basic types.
- convert_to_basic_dict()[source]#
Convert a NamedParameters object to a dictionary of basic types.
- Return type:
dict
[str
,Union
[str
,float
,int
,bool
,Sequence
[float
],Sequence
[int
],Sequence
[bool
]]]
- get_bool(name, default_value=None)[source]#
Return the named parameter as a bool.
- Parameters:
name (
str
) –default_value (
Optional
[bool
]) –
- Return type:
bool
- get_float(name, default_value=None)[source]#
Return the named parameter as a float.
- Parameters:
name (
str
) –default_value (
Optional
[float
]) –
- Return type:
float
- get_float_array(name)[source]#
Return the named parameter as a numpy array of float.
- Parameters:
name (
str
) –- Return type:
ndarray
[Any
,dtype
[float64
]]
- get_int(name, default_value=None)[source]#
Return the named parameter as an int.
- Parameters:
name (
str
) –default_value (
Optional
[int
]) –
- Return type:
int
- get_int_array(name)[source]#
Return the named parameter as a numpy array of int.
- Parameters:
name (
str
) –- Return type:
ndarray
[Any
,dtype
[int64
]]
- get_string(name, default_value=None)[source]#
Return the named parameter as a string.
- Parameters:
name (
str
) –default_value (
Optional
[str
]) –
- Return type:
str