neurolib-dev / neurolib

Easy whole-brain modeling for computational neuroscientists 🧠💻👩🏿‍🔬
MIT License
401 stars 82 forks source link

What should neurolib be? #10

Closed jajcayn closed 3 years ago

jajcayn commented 4 years ago

Apart from the main purpose of this lib (that being the meso-/large- scale modelling) what other functionality we want to address?

caglorithm commented 4 years ago

I think, firstly, it should offer great usability and hackability. The lib should encourage to go into the code and change it and even more define simple rules on how to create your own model. Define your models, set up a Circuit (I love that term btw) and run the simulation.

On top of that (based on my own research experience), I would love to have some exploration (of the model) and optimization (fit to empirical data or predefined features) abilities.

Analysis and plotting would be amazing features. However, when I usually use builtin analysis and plotting tools, I, pretty much every time, reach some kind of limit, and then I either have to go in the code or I just implement my own analysis and plotting. I often end up choosing the latter. I imagine every seasoned scientist to have their own way of doing analysis and plotting, so this might not be as critical as other parts of the lib (at least for now). That being said, I would have to have a simple Fourier analysis just a method away or similar.

Kittens - YES but parallelised please!

ChristophMetzner commented 4 years ago

Haven't had a chance to take a proper look, but some suggestions from the top of my hat:

Regarding Nikola's suggestions, I think for the network algorithms, Mayanks implementation could relatively easily be integrated.

jajcayn commented 4 years ago

Haven't had a chance to take a proper look, but some suggestions from the top of my hat:

  • more standard models (Wilson&Cowan, Jansen&Rit, Kuramoto oscillator)

this will definitely be included

  • Extend to modelling FC from MEG data

not sure how you mean, but you can extract SC and fiber lengths from MEG data (not with neurolib, there are other tools for that) and model using those... as for FC from raw data, that'd problematic, because usually, you want to do source reconstruction (LORETA, beamformer, etc) and adding these would be 1. an overkill, 2. reinventing a wheel since mne has wonderful support for MEG and lot of their examples are actually creating FC from MEG data (you have whole paper about that :) ).. using neurolib you can try to model FC and then match to mne estimates for MEG FC

  • Add stimulation functionality (i.e. you specify tDCS or tACS stimulation parameters and under the hood this is automatically translated to model parameter changes for the specific model the user chose)

this would be beautiful!

Regarding Nikola's suggestions, I think for the network algorithms, Mayanks implementation could relatively easily be integrated.

actually we were thinking of including networkx under the hood, so all graph-theoretical attributes could be computed with a breeze.. we'll see

ChristophMetzner commented 4 years ago

Haven't had a chance to take a proper look, but some suggestions from the top of my hat:

  • more standard models (Wilson&Cowan, Jansen&Rit, Kuramoto oscillator)

this will definitely be included

  • Extend to modelling FC from MEG data

not sure how you mean, but you can extract SC and fiber lengths from MEG data (not with neurolib, there are other tools for that) and model using those... as for FC from raw data, that'd problematic, because usually, you want to do source reconstruction (LORETA, beamformer, etc) and adding these would be 1. an overkill, 2. reinventing a wheel since mne has wonderful support for MEG and lot of their examples are actually creating FC from MEG data (you have whole [paper] (https://www.frontiersin.org/articles/10.3389/fnins.2018.00586/full) about that :) ).. using neurolib you can try to model FC and then match to mne estimates for MEG FC

So what I meant is, that you need methods to process the 'raw' model output to an FC matrix. If you're interested in MEG FC you often want to look at specific frequency bands and it would be nice if neurolib would automatically give you the FC matrices for each frequency band.

  • Add stimulation functionality (i.e. you specify tDCS or tACS stimulation parameters and under the hood this is automatically translated to model parameter changes for the specific model the user chose)

this would be beautiful!

Regarding Nikola's suggestions, I think for the network algorithms, Mayanks implementation could relatively easily be integrated.

actually we were thinking of including networkx under the hood, so all graph-theoretical attributes could be computed with a breeze.. we'll see

Ok, that also makes sense.

jajcayn commented 4 years ago

that would be possible. Now we are working on so-called Signal object for modelling results / or experimental data which supports all kinds of basic preprocessing (e.g. band-pass filtering) so creating band-specific FC would be a matter of one, two lines

caglorithm commented 4 years ago
  • Add stimulation functionality (i.e. you specify tDCS or tACS stimulation parameters and under the hood this is automatically translated to model parameter changes for the specific model the user chose)

This is actually already possible! At least with the aln model, you can set the external input parameters for stimulation before each run and they will be integrated over time.

They are called

I actually wanted to know how fast and easy I could implement this with neurolib! Let's see what happens if we ramp up a current from 0 to 0.1 nA:

from neurolib.models.aln import ALNModel
import matplotlib.pyplot as plt
import numpy as np
aln = ALNModel() # comes with default parameters
aln.run()
plt.plot(aln.t, aln.rates_exc.T, c='k', label='no stim', lw=3)
aln.params['ext_exc_current'] = np.linspace(0, 0.1, aln.params['duration']/aln.params['dt'])
aln.run()
plt.plot(aln.t, aln.rates_exc.T, c='r', alpha=0.5, label='ramp stim', lw=2)
plt.legend()

image

🤯

PS: I'm gonna add this to the examples!