Class
NumCosmoMathMSet
Description [src]
class NumCosmoMath.MSet : GObject.Object
{
/* No available fields */
}
A set of different NcmModel objects.
A NcmMSet is a set of different NcmModel objects. It is used to
represent a set of models that can be used to fit a data set.
When the model class is created the class method ncm_mset_model_register_id()
must be used to register the model class. This function must be used once
and only once in the model class definition. Any subclasse of the model
class will inherit the model id. The same compilation unit must call the macro
NCM_MSET_MODEL_REGISTER_ID() for each model class that will be used in the NcmMSet.
It should also include NCM_MSET_MODEL_DECLARE_ID() in the header file.
Models can be stackable or not. If a model is stackable, the NcmMSet can contain
more than one instance of the same model. If a model is not stackable, the NcmMSet
can contain only one instance of the model.
The model can be a submodel of another model. In this case, the model class must set the main_model_id field to the model id of the parent model. If it is the main model, the main_model_id must be set to NCM_MSET_MODEL_MAIN().
The NcmMSet can be created empty or with a list of models. The stackable models can
be added to the NcmMSet using the function ncm_mset_push() to add the model to the
end of the list or using ncm_mset_set_pos() to add the model in a specific position.
The non-stackable models can be added using ncm_mset_set(). For both
ncm_mset_set_pos() and ncm_mset_set() if there is already a model in the position
it will be replaced.
Constructors
ncm_mset_load
Loads a NcmMSet from a configuration file using the NcmSerialize
object ser. The file must be in the same format as the one
generated by ncm_mset_save().
Functions
ncm_mset_clear
If mse is not NULL, decreases the reference count of mset by one. If the
reference count drops to 0, all memory allocated by mset is released and mset is
set to NULL.
ncm_mset_model_register_id
Register a model class in the NcmMSet. This function must be used once and only
once in the model class definition. Any subclasse of the model class will inherit
the model id. The same compilation unit must call the macro
NCM_MSET_MODEL_REGISTER_ID() for each model class that will be used in the NcmMSet.
It should also include NCM_MSET_MODEL_DECLARE_ID() in the header file.
ncm_mset_split_full_name
Splits the fullname into model_ns, stackpos_id and pname. The fullname
should be specified with the parameter full name “model:parameter_name”
or “model:stackposition:parameter_name”.
Instance methods
ncm_mset___getitem__
Gets the model with the id model_id.
This method is used to implement the Python getitem method.
The parameter model_id is a GValue which can be an integer
containing the model id or a string containing the model namespace.
ncm_mset___setitem__
Sets the model with the id model_id to model.
This method is used to implement the Python setitem method.
The parameter model_id is a GValue which can be an integer
containing the model id or a string containing the model namespace.
ncm_mset_cmp
Compares mset0 and mset1 and returns TRUE if both contains the same models types.
If cmp_model is TRUE compare also if the models correspond to the same objects types.
ncm_mset_cmp_all
Compares two NcmMSet objects. It returns 0 if they contain the same
models, with the same number of parameters, in the same order. It
returns -1 if mset0 has fewer models than mset1, or if they have
the same number of models but mset0 has a model with fewer
parameters than the corresponding model in mset1. It returns 1 if
mset0 has more models than mset1, or if they have the same number
of models but mset0 has a model with more parameters than the
corresponding model in mset1.
ncm_mset_exists_pos
Checks whether a NcmModel with the same id as model and stack position
stackpos_id exists in the NcmMSet.
ncm_mset_fetch
Fetches a NcmModel from the NcmMSet using the model id mid.
If the model is not found, an error is set.
ncm_mset_fetch_by_name
Fetches a NcmModel from the NcmMSet using the model namespace name.
The name may be specified with the parameter full name “model:stackposition”.
If the stack position is not specified, the first model with the model namespace
name will be returned.
If the model is not found, an error is set.
ncm_mset_fparam_full_name
Gets the full name of the n-th free parameter. That is
the name of the model, the stack position and the parameter name.
ncm_mset_fparam_get_bound_matrix
Gets a matrix with the lower and upper bounds of all free parameters.
The returned matrix has two columns, the first column contains the
lower bounds and the second column contains the upper bounds.
The number of rows is equal to the number of free parameters in mset.
ncm_mset_fparam_get_pi_by_name
Gets the NcmMSetPIndex of the parameter identified by name.
The name can be the parameter name or the full name.
ncm_mset_fparam_valid_bounds_offset
Checks if the values of theta respect the parameter bounds.
The values are checked starting at offset.
ncm_mset_fparams_get_vector
Gets the free parameters of mset and stores them in x.
The size of x must be equal to the number of free parameters
in mset ncm_mset_fparams_len().
ncm_mset_fparams_get_vector_offset
Gets the free parameters of mset and stores them in x starting
at offset. The size of x must be equal to the number of free
parameters in mset ncm_mset_fparams_len() plus offset.
ncm_mset_fparams_log_covar
Logs the covariance matrix of the free parameters in mset.
The covariance matrix is assumed to be in the same order as
the free parameters in mset and must be square and with
the same size as the number of free parameters ncm_mset_fparam_len().
ncm_mset_fparams_set_array
Sets the free parameters of mset using the values of x.
The size of x must be equal to the number of free parameters
in mset ncm_mset_fparams_len(). Otherwise the behaviour is undefined.
ncm_mset_fparams_set_gsl_vector
Sets the free parameters of mset using the values of x.
The size of x must be equal to the number of free parameters
in mset ncm_mset_fparams_len().
ncm_mset_fparams_set_vector
Sets the free parameters of mset using the values of x.
The size of x must be equal to the number of free parameters
in mset ncm_mset_fparams_len().
ncm_mset_fparams_set_vector_offset
Set the free parameters of mset using the values of x starting
at offset.
ncm_mset_free
Atomically decreases the reference count of mset by one. If the reference count drops to 0,
all memory allocated by mset is released.
ncm_mset_get_fmap
Gets the free parameters map for mset. The returned array must be
freed with g_strfreev. It contains the full names of the free
parameters in mset.
ncm_mset_get_mid_array_pos
Gets the model id of the model in the array position i.
The array position is not guaranteed to be the same for different
NcmMSet objects. This function is useful to iterate over the models
in the NcmMSet.
ncm_mset_is_subset
Checks whether sub_mset is a subset of mset, that is,
whether all models in sub_mset are also in mset.
ncm_mset_max_fparam_name
Gets the maximum length of the free parameter names in mset.
This function is useful to print the parameters in a pretty way.
ncm_mset_max_model_nick
Gets the maximum length of the model nick in mset.
This function is useful to print the models in a pretty way.
ncm_mset_max_param_name
Gets the maximum length of the parameter names in mset.
This function is useful to print the parameters in a pretty way.
ncm_mset_orig_param_get
Gets the value of the original parameter pid in the model mid.
That is the value of the parameter before any reparametrization.
ncm_mset_param_get_by_full_name
Gets the NcmMSetPIndex of the parameter identified by fullname.
The fullname must be in the form “model:stackpos:param_name” when
the model has a stack or “model:param_name” when the model has no stack.
ncm_mset_param_get_pi
Gets the values of the parameters in mset and stores them in x.
The parameters are identified by the NcmMSetPIndex pi. This array
and x must have the same size n.
ncm_mset_param_get_scale
Gets the scale of the parameter pid in the model mid.
This scale is a value that is used as a starting guess
for the variation of the parameter in a statistical analysis.
ncm_mset_param_set
Sets the value of the parameter pid in the model mid to x.
This function updates the model parameters.
ncm_mset_param_set0
Sets the value of the parameter pid in the model mid to x.
This function does not update the model parameters. It is useful
when the parameters are being updated in a loop and the model
parameters are updated only once, after the loop.
ncm_mset_param_set_ftype
Sets the type of the parameter pid in the model mid to ftype.
The parameter type can be fixed (#NCM_PARAM_TYPE_FIXED) or free (#NCM_PARAM_TYPE_FREE).
ncm_mset_param_set_ftype_from_fmap
Set all parameters of all models inside mset in order
to reflect the current fmap.
ncm_mset_param_set_mset
Copy parameters from mset_src to mset_dest, both NcmMSet must
be compatible.
ncm_mset_param_set_pi
Sets the values of the parameters in mset using the values in x.
The parameters are identified by the NcmMSetPIndex pi. This array
and x must have the same size n.
ncm_mset_param_set_scale
Sets the scale of the parameter pid in the model mid to scale.
This scale is a value that is used as a starting guess
for the variation of the parameter in a statistical analysis.
ncm_mset_param_symbol
Gets the symbol of the parameter pid in the model mid. The
parameter symbol is a string that represents the parameter
using LaTeX symbols.
ncm_mset_params_pretty_print
This function print the command line (first line, commented), the model nick and parameters’ names (second line, commented) and their values indicating if they are fixed or free.
ncm_mset_peek_array_pos
Peeks a NcmModel from the NcmMSet using the array position i.
The array position is not guaranteed to be the same for different
NcmMSet objects. This function is useful to iterate over the models
in the NcmMSet.
ncm_mset_peek_by_name
Peeks a NcmModel from the NcmMSet using the model namespace name.
The name may be specified with the parameter full name “model:stackposition”.
If the stack position is not specified, the first model with the model namespace
name will be returned.
ncm_mset_peek_pos
Peeks a NcmModel from the NcmMSet using the model id base_mid and stack position
stackpos_id. This function is useful when the model is stackable.
ncm_mset_prepare_fparam_map
Computes the free parameters map for mset. This function must be
called before any other function that uses the free parameters map.
ncm_mset_pretty_log
This function prints the contents of mset. It prints the model
nick and parameters’ names and their values indicating if they are
fixed or free.
ncm_mset_push
Pushes a NcmModel to the end of the NcmMSet. If the model is not stackable,
it will be added to the first position, if there is already a model with the
same model id an error will be raised.
ncm_mset_set
Sets a NcmModel in the NcmMSet. If there is already a model with the same
model id, it will be replaced. If it is a stackable model, it will be added
to the first position.
ncm_mset_set_fmap
Sets the free parameters map for mset. This function must be called
before any other function that uses the free parameters map. The fmap
array must be zero-terminated and contain the full names of the free
parameters in mset.
ncm_mset_set_pos
Sets a NcmModel in the NcmMSet in the stack position stackpos_id.
If there is already a model with the same model id, it will be replaced.
If it is a stackable model, it will be added to the position stackpos_id.
If stackpos_id is 0, it will be added to the first position.
ncm_mset_total_len
Gets the total number of parameters in mset (including fixed and
free parameters).
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.