Config#
- class infomeasure.Config[source]
Bases:
objectConfiguration 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:
- _settings
dict A dictionary containing the configuration settings.
- _settings
Methods
get(key)Get the value of a configuration setting.
Get the logarithmic unit for entropy calculations.
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 the logarithmic unit for entropy calculations.
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:
- key
str The key of the configuration setting.
- key
- Returns:
AnyThe value of the configuration setting.
- classmethod get_logarithmic_unit() str[source]#
Get the logarithmic unit for entropy calculations.
- Returns:
strThe logarithmic unit.
- classmethod get_logarithmic_unit_description() str[source]#
Get the description of the logarithmic unit for entropy calculations.
- Returns:
strThe description of the logarithmic unit.
- Raises:
ValueErrorIf there is no description for the logarithmic unit.
- static set_log_level(level: int | str) None[source]#
Set the logging level for the package.
- Parameters:
- Raises:
ValueErrorIf 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:
- unit
str 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.
- unit
- Raises:
ValueErrorIf the unit is not recognised.