Fit Catalog

Fit Catalog — Ordered catalog of different NcmMSet parameter values.

Properties

gchar * filename Read / Write
gdouble flush-interval Read / Write / Construct
NcmMSetCatalogFlush fmode Read / Write / Construct
NcmMSet * mset Read / Write / Construct Only
guint nadd-vals Read / Write / Construct Only
NcmRNG * rng Read / Write
gchar * run-type-string Read / Write / Construct

Object Hierarchy

    GEnum
    ╰── NcmMSetCatalogFlush
    GObject
    ╰── NcmMSetCatalog

Description

This class defines a catalog type object. This object can automatically syncronise with a fits file (thought cfitsio).

For Motecarlo studies like resampling from a fiducial model or bootstrap it is used to save the values of the best-fit values for each realization. Since the order of resampling is important due to the fact that we use the same pseudo-random number generator for all resamplings, this object also guarantees the order of the samples added.

For Markov Chain Montecarlo this object saves the value of the same likelihood in different points of the parameter space.

For both applications this object keeps an interactive mean and variance for the parameters added, this allows a sample by sample analyses of the convergence.

Functions

ncm_mset_catalog_new ()

NcmMSetCatalog *
ncm_mset_catalog_new (NcmMSet *mset,
                      guint nadd_vals,
                      ...);

Creates a new NcmMSetCatalog based on the NcmFit object fit . The catalog assumes that the fit object will remain with the same set of free parameters during his whole lifetime.

Parameters

mset

a NcmMSet.

 

nadd_vals

number of additional values.

 

...

additional values names.

 

Returns

a new NcmMSetCatalog.

[transfer full]


ncm_mset_catalog_free ()

void
ncm_mset_catalog_free (NcmMSetCatalog *mcat);

Decrese the reference count of mcat atomically.

Parameters

mcat

a NcmMSetCatalog

 

ncm_mset_catalog_clear ()

void
ncm_mset_catalog_clear (NcmMSetCatalog **mcat);

Decrese the reference count of *mcat atomically and sets the pointer *mcat to null.

Parameters

mcat

a NcmMSetCatalog

 

ncm_mset_catalog_set_add_val_name ()

void
ncm_mset_catalog_set_add_val_name (NcmMSetCatalog *mcat,
                                   guint i,
                                   const gchar *name);

Sets the i -th additional value name.

Parameters

mcat

a NcmMSetCatalog.

 

i

index of the additional value.

 

name

additional value name.

 

ncm_mset_catalog_set_file ()

void
ncm_mset_catalog_set_file (NcmMSetCatalog *mcat,
                           const gchar *filename);

Sets the data filename to be used to sync/save data.

Parameters

mcat

a NcmMSetCatalog

 

filename

a filename

 

ncm_mset_catalog_set_flush_mode ()

void
ncm_mset_catalog_set_flush_mode (NcmMSetCatalog *mcat,
                                 NcmMSetCatalogFlush fmode);

Sets the flush mode to fmode .

Parameters

mcat

a NcmMSetCatalog

 

fmode

flush mode

 

ncm_mset_catalog_set_flush_interval ()

void
ncm_mset_catalog_set_flush_interval (NcmMSetCatalog *mcat,
                                     gdouble interval);

Sets the minimum time interval between flushs.

Parameters

mcat

a NcmMSetCatalog

 

interval

Minimum time interval between flushs

 

ncm_mset_catalog_set_first_id ()

void
ncm_mset_catalog_set_first_id (NcmMSetCatalog *mcat,
                               gint first_id);

Sets the first id of the catalog, mainly used to inform in which realization the catalog starts.

Parameters

mcat

a NcmMSetCatalog

 

first_id

the id of the first item in the sample.

 

ncm_mset_catalog_set_run_type ()

void
ncm_mset_catalog_set_run_type (NcmMSetCatalog *mcat,
                               const gchar *rtype_str);

Sets the run type string.

Parameters

mcat

a NcmMSetCatalog

 

rtype_str

the run type string.

 

ncm_mset_catalog_set_rng ()

void
ncm_mset_catalog_set_rng (NcmMSetCatalog *mcat,
                          NcmRNG *rng);

Sets the random number generator.

Parameters

mcat

a NcmMSetCatalog

 

rng

a NcmRNG.

 

ncm_mset_catalog_sync ()

void
ncm_mset_catalog_sync (NcmMSetCatalog *mcat,
                       gboolean check);

