Fit Catalog

Fit Catalog — Ordered catalog of different fits or likelihood values.

Properties

gchar * filename Read / Write
NcmFit * fit Read / Write / Construct Only
gdouble flush-interval Read / Write / Construct
NcmFitCatalogFlush fmode Read / Write / Construct
gchar * run-type-string Read / Write / Construct

Object Hierarchy

    GEnum
    ╰── NcmFitCatalogFlush
    GObject
    ╰── NcmFitCatalog

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_fit_catalog_new ()

NcmFitCatalog *
ncm_fit_catalog_new (NcmFit *fit);

Creates a new NcmFitCatalog 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

fit

a NcmFit

 

Returns

a new NcmFitCatalog.

[transfer full]


ncm_fit_catalog_free ()

void
ncm_fit_catalog_free (NcmFitCatalog *fcat);

Decrese the reference count of fcat atomically.

Parameters

fcat

a NcmFitCatalog

 

ncm_fit_catalog_clear ()

void
ncm_fit_catalog_clear (NcmFitCatalog **fcat);

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

Parameters

fcat

a NcmFitCatalog

 

ncm_fit_catalog_set_file ()

void
ncm_fit_catalog_set_file (NcmFitCatalog *fcat,
                          const gchar *filename);

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

Parameters

fcat

a NcmFitCatalog

 

filename

a filename

 

ncm_fit_catalog_set_flush_mode ()

void
ncm_fit_catalog_set_flush_mode (NcmFitCatalog *fcat,
                                NcmFitCatalogFlush fmode);

Sets the flush mode to fmode .

Parameters

fcat

a NcmFitCatalog

 

fmode

flush mode

 

ncm_fit_catalog_set_flush_interval ()

void
ncm_fit_catalog_set_flush_interval (NcmFitCatalog *fcat,
                                    gdouble interval);

Sets the minimum time interval between flushs.

Parameters

fcat

a NcmFitCatalog

 

interval

Minimum time interval between flushs

 

ncm_fit_catalog_set_first_id ()

void
ncm_fit_catalog_set_first_id (NcmFitCatalog *fcat,
                              gint first_id);

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

Parameters

fcat

a NcmFitCatalog

 

first_id

the id of the first item in the sample.

 

ncm_fit_catalog_set_run_type ()

void
ncm_fit_catalog_set_run_type (NcmFitCatalog *fcat,
                              const gchar *rtype_str);

Sets the run type string.

Parameters

fcat

a NcmFitCatalog

 

rtype_str

the run type string.

 

ncm_fit_catalog_sync ()

void
ncm_fit_catalog_sync (NcmFitCatalog *fcat,
                      gboolean check);

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

Parameters

fcat

a NcmFitCatalog

 

check

whether to check consistence between file and memory data.

 

ncm_fit_catalog_reset ()

void
ncm_fit_catalog_reset (NcmFitCatalog *fcat);

Clean all catalog data, close any opened file. Otherwise it does not change any object's parameter.

Parameters

fcat

a NcmFitCatalog

 

ncm_fit_catalog_erase_data ()

void
ncm_fit_catalog_erase_data (NcmFitCatalog *fcat);

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

Parameters

fcat

a NcmFitCatalog

 

ncm_fit_catalog_peek_filename ()

const gchar *
ncm_fit_catalog_peek_filename (NcmFitCatalog *fcat);

Gets the filename associated with fcat .

Parameters

fcat

a NcmFitCatalog

 

Returns

filename or NULL.

[transfer none]


ncm_fit_catalog_is_empty ()

gboolean
ncm_fit_catalog_is_empty (NcmFitCatalog *fcat);

Parameters

fcat

a NcmFitCatalog

 

Returns

TRUE when the catalog is empty;


ncm_fit_catalog_largest_error ()

gdouble
ncm_fit_catalog_largest_error (NcmFitCatalog *fcat);

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

fcat

a NcmFitCatalog

 

Returns

$\text{lre}$.


ncm_fit_catalog_len ()

guint
ncm_fit_catalog_len (NcmFitCatalog *fcat);

Number of itens in the catalog.

Parameters

fcat

a NcmFitCatalog

 

Returns

number of itens in the catalog.


ncm_fit_catalog_get_prng ()

gboolean
ncm_fit_catalog_get_prng (NcmFitCatalog *fcat,
                          gchar **prng_algo,
                          gulong *seed);

This function checks if any pseudo random number generator (PRNG) is registred in the catalog and returns its properties in prng_algo and seed if so.

Parameters

fcat

a NcmFitCatalog

 

prng_algo

the name of the PRNG algorithm.

[out callee-allocates][transfer full][allow-none]

seed

the seed used to initialize the PRNG.

[out caller-allocates][allow-none]

Returns

TRUE if a PRNG is defined in the catalog.


ncm_fit_catalog_set_prng ()

void
ncm_fit_catalog_set_prng (NcmFitCatalog *fcat,
                          NcmRNG *rng);

This function sets the pseudo random number generator (PRNG) description in the catalog.

Parameters

fcat

a NcmFitCatalog

 

rng

the NcmRNG used.

 

ncm_fit_catalog_add_from_fit ()

void
ncm_fit_catalog_add_from_fit (NcmFitCatalog *fcat,
                              NcmFit *fit);

Adds a new element to the catalog using the parameters and likelihood value from fit . It assumes that fit is compatible with the catalog.

Parameters

fcat

a NcmFitCatalog

 

fit

a NcmFit

 

ncm_fit_catalog_add_from_vector ()

void
ncm_fit_catalog_add_from_vector (NcmFitCatalog *fcat,
                                 NcmVector *vals);

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

Parameters

fcat

a NcmFitCatalog

 

vals

a NcmVector

 

ncm_fit_catalog_log_current_stats ()

void
ncm_fit_catalog_log_current_stats (NcmFitCatalog *fcat);

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

Parameters

fcat

a NcmFitCatalog

 

ncm_fit_catalog_set_fit_mean_covar ()

void
ncm_fit_catalog_set_fit_mean_covar (NcmFitCatalog *fcat);

Sets the NcmFit object parameters using the means from fcat and the covariance with the covariance of fcat .

Parameters

fcat

a NcmFitCatalog

 

ncm_fit_catalog_param_pdf ()

void
ncm_fit_catalog_param_pdf (NcmFitCatalog *fcat,
                           guint i);

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

Parameters

fcat

a NcmFitCatalog

 

i

parameter index.

 

ncm_fit_catalog_param_pdf_pvalue ()

gdouble
ncm_fit_catalog_param_pdf_pvalue (NcmFitCatalog *fcat,
                                  gdouble pval,
                                  gboolean both);

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

Parameters

fcat

a NcmFitCatalog

 

pval

parameter value

 

both

one or both sides p-value.

 

Returns

the p-value.

Types and Values

enum NcmFitCatalogFlush

Catalog flush modes.

Members

NCM_FIT_CATALOG_FLUSH_DISABLE

Catalog will flush only when closing the file.

 

NCM_FIT_CATALOG_FLUSH_AUTO

Catalog will flush in every catalog addition.

 

NCM_FIT_CATALOG_FLUSH_TIMED

Catalog will flush with a minimum time interval between flushs.

 

NCM_FIT_CATALOG_EXTNAME

#define NCM_FIT_CATALOG_EXTNAME "NcmFitCatalog:DATA"

NCM_FIT_CATALOG_M2LNL_COLNAME

#define NCM_FIT_CATALOG_M2LNL_COLNAME "NcmFit:m2lnL"

NCM_FIT_CATALOG_FIRST_ID_LABEL

#define NCM_FIT_CATALOG_FIRST_ID_LABEL "FIRST_ID"

NCM_FIT_CATALOG_PRNG_ALGO_LABEL

#define NCM_FIT_CATALOG_PRNG_ALGO_LABEL "RNG_ALGO"

NCM_FIT_CATALOG_PRNG_SEED_LABEL

#define NCM_FIT_CATALOG_PRNG_SEED_LABEL "RNG_SEED"

NCM_FIT_CATALOG_NROWS_LABEL

#define NCM_FIT_CATALOG_NROWS_LABEL "NAXIS2"

NCM_FIT_CATALOG_RTYPE_LABEL

#define NCM_FIT_CATALOG_RTYPE_LABEL "RTYPE"

NCM_FIT_CATALOG_RTYPE_BSTRAP_MEAN

#define NCM_FIT_CATALOG_RTYPE_BSTRAP_MEAN "bootstrap-mean"

NCM_FIT_CATALOG_RTYPE_UNDEFINED

#define NCM_FIT_CATALOG_RTYPE_UNDEFINED "undefined-run"

NCM_FIT_CATALOG_FSYMB_LABEL

#define NCM_FIT_CATALOG_FSYMB_LABEL "FSYMB"

Property Details

The “filename” property

  “filename”                 gchar *

Catalog filename.

Flags: Read / Write

Default value: NULL


The “fit” property

  “fit”                      NcmFit *

Fit object.

Flags: Read / Write / Construct Only


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”                    NcmFitCatalogFlush

Catalog flush mode.

Flags: Read / Write / Construct

Default value: NCM_FIT_CATALOG_FLUSH_AUTO


The “run-type-string” property

  “run-type-string”          gchar *

Run type string.

Flags: Read / Write / Construct

Default value: "undefined-run"