rtc-tools-interface 0.7.3__tar.gz → 0.7.5__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 (48) hide show
  1. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/PKG-INFO +1 -1
  2. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/README.md +1 -1
  3. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtc_tools_interface.egg-info/PKG-INFO +1 -1
  4. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/_version.py +3 -3
  5. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/plotting/plot_tools.py +1 -1
  6. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/simulation/plot_mixin.py +23 -0
  7. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/utils/results_collection.py +1 -1
  8. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/COPYING.LESSER +0 -0
  9. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtc_tools_interface.egg-info/SOURCES.txt +0 -0
  10. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtc_tools_interface.egg-info/dependency_links.txt +0 -0
  11. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtc_tools_interface.egg-info/requires.txt +0 -0
  12. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtc_tools_interface.egg-info/top_level.txt +0 -0
  13. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/__init__.py +0 -0
  14. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/__init__.py +0 -0
  15. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/base_goal.py +0 -0
  16. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/base_optimization_problem.py +0 -0
  17. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/goal_generator_mixin.py +0 -0
  18. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/goal_performance_metrics.py +0 -0
  19. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/goal_table_schema.py +0 -0
  20. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/helpers/__init__.py +0 -0
  21. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/helpers/statistics_mixin.py +0 -0
  22. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/plot_goals_mixin.py +0 -0
  23. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/plot_mixin.py +0 -0
  24. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/optimization/read_goals.py +0 -0
  25. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/plotting/__init__.py +0 -0
  26. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/plotting/subplot_classes.py +0 -0
  27. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/simulation/__init__.py +0 -0
  28. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/simulation/base_simulation_problem.py +0 -0
  29. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/utils/__init__.py +0 -0
  30. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/utils/plot_table_schema.py +0 -0
  31. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/utils/read_goals_mixin.py +0 -0
  32. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/utils/read_plot_table.py +0 -0
  33. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/utils/serialization.py +0 -0
  34. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/rtctools_interface/utils/type_definitions.py +0 -0
  35. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/setup.cfg +0 -0
  36. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/setup.py +0 -0
  37. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/__init__.py +0 -0
  38. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/optimization/__init__.py +0 -0
  39. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/optimization/test_base_optimization_problem.py +0 -0
  40. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/optimization/test_passing_goals_directly.py +0 -0
  41. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/optimization/test_plot_goals_mixin.py +0 -0
  42. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/optimization/test_read_goals.py +0 -0
  43. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/simulation/__init__.py +0 -0
  44. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/simulation/test_base_simulation_problem.py +0 -0
  45. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/simulation/test_plot_mixin.py +0 -0
  46. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/utils/__init__.py +0 -0
  47. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/tests/utils/get_test.py +0 -0
  48. {rtc-tools-interface-0.7.3 → rtc-tools-interface-0.7.5}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rtc-tools-interface
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: Toolbox for user interfaces for RTC-Tools
5
5
  Home-page: UNKNOWN
6
6
  Author: Deltares
@@ -163,4 +163,4 @@ The table could thus look like:
163
163
  | | Volume (\$m^3\$) | | | electricity_cost | "Goal for minimizing electricity cost, at priority 10" | python
164
164
 
165
165
 
166
- After running the model, in your output folder the folder `goal_figures` containing the figures is created.
166
+ After running the model, in your output folder the folder `figures` containing the figures is created.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rtc-tools-interface
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: Toolbox for user interfaces for RTC-Tools
5
5
  Home-page: UNKNOWN
6
6
  Author: Deltares
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-03-05T11:26:05+0100",
11
+ "date": "2024-05-07T16:13:24+0200",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "444bbd64198172e319ec16b7ee923ad775b0499d",
15
- "version": "0.7.3"
14
+ "full-revisionid": "af2a5c1b89eab1ec3446493bf214a9a157408bdb",
15
+ "version": "0.7.5"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -40,7 +40,7 @@ def get_subplot_axis(i_plot, n_rows, n_cols, axs):
40
40
 
41
41
  def get_file_write_path(output_folder: Union[str, Path], file_name="figure"):
42
42
  """Get path to to file."""
43
- new_output_folder = Path(output_folder) / "goal_figures"
43
+ new_output_folder = Path(output_folder) / "figures"
44
44
  os.makedirs(new_output_folder, exist_ok=True)
45
45
  return os.path.join(new_output_folder, file_name)
46
46
 
@@ -1,6 +1,9 @@
1
1
  """Mixin to store all required data for plotting. Can also call the plot function."""
2
2
 
3
3
  import logging
4
+ from typing import Dict, List
5
+
6
+ import numpy as np
4
7
 
5
8
  from rtctools_interface.plotting.plot_tools import create_plot_final_results
6
9
  from rtctools_interface.utils.results_collection import PlottingBaseMixin
@@ -14,6 +17,23 @@ class PlotMixin(PlottingBaseMixin):
14
17
  """
15
18
 
16
19
  optimization_problem = False
20
+ _manual_extracted_states: Dict[str, list] = {}
21
+
22
+ def manual_extraction_from_state_vector(self):
23
+ for variable in self.custom_variables:
24
+ try:
25
+ self._manual_extracted_states[variable].append(self.get_var(variable))
26
+ except KeyError:
27
+ logger.debug("Variable {} not found in output of model.".format(variable))
28
+
29
+ def initialize(self):
30
+ super().initialize()
31
+ self._manual_extracted_states = {variable: [] for variable in self.custom_variables}
32
+ self.manual_extraction_from_state_vector()
33
+
34
+ def update(self, dt):
35
+ super().update(dt)
36
+ self.manual_extraction_from_state_vector()
17
37
 
18
38
  def post(self):
19
39
  """Tasks after optimizing."""
@@ -26,3 +46,6 @@ class PlotMixin(PlottingBaseMixin):
26
46
 
27
47
  if self.plot_final_results:
28
48
  create_plot_final_results(current_run, self._previous_run, plotting_library=self.plotting_library)
49
+
50
+ def collect_timeseries_data(self, all_variables_to_store: List[str]) -> Dict[str, np.ndarray]:
51
+ return {variable: np.array(self._manual_extracted_states[variable]) for variable in all_variables_to_store}
@@ -152,7 +152,7 @@ class PlottingBaseMixin(ReadGoalsMixin):
152
152
  timeseries_data[timeseries_name] = extracted_results[timeseries_name]
153
153
  except KeyError:
154
154
  try:
155
- timeseries_data[timeseries_name] = self.get_timeseries(timeseries_name)
155
+ timeseries_data[timeseries_name] = self.io.get_timeseries(timeseries_name)[1]
156
156
  except KeyError as exc:
157
157
  raise KeyError("Cannot find timeseries for %s" % timeseries_name) from exc
158
158
  return timeseries_data