epyt-flow 0.4.0__py3-none-any.whl → 0.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.
epyt_flow/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
@@ -1163,6 +1163,9 @@ class ScadaData(Serializable):
1163
1163
  :func:`~epyt_flow.simulation.scada.scada_data.ScadaData.get_data` --
1164
1164
  calling this function is the only way of accessing the energy usage of each pump.
1165
1165
 
1166
+ The odering in the returned NumPy array corresponds to the ordering
1167
+ of the pumps in EPANET.
1168
+
1166
1169
  Returns
1167
1170
  -------
1168
1171
  `numpy.ndarray`
@@ -1180,6 +1183,9 @@ class ScadaData(Serializable):
1180
1183
  :func:`~epyt_flow.simulation.scada.scada_data.ScadaData.get_data` --
1181
1184
  calling this function is the only way of accessing the pumps' efficiency.
1182
1185
 
1186
+ The odering in the returned NumPy array corresponds to the ordering
1187
+ of the pumps in EPANET.
1188
+
1183
1189
  Returns
1184
1190
  -------
1185
1191
  `numpy.ndarray`
@@ -12,7 +12,7 @@ class ScenarioVisualizer():
12
12
 
13
13
  Parameters
14
14
  ----------
15
- scenario : :class:`epyt_flow.simulation.scenario_simulator.ScenarioSimulator`
15
+ scenario : :class:`~epyt_flow.simulation.scenario_simulator.ScenarioSimulator`
16
16
  Scenario to be visualized.
17
17
  """
18
18
  def __init__(self, scenario: ScenarioSimulator):
@@ -1647,6 +1647,42 @@ class SensorConfig(JsonSerializable):
1647
1647
  """
1648
1648
  return deepcopy(self.__sensors_id_to_idx)
1649
1649
 
1650
+ def get_as_dict(self) -> dict:
1651
+ """
1652
+ Gets the sensor configuration as a dictionary.
1653
+
1654
+ Returns
1655
+ -------
1656
+ `dict`
1657
+ Dictionary of set sensors -- the keys are the sensor types.
1658
+ """
1659
+ r = {}
1660
+
1661
+ if self.__pressure_sensors != []:
1662
+ r["pressure"] = self.__pressure_sensors
1663
+ if self.__flow_sensors != []:
1664
+ r["flow"] = self.__flow_sensors
1665
+ if self.__demand_sensors != []:
1666
+ r["demand"] = self.__demand_sensors
1667
+ if self.__tank_volume_sensors != []:
1668
+ r["tank_volume"] = self.__tank_volume_sensors
1669
+ if self.__valve_state_sensors != []:
1670
+ r["valve_state"] = self.__valve_state_sensors
1671
+ if self.__pump_state_sensors != []:
1672
+ r["pump_state"] = self.__pump_state_sensors
1673
+ if self.__quality_node_sensors != []:
1674
+ r["node_quality"] = self.__quality_node_sensors
1675
+ if self.__quality_link_sensors != []:
1676
+ r["link_quality"] = self.__quality_link_sensors
1677
+ if self.__bulk_species_node_sensors != {}:
1678
+ r["node_bulk_species"] = self.__bulk_species_node_sensors
1679
+ if self.__bulk_species_link_sensors != {}:
1680
+ r["link_bulk_species"] = self.__bulk_species_link_sensors
1681
+ if self.__surface_species_sensors != {}:
1682
+ r["surface_species"] = self.__surface_species_sensors
1683
+
1684
+ return r
1685
+
1650
1686
  def get_attributes(self) -> dict:
