rtc-tools-interface 0.7.4__tar.gz → 0.7.6__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 (49) hide show
  1. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/PKG-INFO +1 -1
  2. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/README.md +1 -1
  3. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtc_tools_interface.egg-info/PKG-INFO +1 -1
  4. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/_version.py +3 -3
  5. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/plotting/plot_tools.py +1 -1
  6. rtc-tools-interface-0.7.6/rtctools_interface/simulation/plot_mixin.py +51 -0
  7. rtc-tools-interface-0.7.4/rtctools_interface/simulation/plot_mixin.py +0 -28
  8. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/COPYING.LESSER +0 -0
  9. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtc_tools_interface.egg-info/SOURCES.txt +0 -0
  10. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtc_tools_interface.egg-info/dependency_links.txt +0 -0
  11. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtc_tools_interface.egg-info/requires.txt +0 -0
  12. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtc_tools_interface.egg-info/top_level.txt +0 -0
  13. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/__init__.py +0 -0
  14. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/__init__.py +0 -0
  15. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/base_goal.py +0 -0
  16. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/base_optimization_problem.py +0 -0
  17. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/goal_generator_mixin.py +0 -0
  18. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/goal_performance_metrics.py +0 -0
  19. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/goal_table_schema.py +0 -0
  20. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/helpers/__init__.py +0 -0
  21. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/helpers/statistics_mixin.py +0 -0
  22. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/plot_goals_mixin.py +0 -0
  23. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/plot_mixin.py +0 -0
  24. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/optimization/read_goals.py +0 -0
  25. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/plotting/__init__.py +0 -0
  26. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/plotting/subplot_classes.py +0 -0
  27. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/simulation/__init__.py +0 -0
  28. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/simulation/base_simulation_problem.py +0 -0
  29. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/utils/__init__.py +0 -0
  30. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/utils/plot_table_schema.py +0 -0
  31. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/utils/read_goals_mixin.py +0 -0
  32. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/utils/read_plot_table.py +0 -0
  33. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/utils/results_collection.py +0 -0
  34. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/utils/serialization.py +0 -0
  35. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/rtctools_interface/utils/type_definitions.py +0 -0
  36. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/setup.cfg +0 -0
  37. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/setup.py +0 -0
  38. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/__init__.py +0 -0
  39. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/optimization/__init__.py +0 -0
  40. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/optimization/test_base_optimization_problem.py +0 -0
  41. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/optimization/test_passing_goals_directly.py +0 -0
  42. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/optimization/test_plot_goals_mixin.py +0 -0
  43. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/optimization/test_read_goals.py +0 -0
  44. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/simulation/__init__.py +0 -0
  45. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/simulation/test_base_simulation_problem.py +0 -0
  46. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/simulation/test_plot_mixin.py +0 -0
  47. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/utils/__init__.py +0 -0
  48. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/tests/utils/get_test.py +0 -0
  49. {rtc-tools-interface-0.7.4 → rtc-tools-interface-0.7.6}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rtc-tools-interface
3
- Version: 0.7.4
3
+ Version: 0.7.6
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.4
3
+ Version: 0.7.6
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-04-25T09:38:32+0200",
11
+ "date": "2024-05-07T17:02:33+0200",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "6a173e1225c206b2767e60622278e201b16cb21e",
15
- "version": "0.7.4"
14
+ "full-revisionid": "0a20a376b41a3ca0e27f8d19c46f6b6d91536766",
15
+ "version": "0.7.6"
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
 
@@ -0,0 +1,51 @@
1
+ """Mixin to store all required data for plotting. Can also call the plot function."""
2
+
3
+ import logging
4
+ from typing import Dict, List
5
+
6
+ import numpy as np
7
+
8
+ from rtctools_interface.plotting.plot_tools import create_plot_final_results
9
+ from rtctools_interface.utils.results_collection import PlottingBaseMixin
10
+
11
+ logger = logging.getLogger("rtctools")
12
+
13
+
14
+ class PlotMixin(PlottingBaseMixin):
15
+ """
16
+ Class for plotting results based on the plot_table.
17
+ """
18
+
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, *args, **kwargs):
30
+ super().initialize(*args, **kwargs)
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()
37
+
38
+ def post(self):
39
+ """Tasks after optimizing."""
40
+ super().post()
41
+
42
+ timeseries_data = self.collect_timeseries_data(self.custom_variables)
43
+ self._intermediate_results.append({"timeseries_data": timeseries_data, "priority": 0})
44
+ current_run = self.create_plot_data_and_config([])
45
+ self._store_current_results(self._cache_folder, current_run)
46
+
47
+ if self.plot_final_results:
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}
@@ -1,28 +0,0 @@
1
- """Mixin to store all required data for plotting. Can also call the plot function."""
2
-
3
- import logging
4
-
5
- from rtctools_interface.plotting.plot_tools import create_plot_final_results
6
- from rtctools_interface.utils.results_collection import PlottingBaseMixin
7
-
8
- logger = logging.getLogger("rtctools")
9
-
10
-
11
- class PlotMixin(PlottingBaseMixin):
12
- """
13
- Class for plotting results based on the plot_table.
14
- """
15
-
16
- optimization_problem = False
17
-
18
- def post(self):
19
- """Tasks after optimizing."""
20
- super().post()
21
-
22
- timeseries_data = self.collect_timeseries_data(self.custom_variables)
23
- self._intermediate_results.append({"timeseries_data": timeseries_data, "priority": 0})
24
- current_run = self.create_plot_data_and_config([])
25
- self._store_current_results(self._cache_folder, current_run)
26
-
27
- if self.plot_final_results:
28
- create_plot_final_results(current_run, self._previous_run, plotting_library=self.plotting_library)