Config#

class infomeasure.Config[source]

Bases: object

Configuration settings for the package.

This class provides configuration settings for the package. The settings are stored as class attributes and can be accessed and modified using the class methods.

Default settings:

  • base: “e” (nats)

  • statistical_test_method: “permutation_test”

  • statistical_test_n_tests: 200

Attributes:
_settingsdict

A dictionary containing the configuration settings.

Methods

get(key)

Get the value of a configuration setting.

get_logarithmic_unit()

Get the logarithmic unit for entropy calculations.

get_logarithmic_unit_description()

Get the description of the logarithmic unit for entropy calculations.

reset()

Reset the configuration settings to the default values.

set(key, value)

Set the value of a configuration setting.

set_log_level(level)

Set the logging level for the package.

set_logarithmic_unit(unit)

Set the base for the logarithmic unit.

Methods Summary

get(key)

Get the value of a configuration setting.

get_logarithmic_unit()

Get the logarithmic unit for entropy calculations.

get_logarithmic_unit_description()

Get the description of the logarithmic unit for entropy calculations.

reset()

Reset the configuration settings to the default values.

set(key, value)

Set the value of a configuration setting.

set_log_level(level)

Set the logging level for the package.

set_logarithmic_unit(unit)

Set the base for the logarithmic unit.

Methods Documentation

classmethod get(key: str)[source]#

Get the value of a configuration setting.

Parameters:
keystr

The key of the configuration setting.

Returns:
Any

The value of the configuration setting.

classmethod get_logarithmic_unit() str[source]#

Get the logarithmic unit for entropy calculations.

Returns:
str

The logarithmic unit.

classmethod get_logarithmic_unit_description() str[source]#

Get the description of the logarithmic unit for entropy calculations.

Returns:
str

The description of the logarithmic unit.

Raises:
ValueError

If there is no description for the logarithmic unit.

classmethod reset()[source]#

Reset the configuration settings to the default values.

classmethod set(key: str, value)[source]#

Set the value of a configuration setting.

Parameters:
keystr

The key of the configuration setting.

valueAny

The value to set the configuration setting to.

Raises:
KeyError

If the key is not recognised.

TypeError

If the value is not of the correct type.

static set_log_level(level: int | str) None[source]#

Set the logging level for the package.

Parameters:
levelint | str

The logging level. See the logging module for more information.

Raises:
ValueError

If the level is not a valid logging level.

classmethod set_logarithmic_unit(unit: str)[source]#

Set the base for the logarithmic unit.

The base determines the logarithmic unit used for entropy calculations:

  • ‘bits’ or ‘shannons’ (base 2)

  • ‘nats’ (base e)

  • ‘hartleys’, ‘bans’, or ‘dits’ (base 10)

Alternatively, you can set the base directly using the ‘base’ key, via set().

Parameters:
unitstr

The logarithmic unit to set. Use ‘bit(s)’ or ‘shannon(s)’ for base 2, ‘nat(s)’ for base e, and ‘hartley(s)’, ‘ban(s)’, or ‘dit(s)’ for base 10.

Raises:
ValueError

If the unit is not recognised.