Skip to content

Commit 992c308

Browse files
authored
Merge pull request #38 from uafgeotools/scalar
Scalar assignment issue
2 parents 8e9d204 + badb50b commit 992c308

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

lts_array/classes/lts_classes.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -722,10 +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-
with np.errstate(invalid='raise'):
725+
726+
with np.errstate(invalid="raise"):
726727
try:
727-
sigma_tau[jj] = np.sqrt(tau[weights, jj, :].T @ residuals / (
728-
m_w - dimension_number))[0]
728+
sigma_tau_value = tau[weights, jj, :].T @ residuals
729+
sigma_tau_value = sigma_tau_value / (m_w - dimension_number)
730+
sigma_tau[jj] = np.sqrt(float(np.asarray(sigma_tau_value).squeeze()))
729731
except FloatingPointError:
730732
pass
731733

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

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

933935
# Calculate the sigma_tau value (Szuberla et al. 2006).
934936
residuals = self.tau[:, jj, :] - (self.xij @ z_final)
935-
self.sigma_tau[jj] = np.sqrt(self.tau[:, jj, :].T @ residuals / (
936-
self.co_array_num - self.dimension_number))[0]
937+
938+
sigma_tau_value = self.tau[:, jj, :].T @ residuals
939+
sigma_tau_value = sigma_tau_value / (
940+
self.co_array_num - self.dimension_number
941+
)
942+
943+
self.sigma_tau[jj] = np.sqrt(float(np.asarray(sigma_tau_value).squeeze()))
937944

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

966973
except ValueError:
967974
self.conf_int_baz[jj] = np.nan

0 commit comments

Comments
 (0)