-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Near2Far vectorization #251
Merged
Merged
Conversation
This file contains 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
tylerflex
requested changes
Mar 14, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just put a few comments and suggestions. A few general questions:
- For the type annotations of phi, theta, x, y, z, Let's do something similar to FreqMonitor.freqs. You can see
ArrayLike
here. TheArray
type is not really maintained and I've been dong things using ArrayLike lately as it's more robust. See if that works. We might want to throughfloat
into theUnion
too. - Let's inherit these new objects from
TIdy3dBaseModel
instead ofpydantic.BaseModel
after all. I think it makes more sense this way because we can inherit the config.
Thanks!
tylerflex
reviewed
Mar 14, 2022
tylerflex
approved these changes
Mar 14, 2022
…ettled on a hybrid vector-loop approach for now, need to test scalability implemented the ability to pick different vectorization strategies in near2far just for testing purposes renamed some temporary near2far functions for clarity
changed all output data to xarray datasets; added support for vectorized input for cartesian functions
…zed input for cartesian functions
…es in branch shash/near2far_vectorization_strategies and removed unused code from this branch
revised code based on the PR review revised code based on the PR review
739693a
to
3d92f9d
Compare
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.
Near2Far
supports vectorized inputs in the observation coordinates; uses vectorized calculations where advantageous. Output far fields are nowxarray
datasets.Note that the use of the progress bar in the function
_radiation_vectors_for_surface
is a bit ugly. This was to avoid a limitation of the progress bar: even when it is disabled (e.g. when only a single observation point is given) it still prints a bunch of blank lines. This is an issue for the functions which compute far fields in Cartesian coordinates. The "ugly" way only invokes the progress bar when more than onetheta
is given.