1651
1687
  attr = {"nodes": self.__nodes, "links": self.__links,
1652
1688
  "valves": self.__valves, "pumps": self.__pumps,
@@ -1719,7 +1755,7 @@ class SensorConfig(JsonSerializable):
1719
1755
  f"pump_id_to_idx: {self.__pump_id_to_idx} tank_id_to_idx: {self.__tank_id_to_idx} " +\
1720
1756
  f"valve_id_to_idx: {self.__valve_id_to_idx} " +\
1721
1757
  f"bulkspecies_id_to_idx: {self.__bulkspecies_id_to_idx} " +\
1722
- f"surfacespecies_id_to_idx: {self.__surfacespecies_id_to_idx}" +\
1758
+ f"surfacespecies_id_to_idx: {self.__surfacespecies_id_to_idx} " +\
1723
1759
  f"pressure_sensors: {self.__pressure_sensors} flow_sensors: {self.__flow_sensors} " +\
1724
1760
  f"demand_sensors: {self.__demand_sensors} " +\
1725
1761
  f"quality_node_sensors: {self.__quality_node_sensors} " +\
epyt_flow/topology.py CHANGED
@@ -108,7 +108,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
108
108
 
109
109
  def convert_units(self, units: int) -> Any:
110
110
  """
111
- Converts this instance to a :class:`epyt_flow.topology.NetworkTopology` instance
111
+ Converts this instance to a :class:`~epyt_flow.topology.NetworkTopology` instance
112
112
  where everything is measured in given measurement units category
113
113
  (US Customary or SI Metric).
114
114
 
@@ -124,7 +124,7 @@ class NetworkTopology(nx.Graph, JsonSerializable):
124
124
 
125
125
  Returns
126
126
  -------
127
- :class:`epyt_flow.topology.NetworkTopology`
127
+ :class:`~epyt_flow.topology.NetworkTopology`
128
128
  Network topology with the new measurements units.
129
129
  """
130
130
  if self.__units is None:
@@ -199,6 +199,76 @@ class NetworkTopology(nx.Graph, JsonSerializable):
199
199
  """
200
200
  return [(link_id, end_points) for link_id, end_points, _ in self.__links]
201
201
 
202
+ def get_all_junctions(self) -> list[str]:
203
+ """
204
+ Gets all junctions -- i.e. nodes that are not tanks or reservoirs.
205
+
206
+ Returns
207
+ -------
208
+ `list[str]`
209
+ List of all junctions.
210
+ """
211
+ r = []
212
+
213
+ for node_id in self.get_all_nodes():
214
+ if self.get_node_info(node_id)["type"] == "JUNCTION":
215
+ r.append(node_id)
216
+
217
+ return r
218
+
219
+ def get_all_tanks(self) -> list[str]:
220
+ """
221
+ Gets all tanks -- i.e. nodes that are not junctions or reservoirs.
222
+
223
+ Returns
224
+ -------
225
+ `list[str]`
226
+ List of all tanks.
227
+ """
228
+ r = []
229
+
230
+ for node_id in self.get_all_nodes():
231
+ if self.get_node_info(node_id)["type"] == "TANK":
232
+ r.append(node_id)
233
+
234
+ return r
235
+
236
+ def get_all_reservoirs(self) -> list[str]:
237
+ """
238
+ Gets all reservoirs -- i.e. nodes that are not junctions or tanks.
239
+
240
+ Returns
241
+ -------
242
+ `list[str]`
243
+ List of all reservoirs.
244
+ """
245
+ r = []
246
+
247
+ for node_id in self.get_all_nodes():
248
+ if self.get_node_info(node_id)["type"] == "RESERVOIR":
249
+ r.append(node_id)
250
+
251
+ return r
252
+
253
+ def get_all_pipes(self) -> list[tuple[str, tuple[str, str]]]:
254
+ """
255
+ Gets all pipes -- i.e. links that not valves or pumps.
256
+
257
+ Returns
258
+ -------
259
+ `list[tuple[str, tuple[str, str]]]`
260
+ List of all pipes -- (link ID, (left node ID, right node ID)).
261
+ """
262
+ r = []
263
+
264
+ for link_id, link_nodes in self.get_all_links():
265
+ link_info = self.get_link_info(link_id)
266
+
267
+ if link_info["type"] == "PIPE":
268
+ r.append((link_id, link_nodes))
269
+
270
+ return r
271
+
202
272
  def get_all_pumps(self) -> list[str]:
203
273
  """
204
274
  Gets the IDs of all pumps.
epyt_flow/utils.py CHANGED
@@ -153,8 +153,10 @@ def plot_timeseries_data(data: np.ndarray, labels: list[str] = None, x_axis_labe
153
153
 
154
154
 
155
155
  def plot_timeseries_prediction(y: np.ndarray, y_pred: np.ndarray,
156
- confidence_interval: np.ndarray = None, show: bool = True,
157
- ax: matplotlib.axes.Axes = None) -> matplotlib.axes.Axes:
156
+ confidence_interval: np.ndarray = None,
157
+ x_axis_label: str = None, y_axis_label: str = None,
158
+ show: bool = True, ax: matplotlib.axes.Axes = None
159
+ ) -> matplotlib.axes.Axes:
158
160
  """
159
161
  Plots the prediction (e.g. forecast) of *single* time series together with the
160
162
  ground truth time series. In addition, confidence intervals can be plotted as well.
@@ -169,6 +171,14 @@ def plot_timeseries_prediction(y: np.ndarray, y_pred: np.ndarray,
169
171
  Confidence interval (upper and lower value) for each prediction in `y_pred`.
170
172
  If not None, the confidence interval is plotted as well.
171
173
 
174
+ The default is None.
175
+ x_axis_label : `str`, optional
176
+ X axis label.
177
+
178
+ The default is None.
179
+ y_axis_label : `str`, optional
180
+ Y axis label.
181
+
172
182
  The default is None.
173
183
  show : `bool`, optional
174
184
  If True, the plot/figure is shown in a window.
@@ -198,6 +208,14 @@ def plot_timeseries_prediction(y: np.ndarray, y_pred: np.ndarray,
198
208
  raise ValueError("'y_pred' must be a 1d array")
199
209
  if len(y.shape) != 1:
200
210
  raise ValueError("'y' must be a 1d array")
211
+ if x_axis_label is not None:
212
+ if not isinstance(x_axis_label, str):
213
+ raise TypeError("'x_axis_label' must be an instance of 'str' " +
214
+ f"but not of '{type(x_axis_label)}'")
215
+ if y_axis_label is not None:
216
+ if not isinstance(y_axis_label, str):
217
+ raise TypeError("'y_axis_label' must be an instance of 'str' " +
218
+ f"but not of '{type(y_axis_label)}'")
201
219
  if not isinstance(show, bool):
202
220
  raise TypeError(f"'show' must be an instance of 'bool' but not of '{type(show)}'")
203
221
  if ax is not None:
@@ -218,6 +236,11 @@ def plot_timeseries_prediction(y: np.ndarray, y_pred: np.ndarray,
218
236
  ax.plot(y_pred, ".-", label="Prediction")
219
237
  ax.legend()
220
238
 
239
+ if x_axis_label is not None:
240
+ ax.set_xlabel(x_axis_label)
241
+ if y_axis_label is not None:
242
+ ax.set_ylabel(y_axis_label)
243
+
221
244
  if show is True and fig is not None:
222
245
  plt.show()
223
246
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: epyt-flow
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: EPyT-Flow -- EPANET Python Toolkit - Flow
5
5
  Author-email: André Artelt <aartelt@techfak.uni-bielefeld.de>, "Marios S. Kyriakou" <kiriakou.marios@ucy.ac.cy>, "Stelios G. Vrachimis" <vrachimis.stelios@ucy.ac.cy>
6
6
  License: MIT License
@@ -1,9 +1,9 @@
1
- epyt_flow/VERSION,sha256=QLjrQACpE6d5EJBTXykdPTaYdBYqie88nj1OiHobnnk,6
1
+ epyt_flow/VERSION,sha256=oK1QZAE5pST4ZZEVcUW_HUZ06pwGW_6iFVjw97BEMMg,6
2
2
  epyt_flow/__init__.py,sha256=KNDiPWiHdB9a5ZF1ipjA1uoq61TwU2ThjaStpvSLBtY,1742
3
3
  epyt_flow/metrics.py,sha256=kvt42pzZrUR9PSlCyK4uq5kj6UlYHkt7OcCjLnI1RQE,12883
4
4
  epyt_flow/serialization.py,sha256=nBcwc3aMUbHF0zW8Nvpc49kKeLPh75blc3gzjKDR1ok,12893
5
- epyt_flow/topology.py,sha256=GLB2fIgCds9FiMbqoIJUhUTUw3aInt0iCCGPLX3DArQ,21650
6
- epyt_flow/utils.py,sha256=sWYGwPTQpDainI8s9N3AJ1zyJ1W2i-2lpTM_BbWNyvo,11507
5
+ epyt_flow/topology.py,sha256=yKIspoX4uoo9rAeVR5eWJ6D91QNozHzvzjiry9bFkNI,23424
6
+ epyt_flow/utils.py,sha256=AB2MuknQ_16UE-URQe1WShIS7dmSyFwZYVHxMVT539k,12379
7
7
  epyt_flow/EPANET/compile_linux.sh,sha256=wcrDyiB8NkivmaC-X9FI2WxhY3IJqDLiyIbVTv2XEPY,489
8
8
  epyt_flow/EPANET/compile_macos.sh,sha256=1K33-bPdgr01EIf87YUvmOFHXyOkBWI6mKXQ8x1Hzmo,504
9
9
  epyt_flow/EPANET/EPANET/SRC_engines/AUTHORS,sha256=yie5yAsEEPY0984PmkSRUdqEU9rVvRSGGWmjxdwCYMU,925
@@ -113,8 +113,8 @@ epyt_flow/simulation/__init__.py,sha256=VGGJqJRUoXZjKJ0-m6KPp3JQqD_1TFW0pofLgkwZ
113
113
  epyt_flow/simulation/parallel_simulation.py,sha256=VmC7xemjxRB_N0fx1AAQ7ux82tnyTi7jk7jfFpeg7gM,6523
114
114
  epyt_flow/simulation/scenario_config.py,sha256=_Zs0EPyfet0mTLpAt-oMN3k7jCW3x7_VbOQHpHVntrA,26597
115
115
  epyt_flow/simulation/scenario_simulator.py,sha256=1amMxO-PVHBU_AN6K9Ga6xzFmpaX2ZZnhwkirtj6IgY,93036
116
- epyt_flow/simulation/scenario_visualizer.py,sha256=2gr1o731VLlhA8wQKgrLT94M43FsBNKjG_eucZPHy9A,2186
117
- epyt_flow/simulation/sensor_config.py,sha256=9pUzvRm4HSF8zZ-Hu4pdpxzTjpNSdNmDvcPhRaRFNAI,80175
116
+ epyt_flow/simulation/scenario_visualizer.py,sha256=fpj67zl69q-byg7Oxocqhmu1S3P7B3ROCkSYzWyM--0,2187
117
+ epyt_flow/simulation/sensor_config.py,sha256=MGeerEnLhyFLE6XA2p-X9Swd4k0o0T7QboeGuTUFq7I,81584
118
118
  epyt_flow/simulation/events/__init__.py,sha256=tIdqzs7_Cus4X2kbZG4Jl2zs-zsk_4rnajFOCvL0zlI,185
119
119
  epyt_flow/simulation/events/actuator_events.py,sha256=2_MPYbYO9As6fMkm5Oy9pjSB9kCvFuKpGu8ykYDAydg,7903
120
120
  epyt_flow/simulation/events/event.py,sha256=kARPV20XCAl6zxnJwI9U7ICtZUPACO_rgAmtHm1mGCs,2603
@@ -125,15 +125,15 @@ epyt_flow/simulation/events/sensor_reading_event.py,sha256=rQ-CmdpSUyZzDFYwNUGH2
125
125
  epyt_flow/simulation/events/system_event.py,sha256=0KI2iaAaOyC9Y-FIfFVazeKT_4ORQRp26gWyMBUu_3c,2396
126
126
  epyt_flow/simulation/scada/__init__.py,sha256=ZFAxJVqwEVsgiyFilFetnb13gPhZg1JEOPWYvKIJT4c,90
127
127
  epyt_flow/simulation/scada/advanced_control.py,sha256=Enox02ggt36HdFLX7ZNxgxuqsTEeu9AACHrzU8CXGrg,4489
128
- epyt_flow/simulation/scada/scada_data.py,sha256=NfGDGrQ7HIXTcShUaGeCALTvGmM5LAJW0Bgmk0H4UQg,104867
128
+ epyt_flow/simulation/scada/scada_data.py,sha256=WaFSppBHvJOwSyLYNs9Pu2GngSzWsfkpqPfBQoeiEcU,105101
129
129
  epyt_flow/simulation/scada/scada_data_export.py,sha256=0BwDgV-5qZx17wIyWQ8Nl2TPgho3mBI49027RDq8sDA,11217
130
130
  epyt_flow/uncertainty/__init__.py,sha256=ZRjuJL9rDpWVSdPwObPxFpEmMTcgAl3VmPOsS6cIyGg,89
131
131
  epyt_flow/uncertainty/model_uncertainty.py,sha256=-2QT2AffZerKZyZ_w_mmeqYpfBALyPDvV61sCrvcK1o,13966
132
132
  epyt_flow/uncertainty/sensor_noise.py,sha256=zJVULxnxVPSSqc6UW0iwZ9O-HGf9dn4CwScPqf4yCY0,2324
133
133
  epyt_flow/uncertainty/uncertainties.py,sha256=X-o7GZUC0HELtzpoXIAJaAeYOw35N05TuRoSmStcCpI,17669
134
134
  epyt_flow/uncertainty/utils.py,sha256=gq66c9-QMOxOqI6wgWLyFxjVV0fbG0_8Yzd6mQjNYNo,5315
135
- epyt_flow-0.4.0.dist-info/LICENSE,sha256=-4hYIY2BLmCkdOv2_PehEwlnMKTCes8_oyIUXjKtkug,1076
136
- epyt_flow-0.4.0.dist-info/METADATA,sha256=QVUFiy7LV7VYckKinh3wvbaErIHhTA5oBs-vZhWRCF8,7087
137
- epyt_flow-0.4.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
138
- epyt_flow-0.4.0.dist-info/top_level.txt,sha256=Wh_kd7TRL8ownCw3Y3dxx-9C0iTSk6wNauv_NX9JcrY,10
139
- epyt_flow-0.4.0.dist-info/RECORD,,
135
+ epyt_flow-0.5.0.dist-info/LICENSE,sha256=-4hYIY2BLmCkdOv2_PehEwlnMKTCes8_oyIUXjKtkug,1076
136
+ epyt_flow-0.5.0.dist-info/METADATA,sha256=a7kEbUctgxuMBJ06GNrwJnAlr_arMtcxHg-TZzSiD8M,7087
137
+ epyt_flow-0.5.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
138
+ epyt_flow-0.5.0.dist-info/top_level.txt,sha256=Wh_kd7TRL8ownCw3Y3dxx-9C0iTSk6wNauv_NX9JcrY,10
139
+ epyt_flow-0.5.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.1.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5