Conversation
There was a problem hiding this comment.
Pull request overview
Fixes NumPy (newer versions) scalar-assignment incompatibilities in LTS post-processing/solving logic by ensuring certain matrix-expression results are converted to true Python scalars before being assigned into scalar array elements, addressing the ValueError: setting an array element with a sequence reported in #37.
Changes:
- Convert
sigma_tau[...]assignments to explicitly extract a scalar from the intermediate matrix product result before callingsqrt(...). - Convert
conf_int_baz[...]/conf_int_vel[...]assignments to explicitly extract scalars fromsig_theta/diff(...)expressions. - Minor formatting adjustment to the
np.errstate(...)call.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+728
to
+730
| 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
+760
to
+761
| 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
+938
to
+943
| 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
+970
to
+971
| 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()) |
Member
Author
|
Thanks copilot! ;) I think these are just cosmetic and informational, so am going to keep what I have and just merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recent versions of numpy treat the right-hand side of an assignment as a sequence/array instead of a clean scalar, so a few assignments were failing. The matrix operations are now explicitly scalar. This addresses #37.