sgio 0.3.0__py3-none-any.whl → 0.3.2__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.
sgio/model/failure.py CHANGED
@@ -55,7 +55,7 @@ class TsaiWuFailureCriterion:
55
55
 
56
56
  self.f12 = (- self.f11 - self.f22 + self.f33) / 2
57
57
  self.f13 = (- self.f11 + self.f22 - self.f33) / 2
58
- self.f23 = (- self.f11 - self.f22 + self.f33) / 2
58
+ self.f23 = ( self.f11 - self.f22 - self.f33) / 2
59
59
  self.f14 = 0
60
60
  self.f15 = 0
61
61
  self.f16 = 0
@@ -172,20 +172,18 @@ class TsaiWuFailureCriterion:
172
172
  # We take the positive root
173
173
  discriminant = b**2 - 4*a*c
174
174
 
175
- # Handle edge cases
176
- strength_ratio = np.zeros_like(a)
175
+ # Handle edge cases - initialize with infinity
176
+ strength_ratio = np.full_like(a, np.inf)
177
177
 
178
178
  # For valid discriminant (should always be >= 0 for physical problems)
179
- valid = discriminant >= 0
179
+ valid_discriminant = discriminant >= 0
180
180
 
181
181
  # Calculate strength ratio using the positive root
182
- strength_ratio[valid] = (-b[valid] + np.sqrt(discriminant[valid])) / (2*a[valid])
182
+ temp_sr = (-b[valid_discriminant] + np.sqrt(discriminant[valid_discriminant])) / (2*a[valid_discriminant])
183
183
 
184
- # Handle cases where a is very small (nearly zero quadratic term)
185
- # In this case, solve linear equation: b·SR - 1 = 0 => SR = 1/b
186
- small_a = np.abs(a) < 1e-10
187
- if np.any(small_a):
188
- strength_ratio[small_a] = 1.0 / b[small_a]
184
+ # Only keep positive strength ratios, set others to infinity
185
+ valid_sr = temp_sr > 0
186
+ strength_ratio[valid_discriminant] = np.where(valid_sr, temp_sr, np.inf)
189
187
 
190
188
  # Return scalar if input was 1D
191
189
  if strength_ratio.shape[0] == 1: