Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions lts_array/classes/lts_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,10 +722,12 @@ def post_process(dimension_number, co_array_num, alpha, h, nits, tau, xij, coeff
# Calculate the sigma_tau value (Szuberla et al. 2006).
residuals = tau[weights, jj, :] - (xij[weights, :] @ z_final)
m_w, _ = np.shape(xij[weights, :])
with np.errstate(invalid='raise'):

with np.errstate(invalid="raise"):
try:
sigma_tau[jj] = np.sqrt(tau[weights, jj, :].T @ residuals / (
m_w - dimension_number))[0]
sigma_tau_value = tau[weights, jj, :].T @ residuals
sigma_tau_value = sigma_tau_value / (m_w - dimension_number)
sigma_tau[jj] = np.sqrt(float(np.asarray(sigma_tau_value).squeeze()))
Comment on lines +728 to +730
except FloatingPointError:
pass

Expand Down Expand Up @@ -755,8 +757,8 @@ def post_process(dimension_number, co_array_num, alpha, h, nits, tau, xij, coeff
# Halving here s.t. +/- value expresses uncertainty bounds.
# Remove the 1/2's to get full values to express
# coverage ellipse area.
conf_int_baz[jj] = 0.5 * sig_theta
conf_int_vel[jj] = 0.5 * np.abs(np.diff(1 / eExtrm[:2]))
conf_int_baz[jj] = 0.5 * float(np.asarray(sig_theta).squeeze())
conf_int_vel[jj] = 0.5 * float(np.asarray(np.abs(np.diff(1 / eExtrm[:2]))).squeeze())
Comment on lines +760 to +761

# Cast weights to int for output
element_weights[:, jj] = weights * 1
Expand Down Expand Up @@ -932,8 +934,13 @@ def solve(self, data):

# Calculate the sigma_tau value (Szuberla et al. 2006).
residuals = self.tau[:, jj, :] - (self.xij @ z_final)
self.sigma_tau[jj] = np.sqrt(self.tau[:, jj, :].T @ residuals / (
self.co_array_num - self.dimension_number))[0]

sigma_tau_value = self.tau[:, jj, :].T @ residuals
sigma_tau_value = sigma_tau_value / (
self.co_array_num - self.dimension_number
)

self.sigma_tau[jj] = np.sqrt(float(np.asarray(sigma_tau_value).squeeze()))
Comment on lines +938 to +943

# Calculate uncertainties from Szuberla & Olson, 2004
# Equation 16
Expand All @@ -960,8 +967,8 @@ def solve(self, data):
# Halving here s.t. +/- value expresses uncertainty bounds.
# Remove the 1/2's to get full values to express
# coverage ellipse area.
self.conf_int_baz[jj] = 0.5 * sig_theta
self.conf_int_vel[jj] = 0.5 * np.abs(np.diff(1 / eExtrm[:2]))
self.conf_int_baz[jj] = 0.5 * float(np.asarray(sig_theta).squeeze())
self.conf_int_vel[jj] = 0.5 * float(np.asarray(np.abs(np.diff(1 / eExtrm[:2]))).squeeze())
Comment on lines +970 to +971

except ValueError:
self.conf_int_baz[jj] = np.nan
Expand Down