Top |
void | (*NcmFitMCResample) () |
NcmFitMC * | ncm_fit_mc_new () |
void | ncm_fit_mc_free () |
void | ncm_fit_mc_clear () |
void | ncm_fit_mc_set_data_file () |
void | ncm_fit_mc_set_mtype () |
void | ncm_fit_mc_set_rtype () |
void | ncm_fit_mc_set_nthreads () |
void | ncm_fit_mc_keep_order () |
void | ncm_fit_mc_set_fiducial () |
void | ncm_fit_mc_set_rng () |
gboolean | ncm_fit_mc_is_running () |
void | ncm_fit_mc_start_run () |
void | ncm_fit_mc_end_run () |
void | ncm_fit_mc_reset () |
void | ncm_fit_mc_set_first_sample_id () |
void | ncm_fit_mc_run () |
void | ncm_fit_mc_run_lre () |
void | ncm_fit_mc_mean_covar () |
NcmMSetCatalog * | ncm_fit_mc_get_catalog () |
NcmMSetCatalog * | ncm_fit_mc_peek_catalog () |
NcmMSet * | fiducial | Read / Write / Construct |
NcmFit * | fit | Read / Write / Construct Only |
gboolean | keep-order | Read / Write / Construct |
NcmFitRunMsgs | mtype | Read / Write |
guint | nthreads | Read / Write |
NcmFitMCResampleType | rtype | Read / Write / Construct |
#define | NCM_TYPE_FIT_MC |
enum | NcmFitMCResampleType |
#define | NCM_FIT_MC_MIN_SYNC_INTERVAL |
NcmFitMC |
This object implements a Monte Carlo analysis. This object is initialized with a NcmFit object and a NcmMSet object. The NcmFit object is used to calculate the likelihood of the NcmMSet object. The NcmMSet object is used to sample the parameter space.
The NcmFitMC object will resample the likelihood using the input NcmMSet object as a fiducial model. The resampling can be done in three ways: NCM_FIT_MC_RESAMPLE_FROM_MODEL, NCM_FIT_MC_RESAMPLE_BOOTSTRAP_NOMIX and NCM_FIT_MC_RESAMPLE_BOOTSTRAP_MIX. The first option will resample the likelihood from the input NcmMSet object. The other two options will resample the likelihood from the original likelihood data using bootstrap resampling. The difference between the last two options is that the NCM_FIT_MC_RESAMPLE_BOOTSTRAP_NOMIX will resample each NcmData separately while the NCM_FIT_MC_RESAMPLE_BOOTSTRAP_MIX will resample all NcmData together.
NcmFitMC * ncm_fit_mc_new (NcmFit *fit
,NcmFitMCResampleType rtype
,NcmFitRunMsgs mtype
);
Creates a new NcmFitMC object with the fit object fit
, the resample type
rtype
and the run messages type mtype
.
void
ncm_fit_mc_free (NcmFitMC *mc
);
Decrement the reference count atomically by one. If the reference count reaches zero, all memory allocated by the object is released and the object is freed.
void
ncm_fit_mc_clear (NcmFitMC **mc
);
When this function is invoked, it first checks whether *mc
is not NULL
. If *mc
is
not NULL, the function reduces the reference count of *mc
by one. If the reference
count reaches zero, all memory allocated by the object is released, the object is
freed, and *mc
is set to NULL
.
void ncm_fit_mc_set_data_file (NcmFitMC *mc
,const gchar *filename
);
Sets the data file to be used by the NcmMSetCatalog object of mc
.
void ncm_fit_mc_set_mtype (NcmFitMC *mc
,NcmFitRunMsgs mtype
);
Sets the run messages type of mc
to mtype
.
void ncm_fit_mc_set_rtype (NcmFitMC *mc
,NcmFitMCResampleType rtype
);
Sets the resample type of mc
to rtype
.
void ncm_fit_mc_set_nthreads (NcmFitMC *mc
,guint nthreads
);
Sets the number of threads to be used by mc
to nthreads
.
void ncm_fit_mc_keep_order (NcmFitMC *mc
,gboolean keep_order
);
Sets whether keep the catalog in order of sampling. When performing
parallel runs, the catalog is not kept in order of sampling. This
is done to avoid the overhead of locking the catalog. If you want
to keep the catalog in order of sampling, set this property to
TRUE
.
void ncm_fit_mc_set_fiducial (NcmFitMC *mc
,NcmMSet *fiduc
);
Sets the fiducial model of mc
to fiduc
. If fiduc
is NULL
, the fiducial
model is set to the model set of the fit object of mc
. If fiduc
is not
NULL
, the fiducial model is set to fiduc
. If fiduc
is not NULL
, it must
be equal to the model set of the fit object of mc
.
Note that in the end of an analysis, the NcmMSet in mc
will be equal to
the last sampled model set.
void ncm_fit_mc_set_rng (NcmFitMC *mc
,NcmRNG *rng
);
Sets the RNG object of mc
to rng
.
gboolean
ncm_fit_mc_is_running (NcmFitMC *mc
);
Checks whether a run is running, that is whether ncm_fit_mc_start_run()
was called and ncm_fit_mc_end_run()
was not called yet.
void
ncm_fit_mc_start_run (NcmFitMC *mc
);
Starts a Monte Carlo run. This function will start a Monte Carlo run
using the NcmFit object and the NcmMSet object of mc
.
This method will not compute the any likelihood. It will only start
the run. To compute samples, call ncm_fit_mc_run()
or ncm_fit_mc_run_lre()
after this function.
To finish the run, call ncm_fit_mc_end_run()
.
void
ncm_fit_mc_end_run (NcmFitMC *mc
);
Ends a Monte Carlo run. This function will end a Monte Carlo run
using the NcmFit object and the NcmMSet object of mc
.
void
ncm_fit_mc_reset (NcmFitMC *mc
);
Resets the Monte Carlo run. This function will reset the Monte Carlo run erase all samples and reset the catalog.
void ncm_fit_mc_set_first_sample_id (NcmFitMC *mc
,gint first_sample_id
);
Sets the first sample id of the Monte Carlo run to first_sample_id
.
This function will skip all samples until it reaches the first_sample_id
.
void ncm_fit_mc_run (NcmFitMC *mc
,guint n
);
Runs the Monte Carlo until it reaches the n
-th realization. Note that
if the first_id is non-zero it will run n
- first_id realizations.
void ncm_fit_mc_run_lre (NcmFitMC *mc
,guint prerun
,gdouble lre
);
Runs the Monte Carlo until the largest relative error considering the
erros on the parameter means is less than lre
.
void
ncm_fit_mc_mean_covar (NcmFitMC *mc
);
Computes the mean and covariance of the Monte Carlo run.
The mean and covariance are stored in the NcmFit object of mc
.
The mean is stored in the NcmFitState object of the NcmFit object
and in the NcmMSetCatalog object of mc
.
NcmMSetCatalog *
ncm_fit_mc_get_catalog (NcmFitMC *mc
);
Gets the generated catalog of mc
.
NcmMSetCatalog *
ncm_fit_mc_peek_catalog (NcmFitMC *mc
);
Peeks the generated catalog of mc
.
“fiducial”
property“fiducial” NcmMSet *
Fiducial model to sample from.
Owner: NcmFitMC
Flags: Read / Write / Construct
“keep-order”
property “keep-order” gboolean
Whether keep the catalog in order of sampling.
Owner: NcmFitMC
Flags: Read / Write / Construct
Default value: TRUE
“mtype”
property“mtype” NcmFitRunMsgs
Run messages type.
Owner: NcmFitMC
Flags: Read / Write
Default value: NCM_FIT_RUN_MSGS_SIMPLE
“nthreads”
property “nthreads” guint
Number of threads to run.
Owner: NcmFitMC
Flags: Read / Write
Allowed values: <= 100
Default value: 0
“rtype”
property“rtype” NcmFitMCResampleType
Monte Carlo run type.
Owner: NcmFitMC
Flags: Read / Write / Construct
Default value: NCM_FIT_MC_RESAMPLE_FROM_MODEL