Having time-dependent forcing terms, dx/dt = I(t) + g(x) is in general
not an issue for integrate_ode. If you know a functional form for
I(t) then you just add it to the ODE functor specification. If I(t) is
piecewise constant then you can recreate that using if/then statements
in the ODE functor specification.
Alternatively you can call integrate_ode only over the periods for
which I(t) is constant, instead of trying to integrate over many points
at once.
You would have to implement the ODE this way no matter where
you build your analysis, so moving to Python or Julia (or, gulp,
trying to get away with an Euler integrator) isn’t going to make
that any easier than building it in Stan. Plus you’d immediately
loose the scalable MCMC and be introducing even worse problems.