You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which may also work for other functions (maybe there is a more elegant way by looking up matching module attributes).
The main issue, I have however encountered is that, for example
x=MySymbol("x")
y=MySymbol("y")
np.exp(x+y)
fails again because this is now not a MySymbol but rather an Add class.
So, I believe, if it is somehow possible, it would be more effective to replace all the numpy expressions by sympy expressions within the function call. Maybe this possible in the spirit of unittest.mock.
The text was updated successfully, but these errors were encountered:
A small suggestion: if lsqfit-gui is unable to properly parse the fitfcn as a latex expression, maybe fall-back to (optionally?) printing the python block. I know that, at least for me, my fit functions usually contain plenty of if/else statements (especially for xpt fits), which I wouldn't expect to be parsed correctly (though I would be tremendously impressed if they were).
This is a good idea, Though it can be a bit nested if it is also an entire class. I would probably make it a collapsible section (or comparable) to not pollute the GUI too much.
Generally speaking, if the if statements don't use the x or p values, it should be possible. It just uses sympy expressions instead of actual numbers or gvars.
The source code inspection is now implemented on the function-source-code branch. I'll wait with the merge because of related prior export dependencies.
The function document method uses sympy to generate a latex expression for the fit function and returns
None
if it fails to generate the expression.See also
from lsqfitgui.util.function import parse_function_expression
.Unfortunately, parsing functions using numpy fail. This is due to
fails.
A workaround is overloading the
Symbol
classwhich may also work for other functions (maybe there is a more elegant way by looking up matching module attributes).
The main issue, I have however encountered is that, for example
fails again because this is now not a
MySymbol
but rather anAdd
class.So, I believe, if it is somehow possible, it would be more effective to replace all the numpy expressions by sympy expressions within the function call. Maybe this possible in the spirit of unittest.mock.
The text was updated successfully, but these errors were encountered: