fameio 1.8.1__py3-none-any.whl → 2.0.0__py3-none-any.whl

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 (46) hide show
  1. CHANGELOG.md +204 -0
  2. fameio/scripts/__init__.py +8 -6
  3. fameio/scripts/__init__.py.license +3 -0
  4. fameio/scripts/convert_results.py +30 -34
  5. fameio/scripts/convert_results.py.license +3 -0
  6. fameio/scripts/make_config.py +13 -16
  7. fameio/scripts/make_config.py.license +3 -0
  8. fameio/source/cli/__init__.py +3 -0
  9. fameio/source/cli/convert_results.py +75 -0
  10. fameio/source/cli/make_config.py +62 -0
  11. fameio/source/cli/options.py +59 -0
  12. fameio/source/cli/parser.py +238 -0
  13. fameio/source/loader.py +10 -11
  14. fameio/source/logs.py +49 -25
  15. fameio/source/results/conversion.py +12 -14
  16. fameio/source/results/csv_writer.py +16 -5
  17. fameio/source/results/data_transformer.py +3 -2
  18. fameio/source/results/input_dao.py +163 -0
  19. fameio/source/results/reader.py +25 -14
  20. fameio/source/results/yaml_writer.py +28 -0
  21. fameio/source/scenario/agent.py +56 -39
  22. fameio/source/scenario/attribute.py +9 -12
  23. fameio/source/scenario/contract.py +55 -40
  24. fameio/source/scenario/exception.py +11 -9
  25. fameio/source/scenario/generalproperties.py +11 -17
  26. fameio/source/scenario/scenario.py +19 -14
  27. fameio/source/schema/agenttype.py +75 -27
  28. fameio/source/schema/attribute.py +8 -7
  29. fameio/source/schema/schema.py +24 -11
  30. fameio/source/series.py +146 -25
  31. fameio/source/time.py +8 -8
  32. fameio/source/tools.py +13 -2
  33. fameio/source/validator.py +138 -58
  34. fameio/source/writer.py +108 -112
  35. fameio-2.0.0.dist-info/LICENSES/Apache-2.0.txt +178 -0
  36. fameio-2.0.0.dist-info/LICENSES/CC-BY-4.0.txt +395 -0
  37. fameio-2.0.0.dist-info/LICENSES/CC0-1.0.txt +121 -0
  38. {fameio-1.8.1.dist-info → fameio-2.0.0.dist-info}/METADATA +144 -112
  39. fameio-2.0.0.dist-info/RECORD +52 -0
  40. {fameio-1.8.1.dist-info → fameio-2.0.0.dist-info}/WHEEL +1 -2
  41. fameio-2.0.0.dist-info/entry_points.txt +4 -0
  42. fameio/source/cli.py +0 -253
  43. fameio-1.8.1.dist-info/RECORD +0 -40
  44. fameio-1.8.1.dist-info/entry_points.txt +0 -3
  45. fameio-1.8.1.dist-info/top_level.txt +0 -1
  46. {fameio-1.8.1.dist-info → fameio-2.0.0.dist-info}/LICENSE.txt +0 -0
@@ -1,26 +1,31 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fameio
3
- Version: 1.8.1
3
+ Version: 2.0.0
4
4
  Summary: Python scripts for operation of FAME models
5
- Home-page: https://gitlab.com/fame-framework/fame-io/
6
- Author: Felix Nitsch, Christoph Schimeczek, Ulrich Frey, Marc Deissenroth-Uhrig, Benjamin Fuchs, A. Achraf El Ghazi
5
+ Home-page: https://gitlab.com/fame-framework/wiki/-/wikis/home
6
+ License: Apache-2.0
7
+ Keywords: FAME,fameio,agent-based modelling,energy systems
8
+ Author: Felix Nitsch
7
9
  Author-email: fame@dlr.de
8
- License: Apache License 2.0
9
- Keywords: FAME,agent-based modelling
10
- Platform: UNKNOWN
11
- Classifier: Programming Language :: Python :: 3
10
+ Maintainer: Felix Nitsch
11
+ Maintainer-email: fame@dlr.de
12
+ Requires-Python: >=3.9,<4.0
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Science/Research
12
16
  Classifier: License :: OSI Approved :: Apache Software License
13
17
  Classifier: Operating System :: OS Independent
14
- Requires-Python: >=3.8
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Scientific/Engineering
24
+ Requires-Dist: fameprotobuf (>=1.4.0,<2.0.0)
25
+ Requires-Dist: pandas (>=1.0,<3.0)
26
+ Requires-Dist: pyyaml (>=6.0,<7.0)
27
+ Project-URL: Repository, https://gitlab.com/fame-framework/fame-io/
15
28
  Description-Content-Type: text/markdown
16
- License-File: LICENSE.txt
17
- Requires-Dist: pandas
18
- Requires-Dist: fameprotobuf (<1.3,>=1.2)
19
- Requires-Dist: pyyaml
20
- Provides-Extra: dev
21
- Requires-Dist: pytest ; extra == 'dev'
22
- Requires-Dist: mockito ; extra == 'dev'
23
- Requires-Dist: pre-commit ; extra == 'dev'
24
29
 
