Uploaded image for project: 'The Virtual Brain'
  1. The Virtual Brain
  2. TVB-2560

Write the numba implementation for models S-J 2D and 3D

    XMLWordPrintable

Details

    • Improvement
    • Status: Reopened
    • Major
    • Resolution: Unresolved
    • None
    • None
    • simulator
    • None
    • 8.2 Pipeline Integration

    Description

      Models Stefanescu-Jirsa 2D and 3D in TVB have more than one mode, and only a python defined dfun.

      They could be rewritten with a numba dfun, considering the following aspects:

      • other numba gufuncs drop the mode dimension, which isn't ok here, so the gufunc signature should have the extra mode dimension
      • some derived parameters are matrices and need to have a (n_mode, n_mode) shape in the gufunc signature instead of (1,)
      • these models have a dot product between matrix parameters along the mode dimension, might require tweaking

      This could be a unit test:

       
      class TestNumbaDfun:
          def dfun(self, *args, **kwargs):
              f1 = self._numpy_dfun(*args, **kwargs)
              f2 = super().dfun(*args, **kwargs)
              assert np.allclose(f1, f2)
              return f2
       
      class TestModel(TestNumbaDfun, ReducedHindmarshRoseNumba):
          pass
       
      sim = simulator.Simulator(model=TestModel(), ...)
      sim.run()
      

       

       

      Gliffy Diagrams

        Attachments

          1. screenshot-1.png
            screenshot-1.png
            7 kB
          2. simulator_test.py
            12 kB
          3. stefanescu_jirsa.py
            33 kB

          Activity

            People

              Unassigned Unassigned
              lia.domide Lia Domide
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 2 days Original Estimate - 2 days
                  2d
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days, 3 hours
                  3d 3h