hi,
IIRC your previous email was about the forward model (which for s/EEG is a gain matrix that should be calculated before hand with OpenMEEG or Brainstorm or similar software).
The particular problem of inverting EEG with the Jansen Rit has been well explored within the DCM framework and it's probably a good idea to understand the content of this paper before proceeding
https://www.sciencedirect.com/science/article/pii/S1053811921009356
cheers,
Marmaduke
Attribute can't be set to an instance of <class 'jaxlib.xla_extension.DeviceArray'> attribute tvb.simulator.models.jansen_rit.JansenRit.A = NArray(label=':math:`A`', dtype=float64, default=array([3.25]), dim_names=(), ndim=None, required=True)
You received this message because you are subscribed to a topic in the Google Groups "TVB Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tvb-users/pKjMD9H8w1s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tvb-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/5e85086c121a4088afdd34fa7698b7ef%40univ-amu.fr.
I tried passing in jrm.A = np.array([A]) It is giving me this error.
The numpy.ndarray conversion method __array__() was called on the JAX Tracer object Traced<ConcreteArray(-0.8757257461547852, dtype=float32)>with<JVPTrace(level=2/0)> with primal = DeviceArray(-0.87572575, dtype=float32) tangent = Traced<ShapedArray(float32[])>with<JaxprTrace(level=1/0)> with pval = (ShapedArray(float32[]), None) recipe = LambdaBinding()
Hi,
First, thanks for making an effort with TVB, the API is understandably not what you'd expect if you're accustomed to Jax or Tensorflow, and it does some type checking, which you encountered before.  Since our full-feature simulator uses some NumPy APIs which won't be compatible with tracer-based systems like Jax, you will need to use the code generation backend to obtain some plain NumPy code, which can then be traced with Jax.  There's an effort to do this also for Theano (Aesara from PyMC devs), going on in a PR here
https://github.com/the-virtual-brain/tvb-root/pull/630
Something similar could be done for Jax, with some tweaks to some of the API calls. Â But, it also seems that aesara supports Jax as a backend, so you may just try that branch directly.Â
Lastly, the Jansen-Rit model is not (yet) available for code generation, but it is just missing some metadata on the model class. You can see here
what metadata is required, and it would be more than welcome to have that contribution for the Jansen Rit model.Â
cheers,
Marmaduke
To view this discussion on the web visit https://groups.google.com/d/msgid/tvb-users/242b19fbe7d34031beacd28d9ee68298%40univ-amu.fr.
hi
TVB uses a last extra dimension for the modal models which JR is not.  You can just add the extra dimension to your array so that the shape matches.Â
cheers,
Marmaduke