lib.samples.profiles.Profiles¶
- class lib.samples.profiles.Profiles(parameters, attrs=None)¶
Bases:
cosmopipe.lib.utils.BaseClassClass holding results of likelihood profiling.
- covariance¶
Parameter covariance at best fit.
- Type
Initialize
Profiles.- Parameters
parameters (list, ParameterCollection) – Parameters used in likelihood profiling.
attrs (dict, default=None) – Other attributes.
Methods
Return index of best best fit among all the tries.
Concatenate profiles together.
Return shallow copy of
self.deepcopyExtend profiles with
other.Instantiate and initalize class with state dictionary.
Access attribute by name.
Has this attribute?
is_mpi_broadcastis_mpi_gatheredis_mpi_rootis_mpi_scatteredLoad class in numpy binary format from disk.
If different formats are possible, this method should between them based on file name extension.
log_criticallog_debuglog_errorlog_infolog_warningReturn number of tries.
Save class to disk.
If different formats are possible, this method should between them based on file name extension.
Set best fit parameter values
values.Set parameter covariance
covariancefor parametersparameters.Set parameter \(\Delta \chi^{2} = 1\) errors
values.Set initial parameter values
values.Set metrics (e.g.
Set parameter parabolic errors
values.Export profiles as
Samples.Export profiling quantities.
Attributes
loggerMPI attributes
mpicommmpirootmpistate- argmin()¶
Return index of best best fit among all the tries.
- classmethod concatenate(*others)¶
Concatenate profiles together.
Warning
attrsof returned profiles contains, for each key, the last value found inothersattrsdictionaries.
- copy()¶
Return shallow copy of
self.
- extend(other)¶
Extend profiles with
other.
- classmethod from_state(state, mpiroot=0, mpicomm=None)¶
Instantiate and initalize class with state dictionary.
- get(name)¶
Access attribute by name.
- has(name)¶
Has this attribute?
- classmethod load(filename, mpiroot=0, mpicomm=None)¶
Load class in numpy binary format from disk. If the loaded state contains
__class__and that exists incls._registry, return instance ofcls._registry[__class__](instead ofcls).
- load_auto(*args, **kwargs)¶
If different formats are possible, this method should between them based on file name extension.
- property mpiattrs¶
MPI attributes
- ntries()¶
Return number of tries.
- save(filename)¶
Save class to disk.
- save_auto(*args, **kwargs)¶
If different formats are possible, this method should between them based on file name extension.
- set_bestfit(values)¶
Set best fit parameter values
values.
- set_covariance(covariance, parameters=None)¶
Set parameter covariance
covariancefor parametersparameters.
- set_deltachi2_errors(values)¶
Set parameter \(\Delta \chi^{2} = 1\) errors
values.
- set_init(values)¶
Set initial parameter values
values.
- set_metrics(values)¶
Set metrics (e.g. ‘loglkl’) dictionary
values.
- set_parabolic_errors(values)¶
Set parameter parabolic errors
values.
- classmethod to_samples(profiles, parameters=None, name='bestfit', select='min')¶
Export profiles as
Samples. This is not statistically meaningful, but convenient to share plotting routines.- Parameters
profiles (list) – List of
Profilesinstances.parameters (list, ParameterCollection, default=None) – Parameters to export. Defaults to all parameters.
name (string, default='bestfit') – Quantity to export as samples.
select (string, default='min') – Rule to select the quantity to export.
- Returns
samples
- Return type
- to_stats(parameters=None, quantities=None, sigfigs=2, tablefmt='latex_raw', filename=None)¶
Export profiling quantities.
- Parameters
parameters (list, ParameterCollection) – Parameters to export quantities for. Defaults to all parameters.
quantities (list, default=None) – Quantities to export. Defaults to
['bestfit','parabolic_errors','deltachi2_errors'].sigfigs (int, default=2) – Number of significant digits. See
utils.round_measurement().tablefmt (string, default='latex_raw') – Format for summary table. See
tabulate.tabulate().filename (string default=None) – If not
None, file name where to save summary table.
- Returns
tab – Summary table.
- Return type
string