Closed mirams closed 5 years ago
Some updates on this:
We're setting up code generation in a fairly general way, with (1) an object that converts sympy expressions to expression code and (2) ninja (django-style) templates that stick those expressions into a code file. It'd be straightforward (but still a bit of effort, maybe a day if it's a new language?) to add in more languages and templates
I've just added "shallow" RL detection to Myokit, which wasn't hard! It detects state variables of the forms alpha (1 - x) - beta x
and (inf - x) / tau
. But it's harder to make it also recognise things like (inf - x) / (1 + V)
. I've never seen a model written like this though, so shallow should be fine as a start
The extra nice analytical markov solves are in Myokit too :D It does operate on a current model rather than a cell model, so unless you have a cellml file containing only the current (and time, V etc.) you need to explicitly tell it to "freeze" the other states (e.g. the INa states if you're studying IKr). Not super hard to do but requires user intervention,
Moving this to weblab_cg
, where we can handle it (separate from general WL) if needed
Dynamic clamp platforms use real-time computing to inject simulated currents into real cells, and take voltage from real cells as an input over the next time interval.
A common use case is a sub-model like a sodium current from a whole AP model, or a whole AP model that is missing particular currents. Our Functional Curation framework should be able to export these nicely, and already makes a sub-model Chaste .hpp and .cpp files from a given input and outputs.
We would want to generate code with fixed-time solvers like Rush-Larsen / RK4 in a format for some dynamic clamp platforms.
I manually ‘flattened’ (combined the abstract class and solver with the concrete ODE system) one of our Rush-Larsen models for Teun in Utrecht, and he translated from C++ to Labview, this was a bit laborious. It would be a very nice application of FC framework to just be able to export him any current module from any model in a format he could readily use. I would like this to be a feature of Web Lab that people could use like they do for whole models in PMR at the moment. Other dynamic clamp softwares include David Christini’s RTXi and Randy Rasmusson also has some dynamic clamp software. All would probably want a similar 'flattened' optimised compute time model, but we can check that with them.
(A nice optional extra would be to do R-L style exact solves on Markov models automatically too with old-school linear system eigenvalues/vectors etc. over fixed V timesteps. Might need some clever business to assemble a transition matrix from randomly written equations, work out maple analytic expressions for eigenvalues and vectors etc. This would also be great for our parameter fitting exercises as it would speed up calculations with voltage steps massively.)