euromod.introspect¶
Below are listed the main public classes of the euromod.introspect module.
Drop the cached spine extractions. |
|
|
Effective components of an income list under a dataset and extension set. |
|
Yield the policies of a country or system, skipping reference policies. |
|
|
|
All |
|
Extension short names the model accepts in |
Functions¶
- euromod.introspect.clear_cache() None¶
Drop the cached spine extractions.
Only needed when a model is reloaded from changed files within one process; the model is otherwise read-only at run time.
- euromod.introspect.income_list_components(system, list_name, dataset=None, extensions=None) list¶
Effective components of an income list under a dataset and extension set.
Income list membership is not fixed: extensions add and remove components, and a list may be redefined further down the spine. Expanding a list by reading one
DefIldefinition therefore gives the wrong variables as soon as an extension is switched.- Parameters:
system (
euromod.System) – System whose spine defines the list.list_name (
str) – Income list name, e.g."ils_dispy".dataset (
str, optional) – Dataset whose switch defaults apply. Default is the system’s best match.extensions (
list[tuple[str,bool] ], optional) – Switch overrides on top of the dataset defaults, in the form taken byeuromod.System.run(). Default isNone.
- Returns:
(variable, sign)pairs, where sign is'+'or'-'. Nested income lists are expanded recursively with signs multiplied through.- Return type:
- Raises:
IncomeListLookupError – If the list is unknown, inactive under this configuration, or cyclic.
Example
>>> from euromod.introspect import income_list_components >>> income_list_components(sys, "ils_dispy") [('yem', '+'), ('yse', '+'), ('tin', '-'), ...]
- euromod.introspect.iter_real_policies(scope)¶
Yield the policies of a country or system, skipping reference policies.
- Parameters:
scope (
euromod.Countryoreuromod.System) – Element whosepoliciescontainer is walked.- Yields:
euromod.Policy– Policies excludingeuromod.ReferencePolicyobjects, which carry no functions or comment and raise on naive attribute access.
- euromod.introspect.system_constant_names(system) set¶
$-prefixed constants defined viaDefConstin a system.
- euromod.introspect.system_constant_params(system) dict¶
All
$-prefixed parameters overridable viarun(constantsToOverwrite=...), mapped to the groups they are defined with.constantsToOverwriteis keyed by(name, group), and uprating factors such as$f_cpiare parameters of theUpratefunction keyed by year-group rather thanDefConstentries — so validating an override againstsystem_constant_names()alone would reject them. This walks every function.- Parameters:
system (
euromod.System) – System to inspect.- Returns:
Parameter name -> the groups it is defined with (
''when ungrouped).- Return type:
Example
>>> from euromod.introspect import system_constant_params >>> params = system_constant_params(sys) >>> sorted(params["$f_cpi"])[:3] ['2021', '2022', '2023']
- euromod.introspect.system_extension_names(system) set¶
Extension short names the model accepts in
run(switches=...).A switch the model does not know is silently dropped by the engine, which only reports “An error occurred during the processing of the ExtensionSwitches” to the console: the simulation then completes normally while the behaviour the caller asked for never happened. Validate against this set before running.
- Parameters:
system (
euromod.System) – System whose country and dataset defaults are inspected.- Returns:
Short names from the country’s extensions (local plus model-wide, i.e. everything declared in
Config/SWITCHABLEPOLICYCONFIG.xml, including add-on extensions) unioned with the per-dataset switch defaults observed for this system. Empty when neither can be read, which callers should treat as “cannot validate” rather than “nothing is valid”.- Return type:
Example
>>> from euromod import Model >>> from euromod.introspect import system_extension_names >>> mod = Model("C:\EUROMOD_RELEASES_I6.0+") >>> "LMA_trans" in system_extension_names(mod.countries['BE'].systems['BE_2025']) True