sierra-research 1.3.6__py3-none-any.whl → 1.5.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 (254) hide show
  1. sierra/__init__.py +3 -3
  2. sierra/core/__init__.py +3 -3
  3. sierra/core/batchroot.py +223 -0
  4. sierra/core/cmdline.py +681 -1057
  5. sierra/core/compare.py +11 -0
  6. sierra/core/config.py +96 -88
  7. sierra/core/engine.py +306 -0
  8. sierra/core/execenv.py +380 -0
  9. sierra/core/expdef.py +11 -0
  10. sierra/core/experiment/__init__.py +1 -0
  11. sierra/core/experiment/bindings.py +150 -101
  12. sierra/core/experiment/definition.py +414 -245
  13. sierra/core/experiment/spec.py +83 -85
  14. sierra/core/exproot.py +44 -0
  15. sierra/core/generators/__init__.py +10 -0
  16. sierra/core/generators/experiment.py +528 -0
  17. sierra/core/generators/generator_factory.py +138 -137
  18. sierra/core/graphs/__init__.py +23 -0
  19. sierra/core/graphs/bcbridge.py +94 -0
  20. sierra/core/graphs/heatmap.py +245 -324
  21. sierra/core/graphs/pathset.py +27 -0
  22. sierra/core/graphs/schema.py +77 -0
  23. sierra/core/graphs/stacked_line.py +341 -0
  24. sierra/core/graphs/summary_line.py +506 -0
  25. sierra/core/logging.py +3 -2
  26. sierra/core/models/__init__.py +3 -1
  27. sierra/core/models/info.py +19 -0
  28. sierra/core/models/interface.py +52 -122
  29. sierra/core/pipeline/__init__.py +2 -5
  30. sierra/core/pipeline/pipeline.py +228 -126
  31. sierra/core/pipeline/stage1/__init__.py +10 -0
  32. sierra/core/pipeline/stage1/pipeline_stage1.py +45 -31
  33. sierra/core/pipeline/stage2/__init__.py +10 -0
  34. sierra/core/pipeline/stage2/pipeline_stage2.py +8 -11
  35. sierra/core/pipeline/stage2/runner.py +401 -0
  36. sierra/core/pipeline/stage3/__init__.py +12 -0
  37. sierra/core/pipeline/stage3/gather.py +321 -0
  38. sierra/core/pipeline/stage3/pipeline_stage3.py +37 -84
  39. sierra/core/pipeline/stage4/__init__.py +12 -2
  40. sierra/core/pipeline/stage4/pipeline_stage4.py +36 -354
  41. sierra/core/pipeline/stage5/__init__.py +12 -0
  42. sierra/core/pipeline/stage5/pipeline_stage5.py +33 -208
  43. sierra/core/pipeline/yaml.py +48 -0
  44. sierra/core/plugin.py +529 -62
  45. sierra/core/proc.py +11 -0
  46. sierra/core/prod.py +11 -0
  47. sierra/core/ros1/__init__.py +5 -1
  48. sierra/core/ros1/callbacks.py +22 -21
  49. sierra/core/ros1/cmdline.py +59 -88
  50. sierra/core/ros1/generators.py +159 -175
  51. sierra/core/ros1/variables/__init__.py +3 -0
  52. sierra/core/ros1/variables/exp_setup.py +122 -116
  53. sierra/core/startup.py +106 -76
  54. sierra/core/stat_kernels.py +4 -5
  55. sierra/core/storage.py +13 -32
  56. sierra/core/trampoline.py +30 -0
  57. sierra/core/types.py +116 -71
  58. sierra/core/utils.py +103 -106
  59. sierra/core/variables/__init__.py +1 -1
  60. sierra/core/variables/base_variable.py +12 -17
  61. sierra/core/variables/batch_criteria.py +387 -481
  62. sierra/core/variables/builtin.py +135 -0
  63. sierra/core/variables/exp_setup.py +19 -39
  64. sierra/core/variables/population_size.py +72 -76
  65. sierra/core/variables/variable_density.py +44 -68
  66. sierra/core/vector.py +1 -1
  67. sierra/main.py +256 -88
  68. sierra/plugins/__init__.py +119 -0
  69. sierra/plugins/compare/__init__.py +14 -0
  70. sierra/plugins/compare/graphs/__init__.py +19 -0
  71. sierra/plugins/compare/graphs/cmdline.py +120 -0
  72. sierra/plugins/compare/graphs/comparator.py +291 -0
  73. sierra/plugins/compare/graphs/inter_controller.py +531 -0
  74. sierra/plugins/compare/graphs/inter_scenario.py +297 -0
  75. sierra/plugins/compare/graphs/namecalc.py +53 -0
  76. sierra/plugins/compare/graphs/outputroot.py +73 -0
  77. sierra/plugins/compare/graphs/plugin.py +147 -0
  78. sierra/plugins/compare/graphs/preprocess.py +172 -0
  79. sierra/plugins/compare/graphs/schema.py +37 -0
  80. sierra/plugins/engine/__init__.py +14 -0
  81. sierra/plugins/engine/argos/__init__.py +18 -0
  82. sierra/plugins/{platform → engine}/argos/cmdline.py +144 -151
  83. sierra/plugins/{platform/argos/variables → engine/argos/generators}/__init__.py +5 -0
  84. sierra/plugins/engine/argos/generators/engine.py +394 -0
  85. sierra/plugins/engine/argos/plugin.py +393 -0
  86. sierra/plugins/{platform/argos/generators → engine/argos/variables}/__init__.py +5 -0
  87. sierra/plugins/engine/argos/variables/arena_shape.py +183 -0
  88. sierra/plugins/engine/argos/variables/cameras.py +240 -0
  89. sierra/plugins/engine/argos/variables/constant_density.py +112 -0
  90. sierra/plugins/engine/argos/variables/exp_setup.py +82 -0
  91. sierra/plugins/{platform → engine}/argos/variables/physics_engines.py +83 -87
  92. sierra/plugins/engine/argos/variables/population_constant_density.py +178 -0
  93. sierra/plugins/engine/argos/variables/population_size.py +115 -0
  94. sierra/plugins/engine/argos/variables/population_variable_density.py +123 -0
  95. sierra/plugins/engine/argos/variables/rendering.py +108 -0
  96. sierra/plugins/engine/ros1gazebo/__init__.py +18 -0
  97. sierra/plugins/engine/ros1gazebo/cmdline.py +175 -0
  98. sierra/plugins/{platform/ros1robot → engine/ros1gazebo}/generators/__init__.py +5 -0
  99. sierra/plugins/engine/ros1gazebo/generators/engine.py +125 -0
  100. sierra/plugins/engine/ros1gazebo/plugin.py +404 -0
  101. sierra/plugins/engine/ros1gazebo/variables/__init__.py +15 -0
  102. sierra/plugins/engine/ros1gazebo/variables/population_size.py +214 -0
  103. sierra/plugins/engine/ros1robot/__init__.py +18 -0
  104. sierra/plugins/engine/ros1robot/cmdline.py +159 -0
  105. sierra/plugins/{platform/ros1gazebo → engine/ros1robot}/generators/__init__.py +4 -0
  106. sierra/plugins/engine/ros1robot/generators/engine.py +95 -0
  107. sierra/plugins/engine/ros1robot/plugin.py +410 -0
  108. sierra/plugins/{hpc/local → engine/ros1robot/variables}/__init__.py +5 -0
  109. sierra/plugins/engine/ros1robot/variables/population_size.py +146 -0
  110. sierra/plugins/execenv/__init__.py +11 -0
  111. sierra/plugins/execenv/hpc/__init__.py +18 -0
  112. sierra/plugins/execenv/hpc/adhoc/__init__.py +18 -0
  113. sierra/plugins/execenv/hpc/adhoc/cmdline.py +30 -0
  114. sierra/plugins/execenv/hpc/adhoc/plugin.py +131 -0
  115. sierra/plugins/execenv/hpc/cmdline.py +137 -0
  116. sierra/plugins/execenv/hpc/local/__init__.py +18 -0
  117. sierra/plugins/execenv/hpc/local/cmdline.py +31 -0
  118. sierra/plugins/execenv/hpc/local/plugin.py +145 -0
  119. sierra/plugins/execenv/hpc/pbs/__init__.py +18 -0
  120. sierra/plugins/execenv/hpc/pbs/cmdline.py +30 -0
  121. sierra/plugins/execenv/hpc/pbs/plugin.py +121 -0
  122. sierra/plugins/execenv/hpc/slurm/__init__.py +18 -0
  123. sierra/plugins/execenv/hpc/slurm/cmdline.py +30 -0
  124. sierra/plugins/execenv/hpc/slurm/plugin.py +133 -0
  125. sierra/plugins/execenv/prefectserver/__init__.py +18 -0
  126. sierra/plugins/execenv/prefectserver/cmdline.py +66 -0
  127. sierra/plugins/execenv/prefectserver/dockerremote/__init__.py +18 -0
  128. sierra/plugins/execenv/prefectserver/dockerremote/cmdline.py +66 -0
  129. sierra/plugins/execenv/prefectserver/dockerremote/plugin.py +132 -0
  130. sierra/plugins/execenv/prefectserver/flow.py +66 -0
  131. sierra/plugins/execenv/prefectserver/local/__init__.py +18 -0
  132. sierra/plugins/execenv/prefectserver/local/cmdline.py +29 -0
  133. sierra/plugins/execenv/prefectserver/local/plugin.py +133 -0
  134. sierra/plugins/{hpc/adhoc → execenv/robot}/__init__.py +1 -0
  135. sierra/plugins/execenv/robot/turtlebot3/__init__.py +18 -0
  136. sierra/plugins/execenv/robot/turtlebot3/plugin.py +204 -0
  137. sierra/plugins/expdef/__init__.py +14 -0
  138. sierra/plugins/expdef/json/__init__.py +14 -0
  139. sierra/plugins/expdef/json/plugin.py +504 -0
  140. sierra/plugins/expdef/xml/__init__.py +14 -0
  141. sierra/plugins/expdef/xml/plugin.py +386 -0
  142. sierra/{core/hpc → plugins/proc}/__init__.py +1 -1
  143. sierra/plugins/proc/collate/__init__.py +15 -0
  144. sierra/plugins/proc/collate/cmdline.py +47 -0
  145. sierra/plugins/proc/collate/plugin.py +271 -0
  146. sierra/plugins/proc/compress/__init__.py +18 -0
  147. sierra/plugins/proc/compress/cmdline.py +47 -0
  148. sierra/plugins/proc/compress/plugin.py +123 -0
  149. sierra/plugins/proc/decompress/__init__.py +18 -0
  150. sierra/plugins/proc/decompress/plugin.py +96 -0
  151. sierra/plugins/proc/imagize/__init__.py +15 -0
  152. sierra/plugins/proc/imagize/cmdline.py +49 -0
  153. sierra/plugins/proc/imagize/plugin.py +270 -0
  154. sierra/plugins/proc/modelrunner/__init__.py +16 -0
  155. sierra/plugins/proc/modelrunner/plugin.py +250 -0
  156. sierra/plugins/proc/statistics/__init__.py +15 -0
  157. sierra/plugins/proc/statistics/cmdline.py +64 -0
  158. sierra/plugins/proc/statistics/plugin.py +390 -0
  159. sierra/plugins/{hpc → prod}/__init__.py +1 -0
  160. sierra/plugins/prod/graphs/__init__.py +18 -0
  161. sierra/plugins/prod/graphs/cmdline.py +269 -0
  162. sierra/plugins/prod/graphs/collate.py +279 -0
  163. sierra/plugins/prod/graphs/inter/__init__.py +13 -0
  164. sierra/plugins/prod/graphs/inter/generate.py +83 -0
  165. sierra/plugins/prod/graphs/inter/heatmap.py +86 -0
  166. sierra/plugins/prod/graphs/inter/line.py +134 -0
  167. sierra/plugins/prod/graphs/intra/__init__.py +15 -0
  168. sierra/plugins/prod/graphs/intra/generate.py +202 -0
  169. sierra/plugins/prod/graphs/intra/heatmap.py +74 -0
  170. sierra/plugins/prod/graphs/intra/line.py +114 -0
  171. sierra/plugins/prod/graphs/plugin.py +103 -0
  172. sierra/plugins/prod/graphs/targets.py +63 -0
  173. sierra/plugins/prod/render/__init__.py +18 -0
  174. sierra/plugins/prod/render/cmdline.py +72 -0
  175. sierra/plugins/prod/render/plugin.py +282 -0
  176. sierra/plugins/storage/__init__.py +5 -0
  177. sierra/plugins/storage/arrow/__init__.py +18 -0
  178. sierra/plugins/storage/arrow/plugin.py +38 -0
  179. sierra/plugins/storage/csv/__init__.py +9 -0
  180. sierra/plugins/storage/csv/plugin.py +12 -5
  181. sierra/version.py +3 -2
  182. sierra_research-1.5.0.dist-info/METADATA +238 -0
  183. sierra_research-1.5.0.dist-info/RECORD +186 -0
  184. {sierra_research-1.3.6.dist-info → sierra_research-1.5.0.dist-info}/WHEEL +1 -2
  185. sierra/core/experiment/xml.py +0 -454
  186. sierra/core/generators/controller_generator_parser.py +0 -34
  187. sierra/core/generators/exp_creator.py +0 -351
  188. sierra/core/generators/exp_generators.py +0 -142
  189. sierra/core/graphs/scatterplot2D.py +0 -109
  190. sierra/core/graphs/stacked_line_graph.py +0 -249
  191. sierra/core/graphs/stacked_surface_graph.py +0 -220
  192. sierra/core/graphs/summary_line_graph.py +0 -369
  193. sierra/core/hpc/cmdline.py +0 -142
  194. sierra/core/models/graphs.py +0 -87
  195. sierra/core/pipeline/stage2/exp_runner.py +0 -286
  196. sierra/core/pipeline/stage3/imagizer.py +0 -149
  197. sierra/core/pipeline/stage3/run_collator.py +0 -317
  198. sierra/core/pipeline/stage3/statistics_calculator.py +0 -478
  199. sierra/core/pipeline/stage4/graph_collator.py +0 -319
  200. sierra/core/pipeline/stage4/inter_exp_graph_generator.py +0 -240
  201. sierra/core/pipeline/stage4/intra_exp_graph_generator.py +0 -317
  202. sierra/core/pipeline/stage4/model_runner.py +0 -168
  203. sierra/core/pipeline/stage4/rendering.py +0 -283
  204. sierra/core/pipeline/stage4/yaml_config_loader.py +0 -103
  205. sierra/core/pipeline/stage5/inter_scenario_comparator.py +0 -328
  206. sierra/core/pipeline/stage5/intra_scenario_comparator.py +0 -989
  207. sierra/core/platform.py +0 -493
  208. sierra/core/plugin_manager.py +0 -369
  209. sierra/core/root_dirpath_generator.py +0 -241
  210. sierra/plugins/hpc/adhoc/plugin.py +0 -125
  211. sierra/plugins/hpc/local/plugin.py +0 -81
  212. sierra/plugins/hpc/pbs/__init__.py +0 -9
  213. sierra/plugins/hpc/pbs/plugin.py +0 -126
  214. sierra/plugins/hpc/slurm/__init__.py +0 -9
  215. sierra/plugins/hpc/slurm/plugin.py +0 -130
  216. sierra/plugins/platform/__init__.py +0 -9
  217. sierra/plugins/platform/argos/__init__.py +0 -9
  218. sierra/plugins/platform/argos/generators/platform_generators.py +0 -383
  219. sierra/plugins/platform/argos/plugin.py +0 -337
  220. sierra/plugins/platform/argos/variables/arena_shape.py +0 -145
  221. sierra/plugins/platform/argos/variables/cameras.py +0 -243
  222. sierra/plugins/platform/argos/variables/constant_density.py +0 -136
  223. sierra/plugins/platform/argos/variables/exp_setup.py +0 -113
  224. sierra/plugins/platform/argos/variables/population_constant_density.py +0 -175
  225. sierra/plugins/platform/argos/variables/population_size.py +0 -102
  226. sierra/plugins/platform/argos/variables/population_variable_density.py +0 -132
  227. sierra/plugins/platform/argos/variables/rendering.py +0 -104
  228. sierra/plugins/platform/ros1gazebo/__init__.py +0 -9
  229. sierra/plugins/platform/ros1gazebo/cmdline.py +0 -213
  230. sierra/plugins/platform/ros1gazebo/generators/platform_generators.py +0 -137
  231. sierra/plugins/platform/ros1gazebo/plugin.py +0 -335
  232. sierra/plugins/platform/ros1gazebo/variables/__init__.py +0 -10
  233. sierra/plugins/platform/ros1gazebo/variables/population_size.py +0 -204
  234. sierra/plugins/platform/ros1robot/__init__.py +0 -9
  235. sierra/plugins/platform/ros1robot/cmdline.py +0 -175
  236. sierra/plugins/platform/ros1robot/generators/platform_generators.py +0 -112
  237. sierra/plugins/platform/ros1robot/plugin.py +0 -373
  238. sierra/plugins/platform/ros1robot/variables/__init__.py +0 -10
  239. sierra/plugins/platform/ros1robot/variables/population_size.py +0 -146
  240. sierra/plugins/robot/__init__.py +0 -9
  241. sierra/plugins/robot/turtlebot3/__init__.py +0 -9
  242. sierra/plugins/robot/turtlebot3/plugin.py +0 -194
  243. sierra_research-1.3.6.data/data/share/man/man1/sierra-cli.1 +0 -2349
  244. sierra_research-1.3.6.data/data/share/man/man7/sierra-examples.7 +0 -488
  245. sierra_research-1.3.6.data/data/share/man/man7/sierra-exec-envs.7 +0 -331
  246. sierra_research-1.3.6.data/data/share/man/man7/sierra-glossary.7 +0 -285
  247. sierra_research-1.3.6.data/data/share/man/man7/sierra-platforms.7 +0 -358
  248. sierra_research-1.3.6.data/data/share/man/man7/sierra-usage.7 +0 -725
  249. sierra_research-1.3.6.data/data/share/man/man7/sierra.7 +0 -78
  250. sierra_research-1.3.6.dist-info/METADATA +0 -500
  251. sierra_research-1.3.6.dist-info/RECORD +0 -133
  252. sierra_research-1.3.6.dist-info/top_level.txt +0 -1
  253. {sierra_research-1.3.6.dist-info → sierra_research-1.5.0.dist-info}/entry_points.txt +0 -0
  254. {sierra_research-1.3.6.dist-info → sierra_research-1.5.0.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,172 @@
1
+ #
2
+ # Copyright 2024 John Harwell, All rights reserved.
3
+ #
4
+ # SPDX-License Identifier: MIT
5
+ #
6
+ """Preprocess inter-experiment outputs for stage 5.
7
+
8
+ Basically, gather statistics generated from controllers for graph generation in
9
+ previous stages into the correct files(s) for comparison.
10
+ """
11
+
12
+ # Core packages
13
+ import pathlib
14
+ import typing as tp
15
+
16
+ # 3rd party packages
17
+ import pandas as pd
18
+
19
+ # Project packages
20
+ from sierra.core import utils, config, storage
21
+ from sierra.core.variables import batch_criteria as bc
22
+
23
+
24
+ class IntraExpPreparer:
25
+ """
26
+ Collate generated stats from previous stages into files(s) for comparison.
27
+ """
28
+
29
+ def __init__(
30
+ self,
31
+ ipath_stem: pathlib.Path,
32
+ ipath_leaf: str,
33
+ opath_stem: pathlib.Path,
34
+ criteria: bc.XVarBatchCriteria,
35
+ ):
36
+ self.ipath_stem = ipath_stem
37
+ self.ipath_leaf = ipath_leaf
38
+ self.opath_stem = opath_stem
39
+ self.criteria = criteria
40
+
41
+ def for_cc(
42
+ self,
43
+ controller: str,
44
+ opath_leaf: str,
45
+ index: int,
46
+ inc_exps: tp.Optional[str],
47
+ ) -> None:
48
+ """
49
+ Take batch-level dataframes and creates a new dataframe.
50
+
51
+ Has:
52
+
53
+ - Experiment names for the index.
54
+
55
+ - Controller names as column names (guaranteed to be unique, since
56
+ that's what we are comparing).
57
+
58
+ - df[controller] columns as timeslices *across* columns (i.e., across
59
+ experiments in the batch) in the source dataframe.
60
+ """
61
+ exts = config.kStats["mean"].exts
62
+ exts.update(config.kStats["conf95"].exts)
63
+ exts.update(config.kStats["bw"].exts)
64
+
65
+ for k in exts:
66
+ stat_ipath = pathlib.Path(self.ipath_stem, self.ipath_leaf + exts[k])
67
+ stat_opath = pathlib.Path(self.opath_stem, opath_leaf + exts[k])
68
+ df = self._cc_for_stat(stat_ipath, stat_opath, index, inc_exps, controller)
69
+
70
+ if df is not None:
71
+ storage.df_write(
72
+ df,
73
+ self.opath_stem / (opath_leaf + exts[k]),
74
+ "storage.csv",
75
+ index=True,
76
+ )
77
+
78
+ def for_sc(
79
+ self,
80
+ scenario: str,
81
+ opath_leaf: str,
82
+ index: int,
83
+ inc_exps: tp.Optional[str],
84
+ ) -> None:
85
+ """
86
+ Take batch-level dataframes and creates a new dataframe.
87
+
88
+ Has:
89
+
90
+ - Experiment names for the index.
91
+
92
+ - Scenario names as column names (guaranteed to be unique, since
93
+ that's what we are comparing).
94
+
95
+ - df[scenario] columns as timeslices *across* columns (i.e., across
96
+ experiments in the batch) in the source dataframe.
97
+ """
98
+ exts = config.kStats["mean"].exts
99
+ exts.update(config.kStats["conf95"].exts)
100
+ exts.update(config.kStats["bw"].exts)
101
+
102
+ for k in exts:
103
+ stat_ipath = pathlib.Path(self.ipath_stem, self.ipath_leaf + exts[k])
104
+ stat_opath = pathlib.Path(self.opath_stem, opath_leaf + exts[k])
105
+ df = self._sc_for_stat(stat_ipath, stat_opath, index, inc_exps, scenario)
106
+
107
+ if df is not None:
108
+ storage.df_write(
109
+ df,
110
+ self.opath_stem / (opath_leaf + exts[k]),
111
+ "storage.csv",
112
+ index=True,
113
+ )
114
+
115
+ def _cc_for_stat(
116
+ self,
117
+ ipath: pathlib.Path,
118
+ opath: pathlib.Path,
119
+ index: int,
120
+ inc_exps: tp.Optional[str],
121
+ controller: str,
122
+ ) -> pd.DataFrame:
123
+
124
+ if utils.path_exists(opath):
125
+ cum_df = storage.df_read(opath, "storage.csv", index_col="Experiment ID")
126
+ else:
127
+ cum_df = pd.DataFrame(index=self.criteria.gen_exp_names())
128
+ cum_df.index.name = "Experiment ID"
129
+
130
+ if utils.path_exists(ipath):
131
+ df = storage.df_read(ipath, "storage.csv")
132
+
133
+ # if inc_exps is not None:
134
+ # cols = utils.exp_include_filter(
135
+ # inc_exps, list(df.columns), self.criteria.n_exp()
136
+ # )
137
+
138
+ cum_df[controller] = df.iloc[index]
139
+ return cum_df
140
+
141
+ return None
142
+
143
+ def _sc_for_stat(
144
+ self,
145
+ ipath: pathlib.Path,
146
+ opath: pathlib.Path,
147
+ index: int,
148
+ inc_exps: tp.Optional[str],
149
+ scenario: str,
150
+ ) -> pd.DataFrame:
151
+ if utils.path_exists(opath):
152
+ cum_df = storage.df_read(opath, "storage.csv", index_col="Experiment ID")
153
+ else:
154
+ cum_df = pd.DataFrame(index=self.criteria.gen_exp_names())
155
+ cum_df.index.name = "Experiment ID"
156
+
157
+ if utils.path_exists(ipath):
158
+ df = storage.df_read(ipath, "storage.csv")
159
+
160
+ # if inc_exps is not None:
161
+ # cols = utils.exp_include_filter(
162
+ # inc_exps, list(df.columns), self.criteria.n_exp()
163
+ # )
164
+
165
+ cum_df[scenario] = df.iloc[index]
166
+
167
+ return cum_df
168
+
169
+ return None
170
+
171
+
172
+ __all__ = ["IntraExpPreparer"]
@@ -0,0 +1,37 @@
1
+ #
2
+ # Copyright 2025 John Harwell, All rights reserved.
3
+ #
4
+ # SPDX-License Identifier: MIT
5
+ #
6
+ """
7
+ YAML schemas for comparison graphs for stage 5.
8
+
9
+ See :ref:`plugins/compare/graphs` for more details.
10
+ """
11
+ # Core packages
12
+
13
+ # 3rd party packages
14
+ import strictyaml
15
+
16
+ # Project packages
17
+
18
+
19
+ cc = strictyaml.Map(
20
+ {
21
+ "src_stem": strictyaml.Str(),
22
+ "dest_stem": strictyaml.Str(),
23
+ strictyaml.Optional("title"): strictyaml.Str(),
24
+ strictyaml.Optional("label"): strictyaml.Str(),
25
+ strictyaml.Optional("primary_axis"): strictyaml.Int(),
26
+ strictyaml.Optional("include_exp"): strictyaml.Str(),
27
+ strictyaml.Optional("backend"): strictyaml.Str(),
28
+ }
29
+ )
30
+ """
31
+ Schema for controller comparison graphs.
32
+ """
33
+
34
+ sc = cc
35
+ """
36
+ Schema for scenario comparison graphs.
37
+ """
@@ -0,0 +1,14 @@
1
+ # Copyright 2021 John Harwell, All rights reserved.
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ """
5
+ Container module for plugins related to :term:`Engines <Engine>`.
6
+
7
+ Driven by ``--engine``.
8
+ """
9
+
10
+ # Core packages
11
+
12
+ # 3rd party packages
13
+
14
+ # Project packages
@@ -0,0 +1,18 @@
1
+ # Copyright 2021 John Harwell, All rights reserved.
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ """
5
+ Container module for the term:`ARGoS` engine.
6
+
7
+ See :ref:`plugins/engine/argos`.
8
+ """
9
+
10
+ # Core packages
11
+
12
+ # 3rd party packages
13
+
14
+ # Project packages
15
+
16
+
17
+ def sierra_plugin_type() -> str:
18
+ return "pipeline"
@@ -3,7 +3,7 @@
3
3
  # SPDX-License-Identifier: MIT
4
4
  #
5
5
  """
6
- Command line parsing and validation for the :term:`ARGoS`.
6
+ Command line definitions for the :term:`ARGoS` :term:`Engine`.
7
7
  """
8
8
 
9
9
  # Core packages
@@ -13,68 +13,43 @@ import argparse
13
13
  # 3rd party packages
14
14
 
15
15
  # Project packages
16
- from sierra.core import types, config, hpc
17
- import sierra.core.cmdline as cmd
16
+ from sierra.core import types, config
17
+ from sierra.plugins import PluginCmdline
18
18
 
19
19
 
20
- class PlatformCmdline(cmd.BaseCmdline):
21
- """Defines :term:`ARGoS` extensions to :class:`~sierra.core.cmdline.CoreCmdline`.
20
+ class EngineCmdline(PluginCmdline):
21
+ """Defines :term:`ARGoS` cmdline."""
22
22
 
23
- """
24
-
25
- def __init__(self,
26
- parents: tp.Optional[tp.List[argparse.ArgumentParser]],
27
- stages: tp.List[int]) -> None:
28
-
29
- if parents is not None:
30
- self.parser = argparse.ArgumentParser(add_help=False,
31
- parents=parents,
32
- allow_abbrev=False)
33
- else:
34
- self.parser = argparse.ArgumentParser(add_help=False,
35
- allow_abbrev=False)
36
-
37
- self.scaffold_cli()
38
- self.init_cli(stages)
39
-
40
- def scaffold_cli(self) -> None:
41
- self.stage1_exp = self.parser.add_argument_group(
42
- 'Stage1: Experiment generation')
43
- self.stage1_physics = self.parser.add_argument_group(
44
- 'Stage1: Configuring ARGoS physics engines')
45
- self.stage1_rendering = self.parser.add_argument_group(
46
- 'Stage1: Rendering (see also stage4 rendering options)')
47
- self.stage1_robots = self.parser.add_argument_group(
48
- 'Stage1: Configuring robots')
49
-
50
- def init_cli(self, stages: tp.List[int]) -> None:
51
- if 1 in stages:
52
- self.init_stage1()
23
+ def __init__(
24
+ self,
25
+ parents: tp.List[argparse.ArgumentParser],
26
+ stages: tp.List[int],
27
+ ) -> None:
28
+ super().__init__(parents, stages)
53
29
 
54
30
  def init_stage1(self) -> None:
55
31
  # Experiment options
56
32
 
57
- self.stage1_exp.add_argument("--exp-setup",
58
- help="""
59
-
60
- Defines experiment run length, :term:`Ticks
61
- <Tick>` per second for the experiment
62
- (<experiment> tag), # of datapoints to
63
- capture/capture interval for each
64
- simulation. See :ref:`ln-sierra-vars-expsetup` for
65
- a full description.
66
-
67
- """ + self.stage_usage_doc([1]),
68
- default="exp_setup.T{0}.K{1}.N{2}".format(
69
- config.kARGoS['n_secs_per_run'],
70
- config.kARGoS['n_ticks_per_sec'],
71
- config.kExperimentalRunData['n_datapoints_1D']))
33
+ self.stage1.add_argument(
34
+ "--exp-setup",
35
+ help="""
36
+ Defines experiment run length, :term:`Ticks <Tick>` per second
37
+ for the experiment (<experiment> tag). See
38
+ :ref:`usage/vars/expsetup` for a full description.
39
+ """
40
+ + self.stage_usage_doc([1]),
41
+ default="exp_setup.T{0}.K{1}".format(
42
+ config.kARGoS["n_secs_per_run"],
43
+ config.kARGoS["n_ticks_per_sec"],
44
+ ),
45
+ )
72
46
 
73
47
  # Physics engines options
74
48
 
75
- self.stage1_physics.add_argument("--physics-engine-type2D",
76
- choices=['dynamics2d'],
77
- help="""
49
+ self.stage1.add_argument(
50
+ "--physics-engine-type2D",
51
+ choices=["dynamics2d"],
52
+ help="""
78
53
 
79
54
  The type of 2D physics engine to use
80
55
  for managing spatial extents within the
@@ -84,12 +59,15 @@ class PlatformCmdline(cmd.BaseCmdline):
84
59
  controlled by 2D physics engines is
85
60
  defined on a per ``--project`` basis.
86
61
 
87
- """ + self.stage_usage_doc([1]),
88
- default='dynamics2d')
62
+ """
63
+ + self.stage_usage_doc([1]),
64
+ default="dynamics2d",
65
+ )
89
66
 
90
- self.stage1_physics.add_argument("--physics-engine-type3D",
91
- choices=['dynamics3d'],
92
- help="""
67
+ self.stage1.add_argument(
68
+ "--physics-engine-type3D",
69
+ choices=["dynamics3d"],
70
+ help="""
93
71
 
94
72
  The type of 3D physics engine to use
95
73
  for managing 3D volumetric extents
@@ -100,13 +78,16 @@ class PlatformCmdline(cmd.BaseCmdline):
100
78
  engines is defined on a per
101
79
  ``--project`` basis.
102
80
 
103
- """ + self.stage_usage_doc([1]),
104
- default='dynamics3d')
81
+ """
82
+ + self.stage_usage_doc([1]),
83
+ default="dynamics3d",
84
+ )
105
85
 
106
- self.stage1_physics.add_argument("--physics-n-engines",
107
- choices=[1, 2, 4, 6, 8, 12, 16, 24],
108
- type=int,
109
- help="""
86
+ self.stage1.add_argument(
87
+ "--physics-n-engines",
88
+ choices=[1, 2, 4, 6, 8, 12, 16, 24],
89
+ type=int,
90
+ help="""
110
91
 
111
92
  # of physics engines to use during
112
93
  simulation (yay ARGoS!). If N > 1, the
@@ -130,7 +111,7 @@ class PlatformCmdline(cmd.BaseCmdline):
130
111
  the arena, and 2 3D engines will manage
131
112
  the other 2/3 of the arena.
132
113
 
133
- If ``--exec-env`` is something other
114
+ If ``--execenv`` is something other
134
115
  than ``hpc.local`` then the # physics
135
116
  engines will be computed from the HPC
136
117
  environment, and the cmdline value (if
@@ -158,10 +139,13 @@ class PlatformCmdline(cmd.BaseCmdline):
158
139
 
159
140
  This is enforced by SIERRA.
160
141
 
161
- """ + self.stage_usage_doc([1]))
162
- self.stage1_physics.add_argument("--physics-iter-per-tick",
163
- type=int,
164
- help="""
142
+ """
143
+ + self.stage_usage_doc([1]),
144
+ )
145
+ self.stage1.add_argument(
146
+ "--physics-iter-per-tick",
147
+ type=int,
148
+ help="""
165
149
 
166
150
  The # of iterations all physics engines
167
151
  should perform per :term:`Tick` each
@@ -170,29 +154,32 @@ class PlatformCmdline(cmd.BaseCmdline):
170
154
  control loops is set via
171
155
  ``--exp-setup``).
172
156
 
173
- """ + self.stage_usage_doc([1]),
174
- default=config.kARGoS['physics_iter_per_tick'])
157
+ """
158
+ + self.stage_usage_doc([1]),
159
+ default=config.kARGoS["physics_iter_per_tick"],
160
+ )
175
161
 
176
- self.stage1_physics.add_argument("--physics-spatial-hash2D",
177
- help="""
162
+ self.stage1.add_argument(
163
+ "--physics-spatial-hash2D",
164
+ help="""
178
165
 
179
166
  Specify that each 2D physics engine
180
167
  should use a spatial hash (only applies
181
168
  to ``dynamics2d`` engine type).
182
169
 
183
170
  """,
184
- action='store_true')
171
+ action="store_true",
172
+ )
185
173
 
186
174
  # Rendering options
187
- self.stage1_rendering.add_argument("--camera-config",
188
- choices=['overhead',
189
- 'sw',
190
- 'sw+interp'],
191
- help="""
175
+ self.stage1.add_argument(
176
+ "--camera-config",
177
+ choices=["overhead", "sw", "sw+interp"],
178
+ help="""
192
179
 
193
180
  Select the camera configuration for
194
181
  simulation. Ignored unless
195
- ``--platform-vc`` is passed. Valid
182
+ ``--engine-vc`` is passed. Valid
196
183
  values are:
197
184
 
198
185
  - ``overhead`` - Use a single
@@ -210,16 +197,19 @@ class PlatformCmdline(cmd.BaseCmdline):
210
197
  - ``sw+interp`` - Same as ``sw``, but
211
198
  with interpolation between cameras.
212
199
 
213
- """ + self.stage_usage_doc([1]),
214
- default='overhead')
200
+ """
201
+ + self.stage_usage_doc([1]),
202
+ default="overhead",
203
+ )
215
204
 
216
- self.stage1_robots.add_argument("--with-robot-rab",
217
- help="""
205
+ self.stage1.add_argument(
206
+ "--with-robot-rab",
207
+ help="""
218
208
 
219
209
  If passed, do not remove the Range and
220
210
  Bearing (RAB) sensor, actuator, and
221
211
  medium XML definitions from
222
- ``--template-input-file`` before
212
+ ``--expdef-template`` before
223
213
  generating experimental
224
214
  inputs. Otherwise, the following XML
225
215
  tags are removed if they exist:
@@ -228,16 +218,19 @@ class PlatformCmdline(cmd.BaseCmdline):
228
218
  - ``.//actuators/range_and_bearing``
229
219
  - ``.//sensors/range_and_bearing``
230
220
 
231
- """ + self.stage_usage_doc([1]),
232
- action="store_true",
233
- default=False)
221
+ """
222
+ + self.stage_usage_doc([1]),
223
+ action="store_true",
224
+ default=False,
225
+ )
234
226
 
235
- self.stage1_robots.add_argument("--with-robot-leds",
236
- help="""
227
+ self.stage1.add_argument(
228
+ "--with-robot-leds",
229
+ help="""
237
230
 
238
231
  If passed, do not remove the robot LED
239
232
  actuator XML definitions from the
240
- ``--template-input-file`` before
233
+ ``--expdef-template`` before
241
234
  generating experimental
242
235
  inputs. Otherwise, the following XML
243
236
  tags are removed if they exist:
@@ -246,16 +239,19 @@ class PlatformCmdline(cmd.BaseCmdline):
246
239
  - ``.//medium/leds``
247
240
  - ``.//sensors/colored_blob_omnidirectional_camera``
248
241
 
249
- """ + self.stage_usage_doc([1]),
250
- action="store_true",
251
- default=False)
242
+ """
243
+ + self.stage_usage_doc([1]),
244
+ action="store_true",
245
+ default=False,
246
+ )
252
247
 
253
- self.stage1_robots.add_argument("--with-robot-battery",
254
- help="""
248
+ self.stage1.add_argument(
249
+ "--with-robot-battery",
250
+ help="""
255
251
 
256
252
  If passed, do not remove the robot
257
253
  battery sensor XML definitions from
258
- ``--template-input-file`` before
254
+ ``--expdef-template`` before
259
255
  generating experimental
260
256
  inputs. Otherwise, the following XML
261
257
  tags are removed if they exist:
@@ -263,63 +259,60 @@ class PlatformCmdline(cmd.BaseCmdline):
263
259
  - ``.//entity/*/battery``
264
260
  - ``.//sensors/battery``
265
261
 
266
- """ + self.stage_usage_doc([1]),
267
- action="store_true",
268
- default=False)
269
-
270
- self.stage1_robots.add_argument("--n-robots",
271
- help="""
272
-
273
- The # robots that should be used in the
274
- simulation. Can be used to override
275
- batch criteria, or to supplement
276
- experiments that do not set it so that
277
- manual modification of input file is
278
- unneccesary.
279
-
280
- """ + self.stage_usage_doc([1]),
281
- type=int,
282
- default=None)
283
-
284
- @staticmethod
285
- def cmdopts_update(cli_args, cmdopts: types.Cmdopts) -> None:
286
- """Update cmdopts with ARGoS-specific cmdline options.
287
-
288
- """
289
- hpc.cmdline.HPCCmdline.cmdopts_update(cli_args, cmdopts)
290
-
291
- updates = {
292
- # Stage 1
293
- 'n_robots': cli_args.n_robots,
294
-
295
- 'exp_setup': cli_args.exp_setup,
296
-
297
- 'physics_n_engines': cli_args.physics_n_engines,
298
- 'physics_n_threads': cli_args.physics_n_engines, # alias
299
- "physics_engine_type2D": cli_args.physics_engine_type2D,
300
- "physics_engine_type3D": cli_args.physics_engine_type3D,
301
- "physics_iter_per_tick": cli_args.physics_iter_per_tick,
302
- "physics_spatial_hash2D": cli_args.physics_spatial_hash2D,
303
-
304
- "with_robot_rab": cli_args.with_robot_rab,
305
- "with_robot_leds": cli_args.with_robot_leds,
306
- "with_robot_battery": cli_args.with_robot_battery,
307
-
308
- 'camera_config': cli_args.camera_config,
309
-
310
- }
311
-
312
- cmdopts.update(updates)
313
-
314
-
315
- class CmdlineValidator(cmd.CoreCmdlineValidator):
316
- pass
262
+ """
263
+ + self.stage_usage_doc([1]),
264
+ action="store_true",
265
+ default=False,
266
+ )
267
+
268
+ self.stage1.add_argument(
269
+ "--n-agents",
270
+ help="""
271
+ The # agents (robots) that should
272
+ be used in the simulation. Can be
273
+ used to override batch criteria, or
274
+ to supplement experiments that do
275
+ not set it so that manual
276
+ modification of input file is
277
+ unneccesary.
278
+ """
279
+ + self.stage_usage_doc([1]),
280
+ type=int,
281
+ default=None,
282
+ )
283
+
284
+
285
+ def build(
286
+ parents: tp.List[argparse.ArgumentParser], stages: tp.List[int]
287
+ ) -> PluginCmdline:
288
+ """
289
+ Get a cmdline parser supporting the :term:`ARGoS` engine.
290
+ """
291
+ return EngineCmdline(parents=parents, stages=stages)
292
+
293
+
294
+ def to_cmdopts(args: argparse.Namespace) -> types.Cmdopts:
295
+ """Update cmdopts with ARGoS-specific cmdline options."""
296
+ return {
297
+ # Stage 1
298
+ "n_agents": args.n_agents,
299
+ "exp_setup": args.exp_setup,
300
+ "physics_n_engines": args.physics_n_engines,
301
+ "physics_n_threads": args.physics_n_engines, # alias
302
+ "physics_engine_type2D": args.physics_engine_type2D,
303
+ "physics_engine_type3D": args.physics_engine_type3D,
304
+ "physics_iter_per_tick": args.physics_iter_per_tick,
305
+ "physics_spatial_hash2D": args.physics_spatial_hash2D,
306
+ "with_robot_rab": args.with_robot_rab,
307
+ "with_robot_leds": args.with_robot_leds,
308
+ "with_robot_battery": args.with_robot_battery,
309
+ "camera_config": args.camera_config,
310
+ }
317
311
 
318
312
 
319
313
  def sphinx_cmdline_stage1():
320
- return PlatformCmdline(None, [1]).parser
314
+ return EngineCmdline([], [1]).parser
321
315
 
322
316
 
323
317
  def sphinx_cmdline_stage2():
324
- parent = hpc.cmdline.HPCCmdline([2]).parser
325
- return PlatformCmdline([parent], [2]).parser
318
+ return EngineCmdline([], [2]).parser
@@ -1,6 +1,11 @@
1
1
  # Copyright 2022 John Harwell, All rights reserved.
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
+ """
5
+ Generators module for the :term:`ArgoS` engine.
6
+
7
+ See :ref:`plugins/engine/argos`.
8
+ """
4
9
 
5
10
  # Core packages
6
11