Skip to content
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 11 commits into from
Mar 15, 2022
Merged

Near2Far vectorization #251

merged 11 commits into from
Mar 15, 2022

Conversation

shashwat-sh
Copy link
Contributor

@shashwat-sh shashwat-sh commented Mar 11, 2022

Near2Far supports vectorized inputs in the observation coordinates; uses vectorized calculations where advantageous. Output far fields are now xarray 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 one theta is given.

@shashwat-sh shashwat-sh requested a review from tylerflex March 11, 2022 23:40
Copy link
Collaborator

@tylerflex tylerflex left a 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:

  1. For the type annotations of phi, theta, x, y, z, Let's do something similar to FreqMonitor.freqs. You can see ArrayLike here. The Array 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 through float into the Union too.
  2. Let's inherit these new objects from TIdy3dBaseModel instead of pydantic.BaseModel after all. I think it makes more sense this way because we can inherit the config.

Thanks!

@shashwat-sh shashwat-sh requested a review from tylerflex March 14, 2022 22:17
…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
…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
@shashwat-sh shashwat-sh force-pushed the shash/near2far_vectorization branch from 739693a to 3d92f9d Compare March 15, 2022 00:05
@tylerflex tylerflex merged commit 9226a6a into develop Mar 15, 2022
@momchil-flex momchil-flex deleted the shash/near2far_vectorization branch March 17, 2022 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants