euromod 0.1.19a0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. euromod-0.1.19a0/LICENSE.md +41 -0
  2. euromod-0.1.19a0/MANIFEST.in +2 -0
  3. euromod-0.1.19a0/PKG-INFO +431 -0
  4. euromod-0.1.19a0/README.md +364 -0
  5. euromod-0.1.19a0/pyproject.toml +63 -0
  6. euromod-0.1.19a0/setup.cfg +4 -0
  7. euromod-0.1.19a0/src/euromod/LICENSE.txt +41 -0
  8. euromod-0.1.19a0/src/euromod/README.pdf +0 -0
  9. euromod-0.1.19a0/src/euromod/__init__.py +45 -0
  10. euromod-0.1.19a0/src/euromod/base.py +157 -0
  11. euromod-0.1.19a0/src/euromod/container.py +54 -0
  12. euromod-0.1.19a0/src/euromod/core.py +666 -0
  13. euromod-0.1.19a0/src/euromod/info.py +19 -0
  14. euromod-0.1.19a0/src/euromod/libs/EM_Common.dll +0 -0
  15. euromod-0.1.19a0/src/euromod/libs/EM_Crypt.dll +0 -0
  16. euromod-0.1.19a0/src/euromod/libs/EM_Executable.dll +0 -0
  17. euromod-0.1.19a0/src/euromod/libs/EM_Transformer.dll +0 -0
  18. euromod-0.1.19a0/src/euromod/libs/EM_XmlHandler.dll +0 -0
  19. euromod-0.1.19a0/src/euromod/libs/__init__.py +1 -0
  20. euromod-0.1.19a0/src/euromod/test/__init__.py +2 -0
  21. euromod-0.1.19a0/src/euromod/test/test.py +60 -0
  22. euromod-0.1.19a0/src/euromod/test/testing.py +75 -0
  23. euromod-0.1.19a0/src/euromod/utils/__init__.py +0 -0
  24. euromod-0.1.19a0/src/euromod/utils/_paths.py +18 -0
  25. euromod-0.1.19a0/src/euromod/utils/clr_array_convert.py +123 -0
  26. euromod-0.1.19a0/src/euromod/utils/utils.py +14 -0
  27. euromod-0.1.19a0/src/euromod.egg-info/PKG-INFO +431 -0
  28. euromod-0.1.19a0/src/euromod.egg-info/SOURCES.txt +31 -0
  29. euromod-0.1.19a0/src/euromod.egg-info/dependency_links.txt +1 -0
  30. euromod-0.1.19a0/src/euromod.egg-info/entry_points.txt +2 -0
  31. euromod-0.1.19a0/src/euromod.egg-info/requires.txt +2 -0
  32. euromod-0.1.19a0/src/euromod.egg-info/top_level.txt +1 -0
