-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow more complex unit transformation rules #282
Comments
What I currently use for codegen (outsode pints / cellmlmanip) would need to be able to generate a function call that ends up being in the output. E.g. |
Could still work! @jonc125 wrapped sympy objects in |
The function has no output, it needs to be there as a cal. In other woulds the C++ output is of the for: If you can wrap that in a quantity maybe it's possible, where could I find this wrapping in action to look at? |
There's an example of the wrapping in the description. I also wondered about using Sympy's lambdify to convert from a Sympy expression to an equivalent Python that could operate on the Pint units. If you had Pint |
I might be blind but I can't see it? |
Ah, good point, sorry, didn't realise Michael had done something different. My example was at ModellingWebLab/weblab-fc#156 (comment) |
The second point is handled by #286. |
This issue has two goals:
cf
, we should somehow let that restriction goThe above is an example of pint transformations.
There's some subtle gotchas:
this will break, because the lambda doesn't store a copy of
f
, it just grabs anf
from the local scope whenever it's used, so both functions actually use the same f. So some tricks needed there (e.g. define a callable class).But the main thing to figure out is whether we can come up with some cellmlmanip API that can be re-used by FC (Web Lab) and chaste codegen, for specifying rules with lambdas (python lambdas? sympy expressions?) so that conversion of currents is easier
The text was updated successfully, but these errors were encountered: