-
Notifications
You must be signed in to change notification settings - Fork 40
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
Improved efficiency of overlap_sort #1465
Conversation
@caseyflex should we close this (or make a draft) in view of #1464 ? |
no sorry -- we should close this one: #1463 This PR uses the revised outer_dot PR #1464 to improve overlap_sort. |
ok I see, sorry for the confusion |
``self.monitor.mode_spec`` and ``self.monitor.freqs`` will no longer be matching the | ||
newly created data.""" | ||
|
||
update_dict = dict(self._grid_correction_dict, **self.field_components) |
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.
_grid_correction_dict is a property so it shouldn't be added here at all?
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.
I guess this is adding grid_primal_correction
and grid_dual_correction
to the update list. I copied this from _isel
, but it is probably not needed as these fields keep their old values...
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.
oh actually, it does do something -- it updates the coordinates on those two fields as well as the field_components. This may actually be needed so best to leave it.
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.
Ah, got it.
@@ -1081,6 +1081,7 @@ def overlap_sort( | |||
for freq_id in range(f0_ind + step, last_ind, step): | |||
# Get next frequency to sort | |||
data_to_sort = self._isel(f=[freq_id]) | |||
data_to_sort = data_to_sort._assign_coords(f=[self.monitor.freqs[f0_ind]]) |
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.
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.
It's a bit of a hack -- I want to isel f=[freq_id]
, which is the next frequency to sort. But, I want to compute outer_dot against the base frequency f0
. But because of how outer_dot works, it only keeps frequencies which are common between the two datasets. So, here, I isel f=[freq_id]
, then I assign coords to f0
, so that outer_dot will think they are at the same frequency and know to compare them.
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.
Ohhhhh. Funny. One thing we could do also do is to allow outer_dot
to work without a frequency dimension, and just pop it? But, eh, I think this is fine.
e498b81
to
e5297f7
Compare
9a1eee1
to
a9117db
Compare
e5297f7
to
64e01fa
Compare
a9117db
to
b9ad790
Compare
I don't know if @weiliangjin2021 still wants to look at this, but it should be good to merge after a rebase. The conflicts are probably in the changelog. You could squash the commits too. |
b9ad790
to
a6a90c1
Compare
Rebased and squashed. Merge when you're ready. thanks! |
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.
I didn't take a very careful look. From what I understand, it all look good.
Uses the faster outer_dot to improve efficiency of overlap_sort. Sometimes, sorting modes can be a bottleneck in mode solving, and this should prevent that from occuring.
Based off of #1464