@@ -0,0 +1,41 @@
1
+ # License
2
+ ©European Union, Institute for Social and Economic Research, University of Essex
3
+
4
+ The EUROMOD model is licensed under the Creative Commons Attribution 4.0 International
5
+ (CC BY 4.0) [licence](https://creativecommons.org/licenses/by/4.0/ "https://creativecommons.org/licenses/by/4.0/"). Reuse is allowed provided appropriate credit is given and any changes are indicated.
6
+
7
+ We kindly ask you to acknowledge the use of EUROMOD in any publications or other outputs
8
+ (such as conference presentations). A recommended wording for acknowledgement is provided below:
9
+
10
+ 'The results presented here are based on EUROMOD version I5.0+. Originally
11
+ maintained, developed and managed by the Institute for Social and Economic
12
+ Research (ISER), since 2021 EUROMOD is maintained, developed and managed by
13
+ the Joint Research Centre (JRC) of the European Commission, in collaboration
14
+ with EUROSTAT and national teams from the EU countries. We are indebted to the
15
+ many people who have contributed to the development of EUROMOD. The results
16
+ and their interpretation are the author’s(’) responsibility'
17
+
18
+ This package includes one icon ('\XMLParam\AddOns\MTR\MTR.png'),
19
+ adapted from [LibreICONS](https://diemendesign.github.io/LibreICONS/, "https://diemendesign.github.io/LibreICONS/"), under :
20
+
21
+ MIT License
22
+
23
+ Copyright (c) 2018 Diemen Design
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ of this software and associated documentation files (the "Software"), to deal
27
+ in the Software without restriction, including without limitation the rights
28
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ copies of the Software, and to permit persons to whom the Software is
30
+ furnished to do so, subject to the following conditions:
31
+
32
+ The above copyright notice and this permission notice shall be included in all
33
+ copies or substantial portions of the Software.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include src/euromod/libs/*.dll
2
+ include src/euromod/README.pdf
@@ -0,0 +1,431 @@
1
+ Metadata-Version: 2.1
2
+ Name: euromod
3
+ Version: 0.1.19a0
4
+ Summary: Run the microsimulation model EUROMOD. The latest model and software versions of EUROMOD are available at https://euromod-web.jrc.ec.europa.eu/download-euromod .
5
+ Author-email: Irina Belousova <irina.belousova@ec.europa.eu>, Hannes Serruys <hannes.serruys@ec.europa.eu>, Kostas Manios <kostas.manios@ec.europa.eu>
6
+ Maintainer-email: Irina Belousova <iri.belousova@gmail.com>, Hannes Serruys <hannes.serruys@ec.europa.eu>
7
+ License: © European Union, Institute for Social and Economic Research, University of Essex
8
+
9
+ The EUROMOD model is licensed under the Creative Commons Attribution 4.0 International
10
+ (CC BY 4.0) licence (https://creativecommons.org/licenses/by/4.0/). Reuse is allowed
11
+ provided appropriate credit is given and any changes are indicated.
12
+
13
+ We kindly ask you to acknowledge the use of EUROMOD in any publications or other outputs
14
+ (such as conference presentations). A recommended wording for acknowledgement is provided below:
15
+
16
+ 'The results presented here are based on EUROMOD version I5.0+. Originally
17
+ maintained, developed and managed by the Institute for Social and Economic
18
+ Research (ISER), since 2021 EUROMOD is maintained, developed and managed by
19
+ the Joint Research Centre (JRC) of the European Commission, in collaboration
20
+ with EUROSTAT and national teams from the EU countries. We are indebted to the
21
+ many people who have contributed to the development of EUROMOD. The results
22
+ and their interpretation are the author’s(’) responsibility'
23
+
24
+ This package includes one icon ('\XMLParam\AddOns\MTR\MTR.png'),
25
+ adapted from LibreICONS (https://diemendesign.github.io/LibreICONS/), under :
26
+
27
+ MIT License
28
+
29
+ Copyright (c) 2018 Diemen Design
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining a copy
32
+ of this software and associated documentation files (the "Software"), to deal
33
+ in the Software without restriction, including without limitation the rights
34
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35
+ copies of the Software, and to permit persons to whom the Software is
36
+ furnished to do so, subject to the following conditions:
37
+
38
+ The above copyright notice and this permission notice shall be included in all
39
+ copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
+ SOFTWARE.
48
+
49
+ Project-URL: GitHub, https://github.com/iribelousova/JRC-EUROMOD-software-source-code/tree/master/Connectors/PythonIntegration
50
+ Project-URL: Issues, https://github.com/iribelousova/JRC-EUROMOD-software-source-code/discussions
51
+ Project-URL: EUROMOD, https://euromod-web.jrc.ec.europa.eu/
52
+ Project-URL: Download, https://euromod-web.jrc.ec.europa.eu/download-euromod
53
+ Project-URL: Documentation, https://euromod-web.jrc.ec.europa.eu/resources/model-documentation
54
+ Project-URL: Euromod-Online, https://euromod-web.jrc.ec.europa.eu/info-euromod-online
55
+ Keywords: Euromod,Microsimulation
56
+ Classifier: Development Status :: 3 - Alpha
57
+ Classifier: Intended Audience :: Science/Research
58
+ Classifier: License :: Other/Proprietary License
59
+ Classifier: Operating System :: Microsoft
60
+ Classifier: Programming Language :: Python :: 3
61
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
62
+ Requires-Python: >=3.8
63
+ Description-Content-Type: text/markdown
64
+ License-File: LICENSE.md
65
+ Requires-Dist: pythonnet>=3.0.2
66
+ Requires-Dist: pandas>=2.0.3
67
+
68
+
69
+
70
+ # Euromod Connector
71
+
72
+ [![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger)
73
+
74
+ ### Syntax
75
+
76
+ _class_ `core.Model`(**model_path**)
77
+
78
+ ##### **Parameters**:
79
+
80
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**model_path**: **string**
81
+ <br />
82
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Path to the [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") root directory.
83
+
84
+
85
+ The Euromod Connector for Python is built to facilitate and simplify the usage of the [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") microsimulation model for research purposes.
86
+
87
+ ## <a id="Installation"></a>Installation ###
88
+ The Euromod Connector can be installed from [PyPi](https://test.pypi.org/project/euromod/) using _pip_:
89
+ ```bash
90
+ $ pip install euromod
91
+ ```
92
+
93
+ ### <a id="Requirements"></a>Requirements
94
+ The Euromod Connector requires two [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") components: 1) the model (coded policy rules) , and 2) the input microdata with the variables that respect the [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") naming conventions.
95
+ For more information, please, read the sections "Model" and "Input microdata" on the [Download Euromod](https://euromod-web.jrc.ec.europa.eu/download-euromod "https://euromod-web.jrc.ec.europa.eu/download-euromod") web page.
96
+
97
+ The [Dependencies](#Dependencies_required) section below lists other required dependencies .
98
+
99
+ ## <a id="WorkWithEuromod"></a>Working with the Euromod Connector
100
+ Import the Euromod Connector:
101
+ ```python
102
+ from euromod import Model
103
+ ```
104
+
105
+ Creating an object of the ```core.Model``` class by passing a `str` path to the [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") root directory:
106
+ ```python
107
+ In [1]: mod=Model(r"C:\...\EUROMOD_RELEASES_I6.0+")
108
+ In [2]: mod
109
+ Out[2]: <core.Model at 0x28e67633cd0>
110
+ ```
111
+
112
+ Object `mod` has two attributes: ```model_path```, and ```countries``` which stores the instantiated `core.Country` classes for the [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") default countries.
113
+
114
+ > **Note:** Objects can be accessed using a single integer or a label. For the ```core.Country``` object the label is a two-letter country name, for the ```core.System``` object it is the system's name, for the ```core.Simulation``` object it is the name of the simulation output dataset (Examples: `Model['PL']['PL_2020'], Model[3][10]`).
115
+
116
+ >**Note:** Countries in [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") use the two-letter country codes convention. Please, see the [Eurostat Glossary: Country codes.](https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Glossary:Country_codes)
117
+
118
+ Use `core.Model.countries` to access the country object(s):
119
+ ```python
120
+ In [3]: mod.countries
121
+ Out[3]:
122
+ AT
123
+ BE
124
+ BG
125
+ ...
126
+
127
+ In [4]: # The following commands are equivalent:
128
+ # mod.countries['PL']
129
+ # mod.countries[21]
130
+ mod[21]
131
+ Out[4]:
132
+ Country PL
133
+ ```
134
+
135
+ Displaying country's name using the `core.Country.name` attribute:
136
+ ```python
137
+ In [5]: # The following commands are equivalent:
138
+ # mod[21].name
139
+ # mod['PL'].name
140
+ # mod.countries[21].name
141
+ mod.countries['PL'].name
142
+ Out[5]: 'PL'
143
+ ```
144
+ Method ```core.Country.load()``` instantiates new `core.System` class objects for each tax-benefit system policy:
145
+
146
+ ```python
147
+ In [6]: mod[21].load()
148
+ ```
149
+
150
+ Accessing the system object(s) calling the attribute `core.System.systems`:
151
+ ```python
152
+ In [7]: mod['PL'].systems
153
+ Out[7]:
154
+ PL_2005
155
+ PL_2006
156
+ PL_2007
157
+ ...
158
+
159
+ In [7]: # The following commands are equivalent:
160
+ # mod[21][17]
161
+ # mod[21].systems[17]
162
+ # mod.countries[21].systems[17]
163
+ mod.countries['PL'].systems['PL_2022']
164
+ Out[7]:
165
+ System PL_2022
166
+ ```
167
+ Display some system information using attributes ```name```, ```bestMatchDatasets``` and ```currencyParam``` of the `core.System` object:
168
+ ```python
169
+ In [7]: for sys in mod[21].systems:
170
+ print([sys.name, sys.bestMatchDatasets, sys.currencyParam])
171
+ Out[7]:
172
+ ['PL_2005', ['pl_2007_b3'], 'national']
173
+ ['PL_2006', ['pl_2007_b3'], 'national']
174
+ ['PL_2007', ['PL_2008_b4'], 'national']
175
+ ...
176
+ ['PL_2021', ['PL_2020_b2'], 'national']
177
+ ['PL_2022', ['PL_2020_b2'], 'national']
178
+ ```
179
+
180
+ ## <a id="Simulating"></a>The method run()
181
+
182
+ ### Syntax
183
+
184
+ `core.System.run`(**data**,**ID_DATASET**,**constantsToOverwrite**=[],**verbose**=True,**outputpath**="",**addons**=[],**switches**=[])
185
+ <br />
186
+ <br />
187
+ Run simulations of a EUROMOD tax-benefit system.
188
+
189
+ Return a `core.Simulation` class object with simulation results and other configuration information.
190
+
191
+ ##### **Parameters**:
192
+
193
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**data**: **pandas.DataFrame**
194
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Path to the [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") root directory.
195
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**ID_DATASET**: **str**
196
+ <br />
197
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name of the dataset. ***Note:** It determines the year of the uprating &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;factros to use in the simulation.
198
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**constantsToOverwrite**: **dict of {tuple(str,str): str}, default []**
199
+ <br />
200
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A list of constants to overwrite. Note that the key is a tuple for which &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the first item is the name of the constant and the second is the group &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;number.
201
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**verbose**: **bool, default True**
202
+ <br />
203
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If True then information on the output will be printed.
204
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**outputpath**: **str, default ""**
205
+ <br />
206
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When an output path is provided, there will be an output file generated.
207
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**addons**: **list of [tuple(str,str)], default []**
208
+ <br />
209
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List of addons to be integrated in the spine. The first item of the tuple &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is the name of the Addon, the second item is the name of the system in &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the Addon to be integrated (typically, it is the name of the Addon ```_``` &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;two-letter country code, e.g. LMA_AT). Available Addons are: LMA, MTR, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NRR, TCA.
210
+ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**switches**: **list of [tuple(str,bool)], default []**
211
+ <br />
212
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List of Extensions to be switched on or off. The first item of the tuple &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is the short name of the Extension, the second item is a boolean. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Available Extensions are: BTA, TCA, FYA, UAA, EPS, PBE,MWA, HHoT_un, WEB, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HHoT_ext, HHoT_ncp.
213
+
214
+
215
+
216
+
217
+ ### 1. **<a id="Simulating_default"></a>Example: Simulating two systems with default optional parameters:**
218
+
219
+ ```python
220
+ In [8]: data=pd.read_csv("PL_2020_b2.txt",sep="\t")
221
+ out=[]
222
+ for sysnam in ['PL_2021','PL_2022']:
223
+ out.append(mod['PL'][sysnam].run(data,"PL_2020_b2.txt"))
224
+
225
+ Out[8]:
226
+ Simulation: Sim1, System: PL_2021, Data: PL_2020_b2.txt .. done! Time to simulate16.469298839569092s
227
+ Simulation: Sim2, System: PL_2022, Data: PL_2020_b2.txt .. done! Time to simulate13.683719396591187s
228
+
229
+ In [9]: out
230
+ Out[9]: [
231
+ name: Sim1
232
+ output: pl_2021_std.txt ,
233
+
234
+ name: Sim2
235
+ output: pl_2022_std.txt
236
+ ]
237
+ ```
238
+
239
+ Accessing the simulation results by indexing ``core.Simulation.outputs`` with the name of the dataset provided in the attribute `core.Simulation.output`:
240
+ ```python
241
+ In [10]: out1 = out[1]
242
+ out1.outputs['pl_2022_std.txt']
243
+ Out[10]:
244
+ idhh idperson ... il_bsamt il_bsatm
245
+ 0 100.0 10001.0 ... 14504.920877 14504.920877
246
+ 1 100.0 10002.0 ... 6297.556928 6297.556928
247
+ ... ... ... ... ...
248
+ 38640 2047300.0 204730001.0 ... 1476.410557 1476.410557
249
+ 38641 2047500.0 204750001.0 ... 2733.061980 2733.061980
250
+
251
+ [38642 rows x 454 columns]
252
+ ```
253
+
254
+ ``core.Simulation.configSettings`` shows the simulation configuration settings:
255
+ ```python
256
+ In [11]: out1.configSettings
257
+ Out[11]:
258
+ {'PATH_EUROMODFILES': 'C:\\...\\EUROMOD_RELEASES_I6.0+',
259
+ 'PATH_DATA': 'C:\\...\\EUROMOD_RELEASES_I6.0+\\Input',
260
+ 'PATH_OUTPUT': '',
261
+ 'ID_DATASET': 'PL_2020_b2.txt',
262
+ 'COUNTRY': 'PL',
263
+ 'ID_SYSTEM': 'PL_2022'}
264
+ ```
265
+ Attribute `core.Simulation.configSettings` is a `struct` collecting the information about the system, dataset, addons, extensions, and other configuration settings used in the simulation.
266
+
267
+ ### 2) **<a id="Simulating_constant"></a>Example: Simulating changing the values of constants by passing parameter ```constantsToOverwrite``` to ``run()``:**
268
+
269
+ ```python
270
+ In [12]: out=mod['PL']['PL_2022'].run(data,"PL_2020_b2.txt",constantsToOverwrite={("$f_h_cpi","2022"):'10000'})
271
+ Out[12]:
272
+ Simulation: Sim3, System: PL_2022, Data: PL_2020_b2.txt .. done! Time to simulate15.760447263717651s
273
+
274
+ In [13]: out.constantsToOverwrite
275
+ Out[13]: {('$f_h_cpi', '2022'): '10000'}
276
+ ```
277
+ The optional parameter ```constantsToOverwrite``` specifies which constants to overwrite. `constantsToOverwrite` must be a ```dict```, where the keys are ```tuples``` of two ```str``` objects: the first string is the name of the constant and the second string is its group number (**Note:** Pass an empty string if the group number is `None`); the values are ```str``` with the new values of the constants. The default is None.
278
+
279
+ ### 3) **<a id="Simulating_addons"></a>Example: Simulating including the EUROMOD Addons by passing parameter ```addons``` to ``run()``:**
280
+
281
+ ```python
282
+ In [14]: out =mod['PL']['PL_2022'].run(data,"PL_2020_b2.txt",addons=[("LMA","LMA_PL")])
283
+ Out[14]:
284
+ Simulation: Sim4, System: PL_2022, Data: PL_2020_b2.txt .. done! Time to simulate18.564006567001343s
285
+
286
+ In [15]: out
287
+ Out[15]:
288
+ name: Sim4
289
+ output: pl_2022_lma.txt
290
+
291
+ In [16]: out.configSettings
292
+ Out[16]:
293
+ {'PATH_EUROMODFILES': 'C:\\...\\EUROMOD_RELEASES_I6.0+',
294
+ 'PATH_DATA': 'C:\\...\\EUROMOD_RELEASES_I5.0+\\Input',
295
+ 'PATH_OUTPUT': '',
296
+ 'ID_DATASET': 'PL_2020_b2.txt',
297
+ 'COUNTRY': 'PL',
298
+ 'ID_SYSTEM': 'PL_2022',
299
+ 'ADDON0': 'LMA|LMA_PL'}
300
+ ```
301
+ The optional parameter `addons` is a ```list``` of [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") Addons to be integrated in the spine . Each item of the ``list`` is a ```tuple``` with two ```str``` objects. The first ```str``` is the name of the Addon and the second `str` is the name of the system in the Addon to be integrated (typically, it is the name of the Addon ```_``` two-letter country code, e.g. LMA_AT). Available Addons are: LMA, MTR, NRR, TCA. The default is [].
302
+
303
+ ### 4) **<a id="Simulating_extensions"></a>Example: Simulating switching on/off the Extensions by passing parameter ```switches``` to ``run()``:**
304
+ ```python
305
+ In [17]: out =mod['PL']['PL_2022'].run(data,"PL_2020_b2.txt",switches=[("BTA",True)])
306
+ Out[17]:
307
+ Simulation: Sim5, System: PL_2022, Data: PL_2020_b2.txt .. done! Time to simulate18.564006567001343s
308
+
309
+ In [18]: out
310
+ Out[18]:
311
+ name: Sim5
312
+ output: pl_2022_lma.txt
313
+
314
+ In [19]: out.configSettings
315
+ Out[19]:
316
+ {'PATH_EUROMODFILES': 'C:\\...\\EUROMOD_RELEASES_I6.0+',
317
+ 'PATH_DATA': 'C:\\...\\EUROMOD_RELEASES_I5.0+\\Input',
318
+ 'PATH_OUTPUT': '',
319
+ 'ID_DATASET': 'PL_2020_b2.txt',
320
+ 'COUNTRY': 'PL',
321
+ 'ID_SYSTEM': 'PL_2022',
322
+ 'EXTENSION_SWITCH0': 'BTA=on'}
323
+ ```
324
+ The optional parameter `switches` must define a `list` of the [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") extensions to be switched on or off in the simulation. Each item in the ``list`` is a ```tuple``` with two objects. The first object is a ```str``` short name of the Extension. The second object is a ```boolean```. Available Extensions are: BTA, TCA, FYA, UAA, EPS, PBE, MWA, HHoT_un, WEB, HHoT_ext, HHoT_ncp. The default is [].
325
+
326
+ ### <a id="Euromod_Connector_Attributes"></a>List of Attributes:
327
+ #### <a id="Model_attributes"></a><u >Model class attributes: </u>
328
+ |||
329
+ | ------ | ------ |
330
+ | **model_path** | Return a string with the path to the [EUROMOD](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") root directory. |
331
+ | **countries** | Access ```Country``` class objects. |
332
+
333
+ #### <a id="Country_attributes"></a><u>Country class attributes: </u>
334
+ |||
335
+ | ------ | ------ |
336
+ | **model** | Access ```Model``` class object. |
337
+ | **name** | Return a string with the name of the country. |
338
+ | **systems** | Access the ```System``` class objects. ***Note**: Available after the ```load()``` . |
339
+
340
+
341
+ #### <a id="System_attributes"></a><u>System class attributes:</u>
342
+ | | |
343
+ | ------ | ------ |
344
+ | **bestMatchDatasets** | Return a list of dataset names with best match for the system.|
345
+ | **comment** | String comment related to the country-system. |
346
+ | **country** | Access the ```Country``` class objects. |
347
+ | **currencyOutput** | Return a string with the currency of the simulation output. |
348
+ | **currencyParam** | Return a string with currency of the system parameters. |
349
+ | **datasets** | Return a list of dataset names that match the system.|
350
+ | **headDefInc** | Return a string with the main income definition for the tax base. |
351
+ | **iD** | Return a string with the system identifier. |
352
+ | **name** | Return a string with the name of the system. |
353
+ | **order** | Return a string defining the system order. |
354
+ | **private** | Return a string with the system access. |
355
+ | **year** | Return a string with the system year. |
356
+
357
+
358
+ #### <a id="Simulation_attributes"></a><u>Simulation class attributes:</u>
359
+ | | |
360
+ | ------ | ------ |
361
+ | **configSettings** | Dictionary of configuration settings used in the simulation (including addons and extensions).|
362
+ | **constantsToOverwrite** | Dictionary with constants that are overwritten in the simulation. |
363
+ | **errors** | String Error/warning messages produced by [**EUROMOD**](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") during the simulation. |
364
+ | **currencyOutput** | Return a string with the currency of the simulation results. |
365
+ | **name** | Return a string with the name of the output dataset. |
366
+ | **outputs** | Return a list of datasets with simulation results.|
367
+
368
+ ### <a id="Euromod_Connector_Methods"></a>List of Methods:
369
+
370
+ #### <a id="Country_methods"></a><u>Country class methods:</u>
371
+ | | |
372
+ | ------ | ------ |
373
+ | **load()** | Load the [**EUROMOD**](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") tax-benefit systems in the ```Country``` object. |
374
+ | **load_data()** | Load data from a .csv file as a `pandas.DataFrame`. |
375
+
376
+
377
+ #### <a id="System_methods"></a><u>System class methods:</u>
378
+ | | |
379
+ | ------ | ------ |
380
+ | **run([data,ID_DATASET,...])** | Run simulations of the [**EUROMOD**](https://euromod-web.jrc.ec.europa.eu "https://euromod-web.jrc.ec.europa.eu") tax-benefit systems.
381
+
382
+
383
+
384
+ ## <a id="Dependencies_required"></a>Dependencies
385
+
386
+ The Euromod Connector requires the following dependencies:
387
+
388
+ | Package | Minimum supported version |
389
+ | ------ | ------ |
390
+ | pandas | 2.0.3|
391
+ | pythonnet | 3.0.2 |
392
+
393
+
394
+ ## <a id="Managing_Errors"></a>Managing Errors
395
+
396
+ <u>**1) ModuleNotFoundError**</u> or <u>**AttributeError**</u>:
397
+ If the `import` of the Euromod Connector libreries fails with one of the messages below:
398
+
399
+ ```python
400
+ ModuleNotFoundError: No module named 'System'
401
+ ```
402
+ ```python
403
+ AttributeError: module 'clr' has no attribute 'AddReference'
404
+ ```
405
+ uninstall the Python _clr_ package and re-install the _pythonnet_ package:
406
+ ```cs
407
+ pip uninstall clr
408
+ pip install pythonnet
409
+ ```
410
+ This error is caused by a conflict between the Python _clr_ package and the _clr_ library of the _pythonnet_ package.
411
+
412
+ <u>**2) RuntimeError**</u>:
413
+ If you encounter a `RuntimeError` as below, either 1) restart the kernel, or 2) open a new console window, or 3) deselect the option **User Module Reloader (UMR)** in the `Tools`-> `Preferences` -> `Python Interpreter` (or `Tools` -> `Console` -> `Advanced setting`, depending on the Python editor version) then press `Apply` and `Ok` and restart the consol windows.
414
+
415
+ **Note:** Re-enabling the UMR option has no effect on the console windows that are already open.
416
+
417
+ This error is produced when Python reloads the libraries of the _pythonnet_ package.
418
+
419
+ ```python
420
+ RuntimeError: Failed to initialize Python.Runtime.dll
421
+
422
+ Failed to initialize pythonnet: System.InvalidOperationException: This property must be set before runtime is initialized
423
+ at Python.Runtime.Runtime.set_PythonDLL(String value)
424
+ at Python.Runtime.Loader.Initialize(IntPtr data, Int32 size)
425
+ at Python.Runtime.Runtime.set_PythonDLL(String value)
426
+ at Python.Runtime.Loader.Initialize(IntPtr data, Int32 size)
427
+ ```
428
+
429
+
430
+ ## <a id="License"></a>[License]
431
+ [License.md]