Syncronise memory and data file. If no file was defined simply returns.

Parameters

mcat

a NcmMSetCatalog

 

check

whether to check consistence between file and memory data.

 

ncm_mset_catalog_reset ()

void
ncm_mset_catalog_reset (NcmMSetCatalog *mcat);

Clean all catalog data from memory and file. Otherwise it does not change any object's parameter.

Parameters

mcat

a NcmMSetCatalog

 

ncm_mset_catalog_erase_data ()

void
ncm_mset_catalog_erase_data (NcmMSetCatalog *mcat);

This function erases all data from the fits file associated with the catalog.

Parameters

mcat

a NcmMSetCatalog

 

ncm_mset_catalog_peek_filename ()

const gchar *
ncm_mset_catalog_peek_filename (NcmMSetCatalog *mcat);

Gets the filename associated with mcat .

Parameters

mcat

a NcmMSetCatalog

 

Returns

filename or NULL.

[transfer none]


ncm_mset_catalog_is_empty ()

gboolean
ncm_mset_catalog_is_empty (NcmMSetCatalog *mcat);

Parameters

mcat

a NcmMSetCatalog

 

Returns

TRUE when the catalog is empty;


ncm_mset_catalog_largest_error ()

gdouble
ncm_mset_catalog_largest_error (NcmMSetCatalog *mcat);

Calculates the largest proportional error of the parameters included, i.e., $\text{lre} = \sigma_{\hat{p}}/(|\hat{p}|\sqrt{n})$ where $n$ represents the number of samples in the catalog, $\hat{p}$ is the estimated mean of the parameter $p$ and $\sigma_{\hat{p}}$ its standard deviation.

It tries to guess when $p = 0$. In this case $\sigma_{\hat{p}} \approx |\hat{p}|\sqrt{n}$, therefore for $n > 10$ it tests if $\text{lre} \approx 1$ and if it is the case it returns $\text{lre} = \sigma_{\hat{p}}/\sqrt{n}$ instead.

Parameters

mcat

a NcmMSetCatalog

 

Returns

$\text{lre}$.


ncm_mset_catalog_len ()

guint
ncm_mset_catalog_len (NcmMSetCatalog *mcat);

Number of itens in the catalog.

Parameters

mcat

a NcmMSetCatalog

 

Returns

number of itens in the catalog.


ncm_mset_catalog_add_from_mset ()

void
ncm_mset_catalog_add_from_mset (NcmMSetCatalog *mcat,
                                NcmMSet *mset,
                                ...);

Adds a new element to the catalog using the parameters from mset . It assumes that mset is compatible with the catalog and expect the right number of additional values.

Parameters

mcat

a NcmMSetCatalog

 

mset

a NcmMSet

 

...

additional values.

 

ncm_mset_catalog_add_from_mset_array ()

void
ncm_mset_catalog_add_from_mset_array (NcmMSetCatalog *mcat,
                                      NcmMSet *mset,
                                      gdouble *ax);

Adds a new element to the catalog using the parameters from mset . It assumes that mset is compatible with the catalog and expect the right number of additional values in the array ax .

Parameters

mcat

a NcmMSetCatalog

 

mset

a NcmMSet

 

ax

additional values array.

[array][element-type double]

ncm_mset_catalog_add_from_vector ()

void
ncm_mset_catalog_add_from_vector (NcmMSetCatalog *mcat,
                                  NcmVector *vals);

Adds a new element to the catalog using the values from the vector vals .

Parameters

mcat

a NcmMSetCatalog

 

vals

a NcmVector

 

ncm_mset_catalog_log_current_stats ()

void
ncm_mset_catalog_log_current_stats (NcmMSetCatalog *mcat);

Logs the current means and standard deviations of the catalog's parameters.

Parameters

mcat

a NcmMSetCatalog

 

ncm_mset_catalog_peek_current_row ()

NcmVector *
ncm_mset_catalog_peek_current_row (NcmMSetCatalog *mcat);

Gets the last added row.

Parameters

mcat

a NcmMSetCatalog

 

Returns

last added row or NULL if empty.

[transfer none]


ncm_mset_catalog_get_mean ()

void
ncm_mset_catalog_get_mean (NcmMSetCatalog *mcat,
                           NcmVector **mean);

Gets the current mean vector.

Parameters

mcat

a NcmMSetCatalog

 

mean

a NcmVector.

[inout][allow-none][transfer full]

ncm_mset_catalog_get_covar ()

