| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Codecov Report❌ Patch coverage is 99.18831% with 5 lines in your changes missing coverage. Please review. @@ Coverage Diff @@
## main #2936 +/- ##
==========================================
+ Coverage 83.33% 83.39% +0.06%
==========================================
Files 248 248
Lines 51799 51881 +82
Branches 4467 4479 +12
==========================================
+ Hits 43165 43267 +102
+ Misses 7882 7861 -21
- Partials 752 753 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry.
|
Sorry, something went wrong.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Sorry, something went wrong.
|
|
||
| def _field_shifts(self, field): | ||
| """ | ||
| Per-grid-Dimension half-cell shift induced by ``field``'s staggering |
There was a problem hiding this comment.
ultra-nitpick, fixable in a separate PR -- single `, not two, for homogeneity
Sorry, something went wrong.
There was a problem hiding this comment.
We seem to be wildly inconsistent on this
Sorry, something went wrong.
| try: | ||
| staggered = field.staggered | ||
| except AttributeError: | ||
| return None |
There was a problem hiding this comment.
when can u end up in the AttributeError? add a comment?
Sorry, something went wrong.
| try: | ||
| staggered = field.staggered | ||
| except AttributeError: | ||
| return None |
There was a problem hiding this comment.
return empty tuple
Sorry, something went wrong.
| except AttributeError: | ||
| return None | ||
| if not staggered or all(s == 0 for s in staggered): | ||
| return None |
There was a problem hiding this comment.
return empty tuple
Sorry, something went wrong.
| for _, g in groupby(pairs, lambda f: f[0].staggered): | ||
| g = list(g) | ||
| g_fields = [f for f, _ in g] | ||
| g_exprs = [e for _, e in g] |
There was a problem hiding this comment.
I think you can do
g_fields, g_exprs = zip(*g)
instead of these two lines
Sorry, something went wrong.
| def _grid_map(self): | ||
| return {} | ||
|
|
||
| @property |
There was a problem hiding this comment.
cached_property
Sorry, something went wrong.
| def _pos_symbols(self): | ||
| return [Symbol(name=f'pos{d}', dtype=np.int32) | ||
| for d in self.grid.dimensions] | ||
| @memoized_meth |
There was a problem hiding this comment.
the fact that this had to be turned into a memoized_meth makes me think that it should better be placed in the interpolator classes instead.
Accepting shifts here doesn't make much sense imho.
Sorry, something went wrong.
There was a problem hiding this comment.
I think I probably agree with this
Sorry, something went wrong.
There was a problem hiding this comment.
This is the symbol for the sparse position. And it's not used only for interpolation, it's used for plain guards such as here that are used for guarding generic sparse expressions based on the position
Sorry, something went wrong.
| @cached_property | ||
| def _position_map(self): | ||
| @memoized_meth | ||
| def _position_map(self, shifts=None): |
There was a problem hiding this comment.
same story, imho this method doesn't belong here anymore
Sorry, something went wrong.
There was a problem hiding this comment.
It does, this is a SparseFunction information which is it's position relative to an origin. The interpolator uses it, it doesn't define it.
Sorry, something went wrong.
| "assert np.isclose(norm(rec), 31.23, atol=0, rtol=1e-3)\n", | ||
| "assert np.isclose(norm(rec2), 3.5482, atol=0, rtol=1e-3)\n", | ||
| "assert np.isclose(norm(rec3), 4.7007, atol=0, rtol=1e-3)" | ||
| "assert np.isclose(norm(rec), 29.538, atol=0, rtol=1e-3)\n", |
There was a problem hiding this comment.
that's quite the change
Sorry, something went wrong.
There was a problem hiding this comment.
This one inject the source into v_x which changes things quite a bit over long propagation (2 seconds here) since the source position is not properly nterpolated into the staggered location of v_x
Sorry, something went wrong.
| def _pos_symbols(self): | ||
| return [Symbol(name=f'pos{d}', dtype=np.int32) | ||
| for d in self.grid.dimensions] | ||
| @memoized_meth |
There was a problem hiding this comment.
I think I probably agree with this
Sorry, something went wrong.
|
|
||
| # Position map and temporaries for it | ||
| pmap = self._position_map | ||
| pmap = self._position_map() |
There was a problem hiding this comment.
Does this never need to know about the shifts then?
Sorry, something went wrong.
There was a problem hiding this comment.
This is a guard for pure sparse operation, there is no staggered origin involved
Sorry, something went wrong.
There was a problem hiding this comment.
How come this file has been so heavily reworked?
Sorry, something went wrong.
There was a problem hiding this comment.
Just reorganized it was a pain to navigate it, it's 99% the same just lifted in classes
Sorry, something went wrong.
There was a problem hiding this comment.
Figured it would be something like that. Amazing, thanks!
Sorry, something went wrong.
| '(x, y)', '(x, z)', '(y, z)', | ||
| '(x, y, z)' | ||
| ]) | ||
| def test_interpolate_staggered(self, stagg): |
There was a problem hiding this comment.
Note: These three tests are the only new ones in this file
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
No description provided.