rtc-tools-interface 0.7.0b2__tar.gz → 0.7.0b3__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.
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/PKG-INFO +1 -1
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtc_tools_interface.egg-info/PKG-INFO +1 -1
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtc_tools_interface.egg-info/SOURCES.txt +1 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/_version.py +3 -3
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/goal_generator_mixin.py +6 -16
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/plot_mixin.py +3 -1
- rtc-tools-interface-0.7.0b3/rtctools_interface/utils/read_goals_mixin.py +31 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/utils/results_collection.py +9 -2
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/COPYING.LESSER +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/README.md +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtc_tools_interface.egg-info/dependency_links.txt +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtc_tools_interface.egg-info/requires.txt +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtc_tools_interface.egg-info/top_level.txt +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/__init__.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/__init__.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/base_goal.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/base_optimization_problem.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/goal_performance_metrics.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/goal_table_schema.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/helpers/__init__.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/helpers/statistics_mixin.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/plot_goals_mixin.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/optimization/read_goals.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/utils/__init__.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/utils/plot_table_schema.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/utils/read_plot_table.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/utils/serialization.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/utils/type_definitions.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/setup.cfg +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/setup.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/__init__.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/optimization/__init__.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/optimization/test_base_optimization_problem.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/optimization/test_passing_goals_directly.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/optimization/test_plot_goals_mixin.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/optimization/test_read_goals.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/simulation/__init__.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/simulation/test_base_simulation_problem.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/simulation/test_plot_mixin.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/utils/__init__.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/utils/get_test.py +0 -0
- {rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/versioneer.py +0 -0
{rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtc_tools_interface.egg-info/SOURCES.txt
RENAMED
|
@@ -23,6 +23,7 @@ rtctools_interface/optimization/helpers/__init__.py
|
|
|
23
23
|
rtctools_interface/optimization/helpers/statistics_mixin.py
|
|
24
24
|
rtctools_interface/utils/__init__.py
|
|
25
25
|
rtctools_interface/utils/plot_table_schema.py
|
|
26
|
+
rtctools_interface/utils/read_goals_mixin.py
|
|
26
27
|
rtctools_interface/utils/read_plot_table.py
|
|
27
28
|
rtctools_interface/utils/results_collection.py
|
|
28
29
|
rtctools_interface/utils/serialization.py
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2023-11-
|
|
11
|
+
"date": "2023-11-28T16:07:57+0000",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "0.7.
|
|
14
|
+
"full-revisionid": "499d6e416027fec2a9b6dd1cc4d7249b30a41463",
|
|
15
|
+
"version": "0.7.0b3"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import Dict, Union
|
|
4
4
|
import logging
|
|
5
|
-
import os
|
|
6
5
|
import pandas as pd
|
|
7
6
|
|
|
8
7
|
from rtctools_interface.optimization.base_goal import BaseGoal
|
|
9
8
|
from rtctools_interface.optimization.goal_performance_metrics import get_performance_metrics
|
|
10
9
|
from rtctools_interface.optimization.helpers.statistics_mixin import StatisticsMixin
|
|
11
|
-
from rtctools_interface.
|
|
10
|
+
from rtctools_interface.utils.read_goals_mixin import ReadGoalsMixin
|
|
12
11
|
|
|
13
12
|
logger = logging.getLogger("rtctools")
|
|
14
13
|
|
|
@@ -21,7 +20,7 @@ def write_performance_metrics(performance_metrics: Dict[str, pd.DataFrame], outp
|
|
|
21
20
|
performance_metric_table.to_csv(output_path / f"{goal_id}.csv")
|
|
22
21
|
|
|
23
22
|
|
|
24
|
-
class GoalGeneratorMixin(StatisticsMixin):
|
|
23
|
+
class GoalGeneratorMixin(ReadGoalsMixin, StatisticsMixin):
|
|
25
24
|
# TODO: remove pylint disable below once we have more public functions.
|
|
26
25
|
# pylint: disable=too-few-public-methods
|
|
27
26
|
"""Add path goals as specified in the goal_table.
|
|
@@ -34,19 +33,10 @@ class GoalGeneratorMixin(StatisticsMixin):
|
|
|
34
33
|
|
|
35
34
|
def __init__(self, **kwargs):
|
|
36
35
|
super().__init__(**kwargs)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
self.
|
|
41
|
-
|
|
42
|
-
self._goal_generator_path_goals = read_goals(
|
|
43
|
-
self.goal_table_file, path_goal=True, read_from=self.read_from, goals_to_generate=self.goals_to_generate
|
|
44
|
-
)
|
|
45
|
-
self._goal_generator_non_path_goals = read_goals(
|
|
46
|
-
self.goal_table_file, path_goal=False, read_from=self.read_from, goals_to_generate=self.goals_to_generate
|
|
47
|
-
)
|
|
48
|
-
self._all_goal_generator_goals = self._goal_generator_path_goals + self._goal_generator_non_path_goals
|
|
49
|
-
|
|
36
|
+
if not hasattr(self, "_all_goal_generator_goals"):
|
|
37
|
+
goals_to_generate = kwargs.get("goals_to_generate", [])
|
|
38
|
+
read_from = kwargs.get("read_goals_from", "csv_table")
|
|
39
|
+
self.load_goals(read_from, goals_to_generate)
|
|
50
40
|
if self.calculate_performance_metrics:
|
|
51
41
|
# A dataframe for each goal defined by the goal generator
|
|
52
42
|
self._performance_metrics = {}
|
|
@@ -9,11 +9,13 @@ from rtctools_interface.utils.results_collection import PlottingBaseMixin
|
|
|
9
9
|
logger = logging.getLogger("rtctools")
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class PlotMixin(
|
|
12
|
+
class PlotMixin(PlottingBaseMixin, StatisticsMixin):
|
|
13
13
|
"""
|
|
14
14
|
Class for plotting results.
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
|
+
optimization_problem = True
|
|
18
|
+
|
|
17
19
|
def priority_completed(self, priority: int) -> None:
|
|
18
20
|
"""Store priority-dependent results required for plotting."""
|
|
19
21
|
timeseries_data = self.collect_timeseries_data(list(set(self.custom_variables + self.state_variables)))
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Mixin to read the goal table and store as class variables."""
|
|
2
|
+
import os
|
|
3
|
+
from typing import Literal, Optional
|
|
4
|
+
|
|
5
|
+
from rtctools_interface.optimization.read_goals import read_goals
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ReadGoalsMixin:
|
|
9
|
+
"""Read the goal table either from the default or specified path."""
|
|
10
|
+
|
|
11
|
+
def load_goals(
|
|
12
|
+
self, read_from: Literal["csv_table", "passed_list"] = "csv_table", goals_to_generate: Optional[list] = None
|
|
13
|
+
):
|
|
14
|
+
"""Read goal table and store as instance variable."""
|
|
15
|
+
goals_to_generate = goals_to_generate if goals_to_generate else []
|
|
16
|
+
if not hasattr(self, "goal_table_file"):
|
|
17
|
+
self.goal_table_file = os.path.join(self._input_folder, "goal_table.csv")
|
|
18
|
+
|
|
19
|
+
if read_from == "csv_table" and os.path.isfile(self.goal_table_file) or read_from == "passed_list":
|
|
20
|
+
self._goal_generator_path_goals = read_goals(
|
|
21
|
+
self.goal_table_file, path_goal=True, read_from=read_from, goals_to_generate=goals_to_generate
|
|
22
|
+
)
|
|
23
|
+
self._goal_generator_non_path_goals = read_goals(
|
|
24
|
+
self.goal_table_file,
|
|
25
|
+
path_goal=False,
|
|
26
|
+
read_from=read_from,
|
|
27
|
+
goals_to_generate=goals_to_generate,
|
|
28
|
+
)
|
|
29
|
+
self._all_goal_generator_goals = self._goal_generator_path_goals + self._goal_generator_non_path_goals
|
|
30
|
+
else:
|
|
31
|
+
self._all_goal_generator_goals = []
|
|
@@ -8,6 +8,7 @@ from typing import Dict, List, Optional
|
|
|
8
8
|
|
|
9
9
|
import numpy as np
|
|
10
10
|
from rtctools_interface.utils.plot_table_schema import PlotTableRow
|
|
11
|
+
from rtctools_interface.utils.read_goals_mixin import ReadGoalsMixin
|
|
11
12
|
|
|
12
13
|
from rtctools_interface.utils.serialization import deserialize, serialize
|
|
13
14
|
from rtctools_interface.utils.read_plot_table import get_plot_config
|
|
@@ -94,7 +95,7 @@ def filter_plot_config(plot_config: list[PlotTableRow], all_goal_generator_goals
|
|
|
94
95
|
return new_plot_config
|
|
95
96
|
|
|
96
97
|
|
|
97
|
-
class PlottingBaseMixin:
|
|
98
|
+
class PlottingBaseMixin(ReadGoalsMixin):
|
|
98
99
|
"""Base class for creating plots.
|
|
99
100
|
|
|
100
101
|
Reads the plot table, if available the goal table, and contains functions to store all required data for plots."""
|
|
@@ -116,7 +117,13 @@ class PlottingBaseMixin:
|
|
|
116
117
|
self.plot_config = get_plot_config(plot_table_file, plot_config_list, read_from)
|
|
117
118
|
|
|
118
119
|
self.custom_variables = get_plot_variables(self.plot_config)
|
|
119
|
-
|
|
120
|
+
|
|
121
|
+
if not hasattr(self, "_all_goal_generator_goals") and self.optimization_problem:
|
|
122
|
+
goals_to_generate = kwargs.get("goals_to_generate", [])
|
|
123
|
+
read_from = kwargs.get("read_goals_from", "csv_table")
|
|
124
|
+
self.load_goals(read_from, goals_to_generate)
|
|
125
|
+
|
|
126
|
+
if self.optimization_problem:
|
|
120
127
|
all_goal_generator_goals = self._all_goal_generator_goals
|
|
121
128
|
self.state_variables = list({base_goal.state for base_goal in all_goal_generator_goals})
|
|
122
129
|
else:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/rtctools_interface/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/optimization/test_read_goals.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.7.0b2 → rtc-tools-interface-0.7.0b3}/tests/simulation/test_plot_mixin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|