void
ncm_mset_catalog_get_covar (NcmMSetCatalog *mcat,
                            NcmMatrix **cov);

Gets the current covariance matrix.

Parameters

mcat

a NcmMSetCatalog

 

cov

a NcmMatrix.

[inout][allow-none][transfer full]

ncm_mset_catalog_param_pdf ()

void
ncm_mset_catalog_param_pdf (NcmMSetCatalog *mcat,
                            guint i);

Bins and calculates the pdf associated with the parameter i . (not ready yet FIXME)

Parameters

mcat

a NcmMSetCatalog

 

i

parameter index.

 

ncm_mset_catalog_param_pdf_pvalue ()

gdouble
ncm_mset_catalog_param_pdf_pvalue (NcmMSetCatalog *mcat,
                                   gdouble pval,
                                   gboolean both);

Calculates the p-value associated with the parameter value pval .

Parameters

mcat

a NcmMSetCatalog

 

pval

parameter value

 

both

one or both sides p-value.

 

Returns

the p-value.

Types and Values

enum NcmMSetCatalogFlush

Catalog flush modes.

Members

NCM_MSET_CATALOG_FLUSH_DISABLE

Catalog will flush only when closing the file.

 

NCM_MSET_CATALOG_FLUSH_AUTO

Catalog will flush in every catalog addition.

 

NCM_MSET_CATALOG_FLUSH_TIMED

Catalog will flush with a minimum time interval between flushs.

 

NCM_MSET_CATALOG_EXTNAME

#define NCM_MSET_CATALOG_EXTNAME "NcmMSetCatalog:DATA"

NCM_MSET_CATALOG_M2LNL_COLNAME

#define NCM_MSET_CATALOG_M2LNL_COLNAME "NcmFit:m2lnL"

NCM_MSET_CATALOG_FIRST_ID_LABEL

#define NCM_MSET_CATALOG_FIRST_ID_LABEL "FIRST_ID"

NCM_MSET_CATALOG_RNG_ALGO_LABEL

#define NCM_MSET_CATALOG_RNG_ALGO_LABEL "RNG_ALGO"

NCM_MSET_CATALOG_RNG_SEED_LABEL

#define NCM_MSET_CATALOG_RNG_SEED_LABEL "RNG_SEED"

NCM_MSET_CATALOG_RNG_STAT_LABEL

#define NCM_MSET_CATALOG_RNG_STAT_LABEL "RNG_STAT"

NCM_MSET_CATALOG_RNG_INIS_LABEL

#define NCM_MSET_CATALOG_RNG_INIS_LABEL "RNG_INIS"

NCM_MSET_CATALOG_NROWS_LABEL

#define NCM_MSET_CATALOG_NROWS_LABEL "NAXIS2"

NCM_MSET_CATALOG_RTYPE_LABEL

#define NCM_MSET_CATALOG_RTYPE_LABEL "RTYPE"

NCM_MSET_CATALOG_RTYPE_BSTRAP_MEAN

#define NCM_MSET_CATALOG_RTYPE_BSTRAP_MEAN "bootstrap-mean"

NCM_MSET_CATALOG_RTYPE_UNDEFINED

#define NCM_MSET_CATALOG_RTYPE_UNDEFINED "undefined-run"

NCM_MSET_CATALOG_FSYMB_LABEL

#define NCM_MSET_CATALOG_FSYMB_LABEL "FSYMB"

Property Details

The “filename” property

  “filename”                 gchar *

Catalog filename.

Flags: Read / Write

Default value: NULL


The “flush-interval” property

  “flush-interval”           gdouble

Data flush interval.

Flags: Read / Write / Construct

Allowed values: [0,1000]

Default value: 10


The “fmode” property

  “fmode”                    NcmMSetCatalogFlush

Catalog flush mode.

Flags: Read / Write / Construct

Default value: NCM_MSET_CATALOG_FLUSH_AUTO


The “mset” property

  “mset”                     NcmMSet *

NcmMSet object.

Flags: Read / Write / Construct Only


The “nadd-vals” property

  “nadd-vals”                guint

Number of additional values.

Flags: Read / Write / Construct Only

Allowed values: >= 1

Default value: 1


The “rng” property

  “rng”                      NcmRNG *

Random number generator object.

Flags: Read / Write


The “run-type-string” property

  “run-type-string”          gchar *

Run type string.

Flags: Read / Write / Construct

Default value: "undefined-run"