IBB-Helper 0.4.8.dev26__tar.gz → 0.4.8.dev27__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 (24) hide show
  1. {ibb_helper-0.4.8.dev26/src/IBB_Helper.egg-info → ibb_helper-0.4.8.dev27}/PKG-INFO +1 -1
  2. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/pyproject.toml +1 -1
  3. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/animate.py +14 -22
  4. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27/src/IBB_Helper.egg-info}/PKG-INFO +1 -1
  5. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/LICENSE +0 -0
  6. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/README.md +0 -0
  7. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/setup.cfg +0 -0
  8. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/setup.py +0 -0
  9. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/__init__.py +0 -0
  10. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/combine_plots.py +0 -0
  11. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/display.py +0 -0
  12. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/display_eigen.py +0 -0
  13. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/display_matrix.py +0 -0
  14. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/extend_plot.py +0 -0
  15. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/minimize.py +0 -0
  16. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/num_int.py +0 -0
  17. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/plot_2d.py +0 -0
  18. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/plot_3d.py +0 -0
  19. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/plot_param_grid.py +0 -0
  20. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper/symbolic_BSpline.py +0 -0
  21. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper.egg-info/SOURCES.txt +0 -0
  22. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper.egg-info/dependency_links.txt +0 -0
  23. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper.egg-info/requires.txt +0 -0
  24. {ibb_helper-0.4.8.dev26 → ibb_helper-0.4.8.dev27}/src/IBB_Helper.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IBB_Helper
3
- Version: 0.4.8.dev26
3
+ Version: 0.4.8.dev27
4
4
  Summary: Helper functions for symbolic math, matrix visualization, and plotting
5
5
  Author-email: "University of Stuttgart, Institute for Structural Mechanics (IBB)" <mvs@ibb.uni-stuttgart.de>
6
6
  License-Expression: BSD-3-Clause
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "IBB_Helper"
7
- version = "0.4.8.dev26"
7
+ version = "0.4.8.dev27"
8
8
  description = "Helper functions for symbolic math, matrix visualization, and plotting"
9
9
  readme = "README.md"
10
10
  license = "BSD-3-Clause"
@@ -3,10 +3,10 @@ import sympy as sp
3
3
  import matplotlib.pyplot as plt
4
4
  import matplotlib.animation
5
5
  from sympy import latex, Matrix
6
- from IPython.display import display
6
+ from IPython.display import display, HTML
7
7
 
8
8
  def animate(exprs, var, **kwargs):
9
-
9
+
10
10
  """
11
11
  Animates 2D curves from symbolic expressions or numeric datasets using Matplotlib.
12
12
 
@@ -34,6 +34,11 @@ def animate(exprs, var, **kwargs):
34
34
  The animation object
35
35
  """
36
36
 
37
+ # Jupyter Configuration
38
+ plt.rcParams["animation.html"] = "jshtml"
39
+ plt.rcParams['figure.dpi'] = 100
40
+ plt.ioff()
41
+
37
42
  # Unpack Options
38
43
  title = kwargs.get('title', "Animation")
39
44
  xlabel = kwargs.get('xlabel', "x")
@@ -46,7 +51,7 @@ def animate(exprs, var, **kwargs):
46
51
  labels = kwargs.get('labels', [])
47
52
  colors = kwargs.get('colors', ['black', 'blue', 'red', 'green'])
48
53
  line_styles = kwargs.get('line_styles', ['solid'] * 10)
49
- linewidth = kwargs.get('linewidth', 2) # Can be int or list
54
+ linewidth = kwargs.get('linewidth', 2)
50
55
 
51
56
  # Animation Settings
52
57
  animation_time = kwargs.get('animation_time', 5000)
@@ -61,7 +66,7 @@ def animate(exprs, var, **kwargs):
61
66
  elif len(r_tuple) == 2: return r_tuple[0], float(r_tuple[1][0]), float(r_tuple[1][1])
62
67
  raise ValueError(f"Invalid range format: {r_tuple}")
63
68
 
64
- # Parse Main Animation Variable (Time)
69
+ # Parse Main Animation Variable
65
70
  t_sym, t_start, t_end = _unpack_range(var)
66
71
  t_vals = np.linspace(t_start, t_end, frames)
67
72
 
@@ -74,11 +79,10 @@ def animate(exprs, var, **kwargs):
74
79
 
75
80
  # Check for Deformation Mode: (x, y, (z, 0, h))
76
81
  if isinstance(expr, (tuple, list)) and len(expr) == 3 and isinstance(expr[2], (tuple, list)):
77
-
78
82
  x_e, y_e, spatial_info = expr
79
83
  z_sym, z_min, z_max = _unpack_range(spatial_info)
80
84
 
81
- # Create Spatial Mesh (Resolution of the beam/object)
85
+ # Create Spatial Mesh
82
86
  z_vals = np.linspace(z_min, z_max, 200)
83
87
 
