steer-core 0.1.27__py3-none-any.whl → 0.1.28__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.
Binary file
steer_core/DataManager.py CHANGED
@@ -281,6 +281,26 @@ class DataManager:
281
281
 
282
282
  return data
283
283
 
284
+ def get_prismatic_container_materials(self, most_recent: bool = True) -> pd.DataFrame:
285
+ """
286
+ Retrieves prismatic container materials from the database.
287
+
288
+ :param most_recent: If True, returns only the most recent entry.
289
+ :return: DataFrame with prismatic container materials.
290
+ """
291
+ data = (
292
+ self.get_data(table_name="prismatic_container_materials")
293
+ .groupby("name", group_keys=False)
294
+ .apply(
295
+ lambda x: x.sort_values("date", ascending=False).head(1)
296
+ if most_recent
297
+ else x
298
+ )
299
+ .reset_index(drop=True)
300
+ )
301
+
302
+ return data
303
+
284
304
  @staticmethod
285
305
  def read_half_cell_curve(half_cell_path) -> pd.DataFrame:
286
306
  """
@@ -130,7 +130,10 @@ class CoordinateMixin:
130
130
 
131
131
  @staticmethod
132
132
  def rotate_coordinates(
133
- coords: np.ndarray, axis: str, angle: float, center: tuple = None
133
+ coords: np.ndarray,
134
+ axis: str,
135
+ angle: float,
136
+ center: tuple = None
134
137
  ) -> np.ndarray:
135
138
  """
136
139
  Rotate a (N, 3) NumPy array of 3D coordinates around the specified axis.
@@ -240,9 +243,52 @@ class CoordinateMixin:
240
243
  The width of the square.
241
244
  y_width : float
242
245
  The height of the square.
246
+
247
+ Returns
248
+ -------
249
+ Tuple[np.ndarray, np.ndarray]
250
+ Tuple containing x and y coordinate arrays defining the square/rectangle
243
251
  """
244
- x_coords = [x, x, x + x_width, x + x_width, x]
245
- y_coords = [y, y + y_width, y + y_width, y, y]
252
+ x_coords = np.array([x, x, x + x_width, x + x_width, x])
253
+ y_coords = np.array([y, y + y_width, y + y_width, y, y])
254
+ return x_coords, y_coords
255
+
256
+ @staticmethod
257
+ def build_circle_array(
258
+ center_x: float, center_y: float, radius: float, num_points: int = 64, anticlockwise: bool = True
259
+ ) -> Tuple[np.ndarray, np.ndarray]:
260
+ """
261
+ Build a NumPy array representing a circle defined by its center and radius.
262
+
263
+ Parameters
264
+ ----------
265
+ center_x : float
266
+ The x-coordinate of the circle center.
267
+ center_y : float
268
+ The y-coordinate of the circle center.
269
+ radius : float
270
+ The radius of the circle.
271
+ num_points : int, optional
272
+ Number of points to use for the circle approximation, by default 64
273
+ anticlockwise : bool, optional
274
+ If True, points are ordered anticlockwise; if False, clockwise, by default True
275
+
276
+ Returns
277
+ -------
278
+ Tuple[np.ndarray, np.ndarray]
279
+ Tuple containing x and y coordinate arrays defining the circle
280
+ """
281
+ # Generate angles from 0 to 2π
282
+ angles = np.linspace(0, 2 * np.pi, num_points + 1)
283
+
284
+ # Reverse angles for clockwise direction
285
+ if not anticlockwise:
286
+ angles = angles[::-1]
287
+
288
+ # Calculate x and y coordinates
289
+ x_coords = center_x + radius * np.cos(angles)
290
+ y_coords = center_y + radius * np.sin(angles)
291
+
246
292
  return x_coords, y_coords
247
293
 
248
294
  @staticmethod
steer_core/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.1.27"
1
+ __version__ = "0.1.28"
2
2
 
3
3
  # datamanager import
4
4
  from .DataManager import DataManager
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: steer-core
3
- Version: 0.1.27
3
+ Version: 0.1.28
4
4
  Summary: Modelling energy storage from cell to site - STEER OpenCell Design
5
5
  Author-email: Nicholas Siemons <nsiemons@stanford.edu>
6
6
  Maintainer-email: Nicholas Siemons <nsiemons@stanford.edu>
@@ -1,26 +1,25 @@
1
- steer_core/DataManager.py,sha256=whTLPF5lE0Rm6ukHMWPVjjxdb2qPks2-cxDWuSa5ZhM,11574
2
- steer_core/__init__.py,sha256=hFZ-uiuX3et_gBoo14cWIbeRdeneW5oWI9XISynDaQo,380
1
+ steer_core/DataManager.py,sha256=XlURPvXYS05jd6bj7M4QkNU9Dwp3s1X3xjy3AIxX6No,12256
2
+ steer_core/__init__.py,sha256=AqVXudQDMKuXKRWdo3BtgPCXgttV-H4Y1TsMnECPe08,380
3
3
  steer_core/Constants/Units.py,sha256=QIV_lDX7rANH-MKP90jOyiXbGueL15LILKMNr5dSWoI,714
4
4
  steer_core/Constants/Universal.py,sha256=5FWdrex5NiI2DResDmwO7GIvGN2B0DNtdlG1l-ysDh8,41
5
5
  steer_core/Constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  steer_core/ContextManagers/ContextManagers.py,sha256=4rSeBdBi6xtKLMAbERklrYmZlbFr0zceAiwu-gjTR38,1869
7
7
  steer_core/ContextManagers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  steer_core/Data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- steer_core/Data/database.db,sha256=-5Euye4KSTc4JNdALUgSyRxXRtE8kvHhdf4bsUrcGpI,115044352
9
+ steer_core/Data/database.db,sha256=TqJtLFeqifND5JaExUH48v_-765IsGx5EH5wUmuMpJw,115044352
10
10
  steer_core/Decorators/Coordinates.py,sha256=MxUWXQNrR9Q0_p4gGAywS4qnPAztajJzSay1Cu6lCRQ,1441
11
- steer_core/Decorators/Electrochemical.py,sha256=nrNnTG4weyQOq1VLybjWWcbgGoth8ndvy3muN51xpwU,986
12
11
  steer_core/Decorators/General.py,sha256=lc7YdvxU-JDo8b4kunVzSjxcB3_8C185458HrXQq-lk,970
13
12
  steer_core/Decorators/Objects.py,sha256=aYaRQBFgdSE0IB4QgBVfb6GhEPagoU6TRNrW_pOaqQI,506
14
13
  steer_core/Decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
14
  steer_core/Mixins/Colors.py,sha256=vbo44Fr0oeziwHJ-tu7ojG-GzqFc2LBcT_hH4szvPFc,6796
16
- steer_core/Mixins/Coordinates.py,sha256=xrToEZbOZgiSoat8YasRwXDN79gMaU_TYg1iKvlL-So,32175
15
+ steer_core/Mixins/Coordinates.py,sha256=_Rz_o9yVQnk5T2WlrmZW8borwgZ5jqdL8MwN3_2u_Z4,33744
17
16
  steer_core/Mixins/Data.py,sha256=c313F85muxlBHQ6yl6AKrifNyV2toHvVwEy35fNNUNE,4434
18
17
  steer_core/Mixins/Dunder.py,sha256=591oDGiRPdLH1bDIc1FUw33eeRtSc4pC7UbKEIGPm1I,7035
19
18
  steer_core/Mixins/Plotter.py,sha256=9fF8z3v0AV-5AbwEZIOxTOgpNHEQJHP0ssaTsTjnW28,9229
20
19
  steer_core/Mixins/Serializer.py,sha256=oPtyfqbamqtLq3G3x9SDpAG-aVlK7AOS1y-TOo3-0y8,1018
21
20
  steer_core/Mixins/TypeChecker.py,sha256=dzTu6q6xfz0Op3Yhu7vA-3-8D02iHZPBeAdX9ng9-WM,10454
22
21
  steer_core/Mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- steer_core-0.1.27.dist-info/METADATA,sha256=KkANlKWUlR4N_4tVjWVKIPnhtBuJd3e4br8mW0ETi-I,1601
24
- steer_core-0.1.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- steer_core-0.1.27.dist-info/top_level.txt,sha256=6LFpGCSDE_SqRoT7raeM3Ax7KTBKQnyXLXxM9kXtw5M,11
26
- steer_core-0.1.27.dist-info/RECORD,,
22
+ steer_core-0.1.28.dist-info/METADATA,sha256=OTyw-wycpiP8xMxworapBR0r6ZKWbEkUilB2iFD8nCs,1601
23
+ steer_core-0.1.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ steer_core-0.1.28.dist-info/top_level.txt,sha256=6LFpGCSDE_SqRoT7raeM3Ax7KTBKQnyXLXxM9kXtw5M,11
25
+ steer_core-0.1.28.dist-info/RECORD,,
@@ -1,29 +0,0 @@
1
- from functools import wraps
2
-
3
- def calculate_half_cell_curve(func):
4
- """
5
- Decorator to recalculate half-cell curve properties after a method call.
6
- This is useful for methods that modify the half-cell curve data.
7
- """
8
- @wraps(func)
9
- def wrapper(self, *args, **kwargs):
10
- result = func(self, *args, **kwargs)
11
- if hasattr(self, '_update_properties') and self._update_properties:
12
- self._calculate_half_cell_curve()
13
- return result
14
- return wrapper
15
-
16
-
17
- def calculate_half_cell_curves_properties(func):
18
- """
19
- Decorator to recalculate half-cell curves properties after a method call.
20
- This is useful for methods that modify the half-cell curves data.
21
- """
22
- @wraps(func)
23
- def wrapper(self, *args, **kwargs):
24
- result = func(self, *args, **kwargs)
25
- if hasattr(self, '_update_properties') and self._update_properties:
26
- self._calculate_half_cell_curves_properties()
27
- return result
28
- return wrapper
29
-