-
Notifications
You must be signed in to change notification settings - Fork 64
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
Regular grid interpolation #244
Conversation
Hi @flabowski. What about adding a preprocessing step within this class to create the 1d vectors from the parameters given by the |
…nts, not the grid axes.
Hi @mtezzele |
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.
Could you please add a doc file for the automatic doc generation of the new module. You can follow what has been done in docs/source/rbf.rst
for example. Then just add the name of the new file here: docs/source/code.rst
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.
Hi @flabowski, I left some comments on your code. Let me know if you need any clarification. Thanks!
I realized now that one of the changes @fandreuz suggested changed the behaviour and one of the tests failed. I assume that was unintended. I reverted it, so the behaviour matches the |
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.
Please add the new rst doc file in the following file: docs/source/code.rst
ezyrb/regular_grid.py
Outdated
:return: the interpolated values. | ||
:rtype: numpy.ndarray | ||
""" | ||
new_point = np.asarray(new_point) | ||
if len(new_point.shape) == 1: | ||
new_point.shape = (-1, 1) |
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.
please fix this as above
Dear @flabowski, thanks for the effort! From my side, everything looks almost perfect, I just asked if you can add a simple test in order to check that the exception is raised in case of not grid points. |
docs/source/regular_grid.rst
Outdated
@@ -10,10 +10,10 @@ RegularGrid | |||
:nosignatures: | |||
|
|||
RegularGrid | |||
RegularGrid.def |
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.
This is not needed. Or at least we don't use it in the other files. I am not sure about the generated outcome...
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 am not sure either. The file was generated automatically when ran make_rst.sh
. Some other things seem to be fishy.
edit: everything seems fine after reverting what make_rst.sh
did. @ndem0 maybe some commands need to be updated?
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.
We are not using that script anymore! Sorry, it's not written, I gonna remove it in the next release of EZyRB (#232).
The file now looks correct, thanks!
* added tests for regular grid interpolation * added regular grid interpolation module * added the rst file for the regular grid interpolation
see #243
The class needs a grid, i.e. something like
grid = ([0.1, 0.2, 0.3], [1, 2, 3, 4, 5])
, not a list of points such aspoints = [[0.1, 1], [0.1, 2], [0.1, 3], ..., [0.3, 5]]
. That means rom.fit() does not work, the method assumes we want to use the points from the database to construct the interpolator. Instead the user has to callreduction.fit(...)
first and thenrg_approximation.fit(...)
with the proper grid.Although the interpolation returns what we expect in the tests, I have not tested it in a full ROM yet.