Skip to content

Commit cb694be

Browse files
committed
Added IMG_THRESHOLD instead of embedded variable
1 parent 114a86e commit cb694be

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pyomo/contrib/doe/doe.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1537,14 +1537,14 @@ def compute_metrics(FIM):
15371537
# Compute and record metrics on FIM
15381538
D_opt = np.log10(np.linalg.det(FIM))
15391539
A_opt = np.log10(np.trace(FIM))
1540-
E_vals =np.linalg.eigvalsh(FIM) # np.linalg.eigvalsh(FIM) # Grab eigenvalues
1540+
E_vals, E_vecs =np.linalg.eig(FIM) # Grab eigenvalues
15411541

1542-
E_ind = 0 # Grab index of minima to check imaginary
1543-
img_thereshold = 1e-8 # Threshold for imaginary component
1542+
E_ind = np.argmin(E_vals.real) # Grab index of minima to check imaginary
1543+
IMG_THERESHOLD = 1e-6 # Threshold for imaginary component
15441544
# Warn the user if there is a ``large`` imaginary component (should not be)
1545-
if abs(E_vals.imag[E_ind]) > img_thereshold:
1545+
if abs(E_vals.imag[E_ind]) > IMG_THERESHOLD:
15461546
self.logger.warning(
1547-
f"Eigenvalue has imaginary component greater than {img_thereshold}, contact developers if this issue persists."
1547+
f"Eigenvalue has imaginary component greater than {IMG_THERESHOLD}, contact developers if this issue persists."
15481548
)
15491549

15501550
# If the real value is less than or equal to zero, set the E_opt value to nan

0 commit comments

Comments
 (0)