25
30
  <!-- SPDX-FileCopyrightText: 2023 German Aerospace Center <fame@dlr.de>
26
31
 
@@ -31,15 +36,18 @@ SPDX-License-Identifier: Apache-2.0 -->
31
36
  [![PyPI license](https://img.shields.io/pypi/l/fameio.svg)](https://badge.fury.io/py/fameio)
32
37
  [![pipeline status](https://gitlab.com/fame-framework/fame-io/badges/main/pipeline.svg)](https://gitlab.com/fame-framework/fame-io/commits/main)
33
38
  [![coverage report](https://gitlab.com/fame-framework/fame-io/badges/main/coverage.svg)](https://gitlab.com/fame-framework/fame-io/-/commits/main)
39
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
34
40
  [![REUSE status](https://api.reuse.software/badge/gitlab.com/fame-framework/fame-io)](https://api.reuse.software/info/gitlab.com/fame-framework/fame-io)
41
+ [![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)
42
+ ![GitLab last commit](https://img.shields.io/gitlab/last-commit/fame-framework%2Ffame-io)
43
+ ![GitLab closed issues by-label](https://img.shields.io/gitlab/issues/closed/fame-framework%2Ffame-io)
44
+
35
45
 
36
46
  # FAME-Io
37
47
  Python scripts for FAME models, generation of protobuf input files and conversion of protobuf output files.
38
48
  Please visit the [FAME-Wiki](https://gitlab.com/fame-framework/wiki/-/wikis/home) to get an explanation of FAME and its components.
39
- The package is also formerly known as [FAME-Py](https://doi.org/10.5281/zenodo.4314338).
40
49
 
41
50
  # Installation
42
-
43
51
  We recommend installing `fameio` using PyPI:
44
52
 
45
53
  pip install fameio
@@ -48,11 +56,10 @@ You may also use `pipx`. For detailed information please refer to the official `
48
56
 
49
57
  pipx install fameio
50
58
 
51
- `fameio` is currently developed and tested for Python 3.8 or higher.
52
- See the `setup.py` for a complete listing of dependencies.
59
+ `fameio` is currently developed and tested for Python 3.8 or higher.
60
+ See the `pyproject.toml` for a complete listing of dependencies.
53
61
 
54
62
  # Usage
55
-
56
63
  FAME-Io currently offers two main scripts `makeFameRunConfig` and `convertFameResults`.
57
64
  Both are automatically installed with the package.
58
65
  The first one creates a protobuf file for FAME applications using YAML definition files and CSV files.
@@ -78,27 +85,43 @@ This could look as follows:
78
85
 
79
86
  makeFameRunConfig -f <path/to/scenario.yaml> -l debug -lf <path/to/scenario.log> -o <path/to/config.pb>
80
87
 
81
-
82
88
  You may also call the configuration builder from any Python script with
83
89
 
84
90
  ```python
85
- from fameio.scripts.make_config import run as make_config
91
+ from fameio.scripts.make_config import Options, run as make_config
86
92
 
87
- make_config("path/to/scenario.yaml")
93
+ make_config({Options.FILE: "path/to/scenario.yaml", })
88
94
  ```
89
95
 
90
96
  Similar to the console call you may also specify custom run config arguments and add it in a dictionary to the function call.
91
97
 
92
98
  ```python
93
- from fameio.scripts.make_config import run as make_config
94
- from fameio.source.cli import Options
99
+ from fameio.scripts.make_config import Options, run as make_config
95
100
 
96
- run_config = {Options.LOG_LEVEL: "info",
101
+ run_config = {Options.FILE: "path/to/scenario.yaml",
102
+ Options.LOG_LEVEL: "info",
97
103
  Options.OUTPUT: "output.pb",
98
104
  Options.LOG_FILE: "scenario.log",
99
105
  }
100
106
 
101
- make_config("path/to/scenario.yaml", run_config)
107
+ make_config(run_config)
108
+ ```
109
+
110
+ You can also use the associated argument parser, to extract the run_config dynamically from a string:
111
+
112
+ ```python
113
+ from fameio.scripts.make_config import Options, run as make_config
114
+ from fameio.source.cli.make_config import handle_args
115
+
116
+ my_defaults = {Options.FILE: "path/to/scenario.yaml",
117
+ Options.LOG_LEVEL: "info",
118
+ Options.OUTPUT: "output.pb",
119
+ Options.LOG_FILE: "scenario.log",
120
+ }
121
+ my_arg_string = ['-f', 'my/other/scenario.yaml', '-l', 'error']
122
+
123
+ run_config = handle_args(my_arg_string, my_defaults)
124
+ make_config(run_config)
102
125
  ```
103
126
 
104
127
  ### Scenario YAML
@@ -119,7 +142,8 @@ The Schema consists of the sections `Header` and `AgentTypes`.
119
142
  ##### Header
120
143
  Scientific applications often evolve, and so do their required input parameters.
121
144
  Therefore, the header specifies information what FAME-based application the schema is corresponding to.
122
- In this way a schema.yaml is tied to a specific version an application, ensuring a match between the inputs required by the application, and those provided by the files created with FAME-Io.
145
+ In this way a schema.yaml is tied to a specific version an application, ensuring a match between the inputs required by
146
+ the application, and those provided by the files created with FAME-Io.
123
147
 
124
148
  ```yaml
125
149
  Header:
@@ -141,9 +165,9 @@ AgentTypes:
141
165
  MyAgentType:
142
166
  Attributes:
143
167
  MyAttribute:
144
- ...
168
+ ...
145
169
  MyOtherAttribute:
146
- ...
170
+ ...
147
171
  Products: [ 'Product1', 'Product2', 'Product3' ]
148
172
  MyOtherAgentWithoutProductsOrAttributes:
149
173
  ```
@@ -181,26 +205,26 @@ MyComplexAttribute:
181
205
  * `AttributeType` (required) data type of the attribute; see options in table below
182
206
  * `Mandatory` (optional - true by default) if true: the attribute is required for this agent and validation will fail if the attribute is missing in the scenario **and** no default is provided
183
207
  * `List` (optional - false by default)
184
- * `AttributeType: time_series` cannot be true
185
- * `AttributeType: block`
186
- * if true: any nested element in the scenario must be part of a list element and thus can appear multiple times
187
- * if false: any nested element in the scenario can only appear once
188
- * any other AttributeType: the attribute is interpreted as list, i.e. multiple values can be assigned to this attribute in the scenario
208
+ * `AttributeType: time_series` cannot be true
209
+ * `AttributeType: block`
210
+ * if true: any nested element in the scenario must be part of a list element and thus can appear multiple times
211
+ * if false: any nested element in the scenario can only appear once
212
+ * any other AttributeType: the attribute is interpreted as list, i.e. multiple values can be assigned to this attribute in the scenario
189
213
  * `NestedAttributes` (required only if `AttributeType: block`, otherwise disallowed) starts an inner Attribute definition block - defined Attributes are sub-elements of `MyComplexAttribute`
190
214
  * `Values` (optional - None by default): if present defines a list of allowed values for this attribute
191
215
  * `Default` (optional - None by default): if present defines a default value to be used in case the scenario does not specify it
192
216
  * `Help` (optional - None by default): if present defines a help text to you attribute
193
217
 
194
- | AttributeType | value |
195
- |-----------------|-------------------------------------------------------------------------------------------------------------------------|
196
- | `integer` | a 32-bit integer value |
197
- | `double` | a 64-bit floating-point value (integers also allowed) |
198
- | `long` | a 64-bit integer value |
199
- | `time_stamp` | either a FAME time stamp string or 64-bit integer value |
200
- | `string` | any string |
201
- | `enum` | any string, however, usually tied to a set of allowed `Values` |
202
- | `time_series` | either a path to a .csv-file or a single 64-bit floating-point value; does not support `List: true` |
203
- | `block` | this attribute has no value of its own but hosts a group of nested Attributes; implies `NestedAttributes` to be defined |
218
+ | AttributeType | value |
219
+ |---------------|-------------------------------------------------------------------------------------------------------------------------|
220
+ | `integer` | a 32-bit integer value |
221
+ | `double` | a 64-bit floating-point value (integers also allowed) |
222
+ | `long` | a 64-bit integer value |
223
+ | `time_stamp` | either a FAME time stamp string or 64-bit integer value |
224
+ | `string` | any string |
225
+ | `enum` | any string, however, usually tied to a set of allowed `Values` |
226
+ | `time_series` | either a path to a .csv-file or a single 64-bit floating-point value; does not support `List: true` |
227
+ | `block` | this attribute has no value of its own but hosts a group of nested Attributes; implies `NestedAttributes` to be defined |
204
228
 
205
229
  #### GeneralProperties
206
230
  Specifies FAME-specific properties of the simulation. Structure:
@@ -220,7 +244,8 @@ GeneralProperties:
220
244
  Parameters:
221
245
  * `RunId` an ID that can be given to the simulation; use at your discretion
222
246
  * `StartTime` time stamp in the format YYYY-MM-DD_hh:mm:ss; first moment of the simulation.
223
- * `StopTime` time stamp in the format YYYY-MM-DD_hh:mm:ss; last moment of the simulation - i.e. simulation terminates after passing that time stamp
247
+ * `StopTime` time stamp in the format YYYY-MM-DD_hh:mm:ss; last moment of the simulation - i.e. simulation terminates
248
+ after passing that time stamp
224
249
  * `RandomSeed` seed to initialise random number generation; each value leads to a unique series of random numbers.
225
250
  * `Interval` number of simulation ticks in between write-to-disk events; may be used for performance optimisations;
226
251
  * `Process` id of process that performs write-to-disk operations; leave at 0 to be compatible with single-processes;
@@ -228,6 +253,7 @@ Parameters:
228
253
  #### Agents
229
254
  Specifies all Agents to be created in the simulation in a list. Each Agent has its own entry.
230
255
  Structure:
256
+
231
257
  ```yaml
232
258
  Agents:
233
259
  - Type: MyAgentWithInputs
@@ -244,8 +270,10 @@ Agents:
244
270
 
245
271
  Agent Parameters:
246
272
  * `Type` Mandatory; Java's simple class name of the agent to be created
247
- * `Id` Mandatory; simulation-unique id of this agent; if two agents have the same ID, the configuration process will stop.
248
- * `Attributes` Optional; if the agent has any attributes, specify them here in the format "AttributeName: value"; please see attribute table above
273
+ * `Id` Mandatory; simulation-unique id of this agent; if two agents have the same ID, the configuration process will
274
+ stop.
275
+ * `Attributes` Optional; if the agent has any attributes, specify them here in the format "AttributeName: value"; please
276
+ see attribute table above
249
277
 
250
278
  The specified `Attributes` for each agent must match the specified `Attributes` options in the linked Schema (see above).
251
279
  For better structure and readability of the `scenario.yaml`, `Attributes` may also be specified in a nested way as demonstrated below.
@@ -268,7 +296,7 @@ In case Attributes are defined with `List: true` option, lists are assigned to a
268
296
 
269
297
  ```yaml
270
298
  Attributes:
271
- MyDoubleList: [5.2, 4.5, 7, 9.9]
299
+ MyDoubleList: [ 5.2, 4.5, 7, 9.9 ]
272
300
  MyListGroup:
273
301
  - IntValueA: 5
274
302
  IntValueB: 42
@@ -321,14 +349,14 @@ Contracts:
321
349
  # effectively 3 similar contracts (0 -> 11), (0 -> 12), (0 -> 13)
322
350
  # with otherwise identical ProductName, FirstDeliveryTime & DeliveryIntervalInSteps
323
351
  - SenderId: 0
324
- ReceiverId: [11, 12, 13]
352
+ ReceiverId: [ 11, 12, 13 ]
325
353
  ProductName: MyOtherProduct
326
354
  FirstDeliveryTime: 100
327
355
  DeliveryIntervalInSteps: 3600
328
356
 
329
357
  # effectively 3 similar contracts (1 -> 10), (2 -> 10), (3 -> 10)
330
358
  # with otherwise identical ProductName, FirstDeliveryTime & DeliveryIntervalInSteps
331
- - SenderId: [1, 2, 3]
359
+ - SenderId: [ 1, 2, 3 ]
332
360
  ReceiverId: 10
333
361
  ProductName: MyProduct
334
362
  FirstDeliveryTime: 100
@@ -336,8 +364,8 @@ Contracts:
336
364
 
337
365
  # effectively 3 similar contracts (1 -> 11), (2 -> 12), (3 -> 13)
338
366
  # with otherwise identical ProductName, FirstDeliveryTime & DeliveryIntervalInSteps
339
- - SenderId: [1, 2, 3]
340
- ReceiverId: [11, 12, 13]
367
+ - SenderId: [ 1, 2, 3 ]
368
+ ReceiverId: [ 11, 12, 13 ]
341
369
  ProductName: MyThirdProduct
342
370
  FirstDeliveryTime: 100
343
371
  DeliveryIntervalInSteps: 3600
@@ -348,8 +376,8 @@ The following example is equivalent to the previous one and allows a quick exten
348
376
 
349
377
  ```yaml
350
378
  Groups:
351
- - &agentList1: [1,2,3]
352
- - &agentList2: [11,12,13]
379
+ - &agentList1: [ 1,2,3 ]
380
+ - &agentList2: [ 11,12,13 ]
353
381
 
354
382
  Contracts:
355
383
  - SenderId: 0
@@ -379,14 +407,17 @@ These CSV files follow a specific structure:
379
407
  * The first column must be a time stamp in form `YYYY-MM-DD_hh:mm:ss`
380
408
  * The second column must be a numerical value (either integer or floating-point)
381
409
  * The separator of the two columns is a semicolon
410
+ * The data must **not** have headers, except for comments marked with `#`
382
411
 
412
+ You may add comments using `#`.
383
413
  Exemplary content of a valid CSV file:
384
414
 
415
+ # If you want an optional header, you must use a comment
385
416
  2012-01-01_00:00:00;400
386
417
  2013-01-01_00:00:00;720.5
387
418
  2014-01-01_00:00:00;650
388
419
  2015-01-01_00:00:00;99.27772
389
- 2016-01-01_00:00:00;42
420
+ 2016-01-01_00:00:00;42 # optional comment on this particular data point
390
421
  2017-01-01_00:00:00;0.1
391
422
 
392
423
  Please refer also to the detailed article about `TimeStamps` in the [FAME-Wiki](https://gitlab.com/fame-framework/wiki/-/wikis/TimeStamp).
@@ -409,6 +440,7 @@ folder/b.yaml
409
440
  folder/c.yaml
410
441
  folder/deeper_folder/d.yaml
411
442
  ```
443
+
412
444
  the following !include commands work
413
445
 
414
446
  ###### in a.yaml
@@ -428,10 +460,12 @@ Provided that
428
460
  ```
429
461
  Or: maybe
430
462
  ```
463
+
431
464
  ###### d.yaml
432
465
  ```
433
466
  not: "?"
434
467
  ```
468
+
435
469
  the resulting file would look like this:
436
470
 
437
471
  ###### THe Joined file a.yaml
@@ -451,6 +485,7 @@ When specifying only a file path, the complete content of the file is assigned t
451
485
  You always need a key to assign the !include command to.
452
486
  However, you cannot combine the value returned from !include with other values in the same key.
453
487
  Thus, the following combinations do not work:
488
+
454
489
  ###### caveats.yml
455
490
  ```
456
491
  !include "file.yaml" # no key assigned
@@ -483,7 +518,7 @@ Set2:
483
518
  ```yaml
484
519
  - Type: MyAgentWithInputs
485
520
  Id: 1
486
- Attributes: !include_node [file_to_be_included.yaml, Set1:Subset1]
521
+ Attributes: !include_node [ file_to_be_included.yaml, Set1:Subset1 ]
487
522
  ```
488
523
 
489
524
  Compiling "including_file.yaml" results in
@@ -503,12 +538,14 @@ However, the elements to be joined across multiple files must be lists.
503
538
  These lists are then concatenated into a single list and then assigned to the key in the file calling !include.
504
539
  This feature is especially useful for Contracts: You can split the Contracts list into several files and place them in a separate folder.
505
540
  Then use !include to re-integrate them into your configuration. An example:
541
+
506
542
  ###### my_contract1.yaml
507
543
  ```
508
544
  Contracts:
509
545
  - ContractA
510
546
  - ContractB
511
547
  ```
548
+
512
549
  ###### my_contract2.yaml
513
550
  ```
514
551
  Contracts:
@@ -516,12 +553,14 @@ Contracts:
516
553
  - ContractD
517
554
  - ContractE
518
555
  ```
556
+
519
557
  ###### including_file.yaml
520
558
  ```
521
559
  Contracts: [!include "my_contract*.yaml", "Contracts"]
522
560
  ```
523
561
 
524
562
  results in
563
+
525
564
  ###### result.yaml
526
565
  ```
527
566
  Contracts:
@@ -546,20 +585,21 @@ Call structure:
546
585
 
547
586
  You may also specify any of the following arguments:
548
587
 
549
- | Command | Action |
550
- |--------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
551
- | `-l` or `--log` <option> | Sets the logging level. Default is `info`. Options are `debug`, `info`, `warning`, `warn`, `error`, `critical`. |
552
- | `-lf` or `--logfile` <file> | Sets the logging file. Default is `None`. If `None` is provided, all logs get only printed to the console. |
553
- | `-a` or `--agents` <list-of-agents> | If specified, only a subset of agents is extracted from the protobuf file. Default is to extract all agents. |
554
- | `-o` or `--output` | Sets the path to where the generated output files are written to. If not specified, the folder's name is derived from the input file's name. Folder will be created if it does not exist. |
555
- | `-se` or `--single-export` | Enables export of individual agents to individual files, when present. If not present (the default) one file per `AgentType` is created. |
556
- | `-m` or `--memory-saving` | When specified, reduces memory usage profile at the cost of runtime. Use only when necessary. |
557
- | `-cc` or `--complex-column` <option> | Defines how to deal with complex indexed output columns (if any). `IGNORE` ignores complex columns. `MERGE` squashes all data from complex columns in one big string entry. `SPLIT` creates a separate file for each complex indexed output column. |
558
- | `-t` or `--time` <option> | Option to define conversion of time steps to given format (default=`UTC`) by `-t/--time {UTC, INT, FAME}` |
588
+ | Command | Action |
589
+ |---------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
590
+ | `-l` or `--log` <option> | Sets the logging level. Default is `info`. Options are `debug`, `info`, `warning`, `warn`, `error`, `critical`. |
591
+ | `-lf` or `--logfile` <file> | Sets the logging file. Default is `None`. If `None` is provided, all logs get only printed to the console. |
592
+ | `-a` or `--agents` <list-of-agents> | If specified, only a subset of agents is extracted from the protobuf file. Default is to extract all agents. |
593
+ | `-o` or `--output` | Sets the path to where the generated output files are written to. If not specified, the folder's name is derived from the input file's name. Folder will be created if it does not exist. |
594
+ | `-se` or `--single-export` | Enables export of individual agents to individual files, when present. If not present (the default) one file per `AgentType` is created. |
595
+ | `-m` or `--memory-saving` | When specified, reduces memory usage profile at the cost of runtime. Use only when necessary. |
596
+ | `-cc` or `--complex-column` <option> | Defines how to deal with complex indexed output columns (if any). `IGNORE` ignores complex columns. `MERGE` squashes all data from complex columns in one big string entry. `SPLIT` creates a separate file for each complex indexed output column. |
597
+ | `-t` or `--time` <option> | Option to define conversion of time steps to given format (default=`UTC`) by `-t/--time {UTC, INT, FAME}` |
598
+ | `--input-recovery` or `--no-input-recovery` | If True, all input data are recovered as well as the outputs (default=False). |
559
599
 
560
600
  Additionally, you may merge TimeSteps of a certain range of steps in the output files to
561
- i) associate multiple time steps with a common logical time in your simulation
562
- ii) reduce number of lines in output files
601
+ i) associate multiple time steps with a common logical time in your simulation
602
+ ii) reduce number of lines in output files
563
603
 
564
604
  For this, add the option `merge-times` and specify the arguments as follows:
565
605
 
@@ -579,18 +619,18 @@ If multiple values per column are merged values will get concatenated and might
579
619
  You may also call the conversion script from any Python script with:
580
620
 
581
621
  ```python
582
- from fameio.scripts.convert_results import run as convert_results
622
+ from fameio.scripts.convert_results import Options, run as convert_results
583
623
 
584
- convert_results("./path/to/protobuf_file.pb")
624
+ convert_results({Options.FILE: "./path/to/protobuf_file.pb"})
585
625
  ```
586
626
 
587
627
  Similar to the console call you may also specify custom run config arguments and add it in a dictionary to the function call.
588
628
 
589
629
  ```python
590
- from fameio.scripts.convert_results import run as convert_results
591
- from fameio.source.cli import Options
630
+ from fameio.scripts.convert_results import Options, run as convert_results
592
631
 
593
- run_config = {Options.LOG_LEVEL: "info",
632
+ run_config = {Options.FILE: "./path/to/protobuf_file.pb",
633
+ Options.LOG_LEVEL: "info",
594
634
  Options.LOG_FILE: "scenario.log",
595
635
  Options.OUTPUT: "Output",
596
636
  Options.AGENT_LIST: ['AgentType1', 'AgentType2'],
@@ -601,13 +641,37 @@ run_config = {Options.LOG_LEVEL: "info",
601
641
  Options.TIME_MERGING: {},
602
642
  }
603
643
 
604
- convert_results("./path/to/protobuf_file.pb", run_config)
644
+ convert_results(run_config)
645
+ ```
646
+
647
+ You can also use the associated argument parser, to extract the run_config dynamically from a string:
648
+
649
+ ```python
650
+ from fameio.scripts.convert_results import Options, run as convert_results
651
+ from fameio.source.cli.convert_results import handle_args
652
+
653
+ my_defaults = {Options.FILE: "./path/to/protobuf_file.pb",
654
+ Options.LOG_LEVEL: "info",
655
+ Options.LOG_FILE: "scenario.log",
656
+ Options.OUTPUT: "Output",
657
+ Options.AGENT_LIST: ['AgentType1', 'AgentType2'],
658
+ Options.MEMORY_SAVING: False,
659
+ Options.SINGLE_AGENT_EXPORT: False,
660
+ Options.RESOLVE_COMPLEX_FIELD: "SPLIT",
661
+ Options.TIME: "INT",
662
+ Options.TIME_MERGING: {},
663
+ }
664
+ my_arg_string = ['-f', 'my/other/scenario.yaml', '-l', 'error']
665
+
666
+ run_config = handle_args(my_arg_string, my_defaults)
667
+ convert_results(run_config)
605
668
  ```
606
669
 
607
670
  ## Cite FAME-Io
608
671
  If you use FAME-Io for academic work, please cite as follows.
609
672
 
610
673
  Bibtex entry:
674
+
611
675
  ```
612
676
  @article{fameio2023joss,
613
677
  author = {Felix Nitsch and Christoph Schimeczek and Ulrich Frey and Benjamin Fuchs},
@@ -619,44 +683,12 @@ Bibtex entry:
619
683
  ```
620
684
 
621
685
  ## Available Support
622
- This is a purely scientific project by (at the moment) one research group.
686
+ This is a purely scientific project by (at the moment) one research group.
623
687
  Thus, there is no paid technical support available.
624
688
  However, we will give our best to answer your questions and provide support.
625
689
 
626
690
  If you experience any trouble with FAME-Io, you may contact the developers via [fame@dlr.de](mailto:fame@dlr.de).
627
- Please report bugs and make feature requests by filing issues following the provided templates (see also [Contribute](#Contribute)).
628
- For substantial enhancements, we recommend that you contact us via [fame@dlr.de](mailto:fame@dlr.de) for working together on the code in common projects or towards common publications and thus further develop FAME-Io.
629
-
630
- # Contribute
631
- Please read the Contributors License Agreement `cla.md`, sign it and send it to [`fame@dlr.de`](mailto:fame@dlr.de) before contributing.
632
-
633
- You will also find templates for [bug reports](https://gitlab.com/fame-framework/fame-io/-/blob/main/.gitlab/issue_templates/bug_report.md),
634
- [feature requests](https://gitlab.com/fame-framework/fame-io/-/blob/main/.gitlab/issue_templates/feature_request.md), and
635
- [pull requests](https://gitlab.com/fame-framework/fame-io/-/blob/main/.gitlab/issue_templates/pull_request.md).
636
-
637
- We kindly ask you to read the Contributors License Agreement `cla.md`, sign it, and send it to [`fame@dlr.de`](mailto:fame@dlr.de) before contributing. Please see our [conventions of contribution](https://gitlab.com/fame-framework/wiki/-/wikis/developers/contribute/Conventions) which are described in the Wiki.
638
-
639
- ## Testing changes locally
640
-
641
- Once some changes have been performed on the local git clone, use the following command to override your local installation with your modified copy in order to test the result:
642
-
643
- ```bash
644
- python3 setup.py bdist_wheel && pip3 install --force-reinstall --no-dependencies ./dist/*.whl
645
- ```
646
-
647
- ## Code style
648
-
649
- We use the code formatting library [`black`](https://pypi.org/project/black/).
650
- The maximum line length is defined as 120 characters.
651
- Therefore, before committing, run `black --line-length 120 .`
652
-
653
- ## Pre-Commit hooks
654
-
655
- FAME-Io uses several pre-commit hooks to ensure high code quality.
656
- To use them, install `dev` packages and then initialise pre-commit in FAME-Io's base folder:
657
-
658
- ```
659
- pip install fameio[dev]
660
- pre-commit install -t pre-commit -t pre-push
661
- ```
691
+ Please report bugs and make feature requests by filing issues following the provided templates (see also [Contribute](CONTRIBUTING.md)).
692
+ For substantial enhancements, we recommend that you contact us via [fame@dlr.de](mailto:fame@dlr.de) for working
693
+ together on the code in common projects or towards common publications and thus further develop FAME-Io.
662
694
 
@@ -0,0 +1,52 @@
1
+ CHANGELOG.md,sha256=HzXg9-Yd8w0npG0ZJfmcGQNbP59XQchdOpZlWvFHIWI,9874
2
+ fameio/__init__.py,sha256=IQm0MNOXkhBexiMXBoNZDK5xHUYgazH7oXm-lc0Vm04,109
3
+ fameio/scripts/__init__.py,sha256=Bdu79kajJvvmPWdSP82Y6G8MCpP4n9ftTR-snWSbMJY,741
4
+ fameio/scripts/__init__.py.license,sha256=2-OqCNxP4504xY2XQqseYypJi1_Qx4xJSzO3t7c3ACM,107
5
+ fameio/scripts/convert_results.py,sha256=Ddv40nIK4fuFgGd_l81KtCg7rzAuH_sNzjuqL2w7xfQ,3635
6
+ fameio/scripts/convert_results.py.license,sha256=2-OqCNxP4504xY2XQqseYypJi1_Qx4xJSzO3t7c3ACM,107
7
+ fameio/scripts/make_config.py,sha256=s5UfsGT93vfwEBXTmmhJTw0HwNvk7d5iDAbbL5u7o2c,1349
8
+ fameio/scripts/make_config.py.license,sha256=2-OqCNxP4504xY2XQqseYypJi1_Qx4xJSzO3t7c3ACM,107
9
+ fameio/source/__init__.py,sha256=14CnWOIkdSeKQg6FioQSgO7UtEFF6pO4MUtDAUfwNmA,278
10
+ fameio/source/cli/__init__.py,sha256=UqrdWnYMoy-o2--m0a4c-MtAorsc4eILXaPq27EXM1Q,112
11
+ fameio/source/cli/convert_results.py,sha256=VmGBTCXlr6G2AziS3RRGUk4g0agf6MVuMxlWq3fbzZ0,3072
12
+ fameio/source/cli/make_config.py,sha256=_PsQTQNYqRKr8PyGZtMDQskK_qn-tH_rsUZqesYK0UI,2369
13
+ fameio/source/cli/options.py,sha256=zprTvGVNF8Nm71XJ3eMKrwb5pn2ait8VdDwwP5UYLNA,1413
14
+ fameio/source/cli/parser.py,sha256=gFkWDjTj2e08ZbIWio7d4KOLHFJiCDq-tsL-oP2y_00,9366
15
+ fameio/source/loader.py,sha256=SzExknxxrMoL5RG_7TAJ1jVxm93r9VrwT3bzJ196zO4,7433
16
+ fameio/source/logs.py,sha256=sg8MYTm1lquUA8mJSfhaYsC9Dm78fpHstQbQWAM41E8,2806
17
+ fameio/source/path_resolver.py,sha256=cIEVvz7Eh4e3Rh87XkwyGiyj9iKxUI7TzWtq6ClhLd8,1321
18
+ fameio/source/results/__init__.py,sha256=IQm0MNOXkhBexiMXBoNZDK5xHUYgazH7oXm-lc0Vm04,109
19
+ fameio/source/results/agent_type.py,sha256=pW5cLduLlNOcBBvS6sCLpTpZt3D6B8UMsizEZhe5lJ0,4321
20
+ fameio/source/results/conversion.py,sha256=ZaTM3kejkmAr8INdI7FTHoJglFm6MlEGd7phJt1Po1c,3721
21
+ fameio/source/results/csv_writer.py,sha256=txs26dqThagTseCC6UCjBK2ByQZYbNR_sPldUIGPnow,4868
22
+ fameio/source/results/data_transformer.py,sha256=KP2Z-R0Na5JjOvI_DWgmaAdR5wdXKOxbIuUxsIXZ5nY,6264
23
+ fameio/source/results/input_dao.py,sha256=VDIbcq0z600kptyktLPM7RsvZWsx6KBJvvViCL2jOdI,6928
24
+ fameio/source/results/output_dao.py,sha256=8FocGe4yyH3EdHD5Chw9uCGnDetfJoSglBga0o3lnWE,3960
25
+ fameio/source/results/reader.py,sha256=OH18c-IBR7j0uKp2ZU_j5vPIFfasv3ziipjcgXDXYl0,5078
26
+ fameio/source/results/yaml_writer.py,sha256=9BjS0hMcGr2qgtcpwoY3Mmh-XyG3kjkTYqDI-xSAXww,843
27
+ fameio/source/scenario/__init__.py,sha256=YfJvz275GWX8kVWMSMRcF3KsUQNqSAPrwBgNV7tqBTY,372
28
+ fameio/source/scenario/agent.py,sha256=Z8jfMfUjrTJ4R1rEpwNdKCblhEx6-9xioewxGuajuqw,4713
29
+ fameio/source/scenario/attribute.py,sha256=-Ed6jHlztwf9NhvpfRNt6ohGKKqkPBx_hLvGFE6O6K0,4834
30
+ fameio/source/scenario/contract.py,sha256=WI9dY8xWEXB5vGvXWDye6LAA9P-8GXFAep8Z-QTbhjg,9448
31
+ fameio/source/scenario/exception.py,sha256=2mJC8EuZqyZsb31qw6ZtOBZWKm9kILgB3n3JHrIYmAc,1560
32
+ fameio/source/scenario/fameiofactory.py,sha256=7P-x8i9sSU9sIkOlgF6gVRFuNacFMUBrBh4KdHoAUtU,1376
33
+ fameio/source/scenario/generalproperties.py,sha256=CaFny6xyGs3sHqSHNKyWUB68lWOrTOnYfAnIcPaSusQ,4545
34
+ fameio/source/scenario/scenario.py,sha256=j2IVVZlpBJjYECXzBouFtrDXPPES0uSf_Q2l0MzcQkQ,3727
35
+ fameio/source/schema/__init__.py,sha256=ZGTyliDbjlYGPAjB9bbggzACOYWdhm4I1VSmm7YGmTk,270
36
+ fameio/source/schema/agenttype.py,sha256=x4A5eLDC9SfC2PwUUUg0U6OdFJ49oLH61CwSWDoIKZc,5198
37
+ fameio/source/schema/attribute.py,sha256=rcltVycTipwnrQNiKFJTifhuDZHgLOcVtcYjOwHDo2A,8308
38
+ fameio/source/schema/exception.py,sha256=NMftGnrFOaS3MwrjZl8qbx3bi6KYUxhzHJIX1v--B5M,224
39
+ fameio/source/schema/schema.py,sha256=TmlIwnVUjKbNx6ZH8soe2tbiQ0-X7oqIsrSNBGlOwWk,2240
40
+ fameio/source/series.py,sha256=g2nwFqED-TQhHP5YraWcavmLBXmVxEKEF4HKa9C5n4I,8120
41
+ fameio/source/time.py,sha256=Vsd95nTubL8x5cwiznJYeti6clZCCHHJv7xjSpYqkF0,6984
42
+ fameio/source/tools.py,sha256=7YxX-CmsakJJB2RbBhf2u8y1-RyhDhsASHXFztkDIKE,1052
43
+ fameio/source/validator.py,sha256=bk1tkz4eu_LG28Sey9PNNT5KqQKQuokdf9OSorSJJgo,15734
44
+ fameio/source/writer.py,sha256=9v4GGKc-5d65K48f0IlqgB0UTYu4XTwPzzLS_JD7Wp8,11353
45
+ fameio-2.0.0.dist-info/entry_points.txt,sha256=jvQVfwJjZXPWQjJlhj1Dt6PTeblryTc1GxjKeK90twI,123
46
+ fameio-2.0.0.dist-info/LICENSE.txt,sha256=eGHBZnhr9CWjE95SWjRfmhtK1lvVn5X4Fpf3KrrAZDg,10391
47
+ fameio-2.0.0.dist-info/LICENSES/Apache-2.0.txt,sha256=eGHBZnhr9CWjE95SWjRfmhtK1lvVn5X4Fpf3KrrAZDg,10391
48
+ fameio-2.0.0.dist-info/LICENSES/CC-BY-4.0.txt,sha256=y9WvMYKGt0ZW8UXf9QkZB8wj1tjJrQngKR7CSXeSukE,19051
49
+ fameio-2.0.0.dist-info/LICENSES/CC0-1.0.txt,sha256=9Ofzc7m5lpUDN-jUGkopOcLZC3cl6brz1QhKInF60yg,7169
50
+ fameio-2.0.0.dist-info/METADATA,sha256=V2Z4AkAJLlyCbFml9ZF6B9_0TzsrtkBr0F-5ZWWHwWs,30769
51
+ fameio-2.0.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
52
+ fameio-2.0.0.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.37.1)
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ convertFameResults=fameio.scripts:convertFameResults
3
+ makeFameRunConfig=fameio.scripts:makeFameRunConfig
4
+