Skip to content

Commit 2597827

Browse files
authored
Merge pull request #29 from uafgeotools/catch_sig_tau
Add try statement to catch FloatingPointError
2 parents ad38fc4 + 50f4dc8 commit 2597827

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lts_array/classes/lts_classes.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,12 @@ def post_process(dimension_number, co_array_num, alpha, h, nits, tau, xij, coeff
722722
# Calculate the sigma_tau value (Szuberla et al. 2006).
723723
residuals = tau[weights, jj, :] - (xij[weights, :] @ z_final)
724724
m_w, _ = np.shape(xij[weights, :])
725-
sigma_tau[jj] = np.sqrt(tau[weights, jj, :].T @ residuals / (
726-
m_w - dimension_number))[0]
725+
with np.errstate(invalid='raise'):
726+
try:
727+
sigma_tau[jj] = np.sqrt(tau[weights, jj, :].T @ residuals / (
728+
m_w - dimension_number))[0]
729+
except FloatingPointError:
730+
pass
727731

728732
# Equation 16 (Szuberla & Olson, 2004)
729733
sigS = sigma_tau[jj] / np.sqrt(c_eig_vals)

0 commit comments

Comments
 (0)