84
88
  # Lambdify f(z, t)
@@ -88,13 +92,10 @@ def animate(exprs, var, **kwargs):
88
92
  frame_x_list = []
89
93
  frame_y_list = []
90
94
 
91
- # Generate data for every frame
92
95
  for t in t_vals:
93
- # Calculate X and Y for this time instant
94
96
  x_res = fx(z_vals, t)
95
97
  y_res = fy(z_vals, t)
96
98
 
97
- # Broadcast scalars if necessary (e.g. if x=0)
98
99
  if not hasattr(x_res, '__len__'): x_res = np.full_like(z_vals, x_res)
99
100
  if not hasattr(y_res, '__len__'): y_res = np.full_like(z_vals, y_res)
100
101
 
@@ -107,7 +108,7 @@ def animate(exprs, var, **kwargs):
107
108
  'y': frame_y_list
108
109
  })
109
110
 
110
- # Standard Trace Mode: (x, y) or single expr
111
+ # Standard Trace Mode
111
112
  else:
112
113
  if isinstance(expr, (tuple, list)) and len(expr) == 2:
113
114
  x_e, y_e = expr
@@ -120,7 +121,6 @@ def animate(exprs, var, **kwargs):
120
121
  full_x = fx(t_vals)
121
122
  full_y = fy(t_vals)
122
123
 
123
- # Broadcast scalars
124
124
  if not hasattr(full_x, '__len__'): full_x = np.full_like(t_vals, full_x)
125
125
  if not hasattr(full_y, '__len__'): full_y = np.full_like(t_vals, full_y)
126
126
 
@@ -130,9 +130,8 @@ def animate(exprs, var, **kwargs):
130
130
  'y': full_y
131
131
  })
132
132
 
133
- # Auto-Scaling (Limits)
133
+ # Auto-Scaling
134
134
  if xlim is None or ylim is None:
135
- # Collect all points from all frames to find global min/max
136
135
  flat_x, flat_y = [], []
137
136
  for c in all_curves_data:
138
137
  if c['type'] == 'deformation':
@@ -156,8 +155,7 @@ def animate(exprs, var, **kwargs):
156
155
  ylim = (ymin - pad, ymax + pad)
157
156
 
158
157
  # Plotting Setup
159
- dpi = 100
160
- fig, ax = plt.subplots(figsize=(width/dpi, height/dpi))
158
+ fig, ax = plt.subplots(figsize=(width/100, height/100))
161
159
 
162
160
  if scaling == 'constrained' or (isinstance(scaling, list) and 'constrained' in scaling):
163
161
  ax.set_aspect('equal')
@@ -166,7 +164,6 @@ def animate(exprs, var, **kwargs):
166
164
  ax.set_ylim(ylim)
167
165
  ax.grid(True, alpha=0.3)
168
166
 
169
- # Label formatting
170
167
  def fmt_latex(l):
171
168
  return f"${latex(l)}$" if hasattr(l, 'free_symbols') or (isinstance(l, str) and '\\' in l) else str(l)
172
169
 
@@ -177,12 +174,10 @@ def animate(exprs, var, **kwargs):
177
174
  # Initialize Lines
178
175
  lines = []
179
176
  for i in range(len(all_curves_data)):
180
- # Get styles cyclically
181
177
  col = colors[i % len(colors)]
182
178
  sty = line_styles[i % len(line_styles)]
183
179
  lbl = labels[i] if i < len(labels) else None
184
180
 
185
- # Handle linewidth list or int
186
181
  if isinstance(linewidth, list): lw = linewidth[i % len(linewidth)]
187
182
  else: lw = linewidth
188
183
 
@@ -198,11 +193,8 @@ def animate(exprs, var, **kwargs):
198
193
 
199
194
  for i, data in enumerate(all_curves_data):
200
195
  if data['type'] == 'deformation':
201
- # Update entire curve shape
202
196
  lines[i].set_data(data['x'][frame_idx], data['y'][frame_idx])
203
197
  else:
204
- # Trace from start up to current frame
205
- # We use [:frame_idx+1] to simulate drawing
206
198
  lines[i].set_data(data['x'][:frame_idx+1], data['y'][:frame_idx+1])
207
199
 
208
200
  ani = matplotlib.animation.FuncAnimation(
@@ -210,7 +202,7 @@ def animate(exprs, var, **kwargs):
210
202
  )
211
203
 
212
204
  if show:
213
- display(ani)
205
+ display(HTML(ani.to_jshtml()))
214
206
  plt.close()
215
207
 
216
208
  return ani
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IBB_Helper
3
- Version: 0.4.8.dev26
3
+ Version: 0.4.8.dev27
4
4
  Summary: Helper functions for symbolic math, matrix visualization, and plotting
5
5
  Author-email: "University of Stuttgart, Institute for Structural Mechanics (IBB)" <mvs@ibb.uni-stuttgart.de>
6
6
  License-Expression: BSD-3-Clause