Minor update the pyEXP CoefStruct interface#112
Merged
michael-petersen merged 2 commits intomainfrom Mar 5, 2025
Merged
Conversation
michael-petersen
approved these changes
Mar 5, 2025
Member
michael-petersen
left a comment
There was a problem hiding this comment.
I've been testing this; I really like the new Pythonic interface!
Also good catch on pcaeof.
Member
Author
|
Thanks for testing. Yes, hit the 'pcaeof' in doing the halo analysis for dipole. Just an omission... |
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.
Summary
This commit overloads
CoefStruct::setCoefs()to have two call signatures:CoefStructdata storeCoefStruct::getCoefs()orCoefStruct::setCoefs(); that is, with the signaturevoid CoefStruct::getCoefs(Eigen::VectorXcd& array)and sets the underlying data store from array.This gets around the confusion of needing to set the values of
CfromC=CoefStruct::setCoefs()element by element which is a bad use of the numpy API, imho.Tests
Tested on the 'custom force' notebook from
pyEXP-examples/Tutorials/Orbitsto confirm that both methods give the same results. This improves the readability the force function in this notebook very nicely! I will check that into EXP-code/pyEXP-examples/#13 if we decide to keep this change.Notes
This PR adds new minor functionality and, therefore, this addition should not conflict with any current usage pattern and break existing code.