Git Product home page Git Product logo

brian2tools's People

Contributors

dokato avatar kapilkd13 avatar mqcapelle avatar mstimberg avatar sparsh989 avatar thesamovar avatar vigneswaran-chandrasekaran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brian2tools's Issues

Decide release/versioning strategy

We should decide how to release/version brian2tools with respect to brian2. My original proposal was to have a linked release strategy, i.e. we'll release a new version of brian2tools whenever we release a version of brian2. The advantage is that we don't have to check the compatibility across different versions, during the development cycle, brian2tools would test against the current development version of brian2 so at release time it would be guaranteed to work together. Is this reasonable? The main disadvantages of this approach that I can see:

  • we can't release brian2tools more often than brian2 (but hopefully we do releases of brian2 more regularly in the future)
  • It would be weird to do a brian2tools release without any changes, just because a new brian2 version is out
  • Starting the versions with 2.0 is a bit odd...

Another question is whether this linking would be strictly enforced, i.e. should the dependency of brian2tools on brian2 would use an exact version number?

On the other hand, if we manage to uncouple brian2tools from brian2 internals as much as possible and manage to keep API breaks in brian2 to a minimum, then all of this is maybe not really an issue. We'll just do brian2tools releases whenever (and maybe start at a humble 0.1 version or so), and have it always depend on brian2>X, where X is the latest release.

Any thoughts on this?

NotImplementedError: Do not know how to plot object of type <class 'brian2.core.variables.VariableView'>

When i want to plot the results with brian_plot(connections['XeAe'].w), following error appeared.
Would you please give me some advisers, thanks

`INFO:matplotlib.backends._backend_tk:Could not load matplotlib icon: can't use "pyimage10" as iconphoto: not a photo image
INFO:matplotlib.backends._backend_tk:Could not load matplotlib icon: can't use "pyimage19" as iconphoto: not a photo image
INFO:matplotlib.backends._backend_tk:Could not load matplotlib icon: can't use "pyimage28" as iconphoto: not a photo image
INFO:matplotlib.backends._backend_tk:Could not load matplotlib icon: can't use "pyimage38" as iconphoto: not a photo image
INFO:matplotlib.backends._backend_tk:Could not load matplotlib icon: can't use "pyimage47" as iconphoto: not a photo image
ERROR Brian 2 encountered an unexpected error. If you think this is bug in Brian 2, please report this issue either to the mailing list at http://groups.google.com/group/brian-development/, or to the issue tracker at https://github.com/brian-team/brian2/issues. Please include this file with debug information in your report: c:\users\licecv\appdata\local\temp\brian_debug_cvd6ww.log Additionally, you can also include a copy of the script that was run, available at: c:\users\licecv\appdata\local\temp\brian_script_983vzt.py You can also include a copy of the redirected std stream outputs, available at c:\users\licecv\appdata\local\temp\brian_stdout_jransm.log and c:\users\licecv\appdata\local\temp\brian_stderr_duu1ut.log Thanks! [brian2]
Traceback (most recent call last):
File "D:/1-xpj/8-bishe/code/Brian2STDPMNIST/Diehl&Cook_spiking_MNIST_Brian2.py", line 553, in
brian_plot(connections['XeAe'].delay)
File "C:\Anaconda3\envs\py27\lib\site-packages\brian2tools\plotting\base.py", line 154, in brian_plot
'%s' % type(brian_obj))
NotImplementedError: Do not know how to plot object of type <class 'brian2.core.variables.VariableView'>

Process finished with exit code 1`

Better description for `+=` operator

Synaptic events and run_regularly operations often use the += operator (or -=). We currently include them in the descriptions and that's of course ok, but they look a bit more like programming language code than a mathematical description. It would be nice to replace something like v_post += w by "increase v_post by w".

Better descriptions for random initializations

With the polishing branch, intializations that refer to rand() or randn() already look a bit nicer. But I think we could use this as a first example of automatic annotation with additional analysis.
If an expression only contains a single rand() call, we can use sympy's substitution mechanism and substitute it once with 0 and once with 1, and then use this to display the lower and upper bounds. So if you have an initialization like:

v = El + (V_th - El)*rand()

This would currently be displayed as:
image

but we could further annotate this with something like
image

We could probably do something fancy with sympy as well to get the mean and variance of a normal distribution if the expression uses randn().

Model fitting API

We have some model fitting code in the model fitting branch. It uses differential evolution to fit traces. But what we could do is a general API, which would work with any optimization function. The user simply defines the criterion to be calculated, and passes the optimization function to use. This could work for any gradient-free algorithm.

What we need to add is a callback for initializing the models, and maybe a few other things.

Then we might be able to use gradient-based algorithms by using automatic differentiation tools such as Autograd. To calculate dE/dp, where E is an error criterion and p is a parameter, we need to be able to calculate dVm/dp. We get this by differentiating the membrane equation with respect to p, and then integrating. We see that we actually need to calculate dXi/dp for every state variable i. We use autograd to calculate the RHS. The main question is whether this can be easily vectorized across neurons.

Automatic model calibration / debug plot

One of the things I sometimes do when working on a new model is have a sort of 'scientific test suite' which automatically plots the output of each stage of the model and then dumps them into a pdf file. Maybe it would be good to have a tool that automates this, e.g. you would write calibrated_run(100*ms) instead of run(100*ms). Or even simpler, you would create a cal = CalibrationPlotter('filename.pdf') that would be a BrianObject and would do some stuff in the before and after run slots. So for example, it would plot a graph of the network, and for each object it would call brian_plot on it. For NeuronGroup it would also create a SpikeMonitor and StateMonitor (which would only record a handful of neurons to save memory).

I'm not sure how widely useful this would be. Perhaps it's too specific a use case, but it feels like something that a lot of people would benefit from doing but don't because it's effort and time taken from doing the actual modelling work, but if it was made trivially easy to do so then they might.

Importing morphologies into Brian from a NeuroML file

This summer I would be working on "Importing morphologies into Brian from a NeuroML file" as part of the Gsoc 2018. I would be using this thread for keeping track of the milestones and the upcoming work.
Also I would like to use this thread to discuss issues/ suggestions or to gain any other information.

Milestones to be achieved:

  • Setup Brian and supporting libraries like JneuroML, Pylems and libNeuroML
  • Setup Neuron( not urgent)
  • Study, compare and choose best parsing lib option.
    libNeuroML is choosen
  • getting familiar with lems/neuroml specification.
    under progress
  • convert neuroml morphology to python objects using parsing library for further usage.
  • create "nmlimport" module inside brain2tools to load morphologies directly into Brian.
  • create test cases for above implementation.
  • Test, refactor and merge it.

After this I will start working on "accessing other information like ion channel from nml file"
After this we will compare result from Brian, Neuron and other simulators. nml file exported from NEURON will be imported and tested in Brian. detailed milestones will be added later.
@mstimberg

Allow plotting multiple variables of StateMonitor

At the moment, plotting a StateMonitor with multiple variables gives an error. It would be nice to plot multiple state variables to a figure with multiple axes (with shared x-axis so zooming in on one zooms on all). You could also imagine having a syntax that allows you to choose which axes are re-used and which are new, e.g. show_variables=[('v', 'vt'), ('I',)] would show v and vt on one axis, and I on another. It could automatically select the correct number of subplots to use to fill the figure.

The problem with this is that at the moment you can specify an axis to plot to, and this would have to allow plotting to multiple axes.

In the past I've written plotting routines for my own use where you can pass an ax and fig argument. If the plotting routine needs multiple axes, you have to pass a fig (or it creates a new one if fig is None). If the plotting routine only needs one axis, you can either pass an ax or fig (if you pass a fig, it will do subplot(111) on that fig). Maybe this scheme would work here?

Use images / adaptive point size for large synapses?

At the moment, if you brian_plot(S) for a large Synapses you just get a big blue square and you can't see any structure in it. Perhaps we could either have an image rather than scatter plot, or adaptively decide the size of the scatter symbols based on the number of synapses?

Synaptic "image" plots plot a transposed form of the correct matrix

For non-symmetric connections this means that only a part of the plot is shown (since we set the limits manually):

source = NeuronGroup(10, '')
target = NeuronGroup(1, '')
syn = Synapses(source, target, 'w: 1')
syn.connect()
plot_synapses(syn.i, syn.j, syn.w, plot_type='image')

wrong_synapses_plot

Add model explorer?

A while ago I wrote a little GUI thing for exploring the behaviour of models, it's in brian2cookbook. You write a class with certain properties and it automatically generates a GUI that has sliders for the parameters, etc. and displays a plot of the behaviour (in realtime if the model is simple enough to be computed that quickly). Do you think it's worth adding this to brian2tools? It would be quite handy for teaching and demonstration purposes. It would probably need a bit of work to update it to work with the latest changes to brian2, and I was thinking of adding a bit of code to allow it to run using IPython GUI tools as well as Qt. Shouldn't be much work though.

Plotting Morphology can be very slow

e.g. try plotting c11563.CNG.swc from neuromorpho.org. It didn't finish after several runs. I think this is because it's doing a lot of work constructing Morphology objects? Not sure. In any case, the following code plots it very quickly and efficiently directly from the swc file so it should be possible to do this from a Morphology object too:

def plot_swc(fname, showtype=(True,)*4):
    # Load SWC file directly (Morphology is too slow)
    # index, type, x, y, z, radius, parent
    i, t, x, y, z, r, p = loadtxt(fname).T
    i = array(i, dtype=int)-1 # indices start at 1
    t = array(t, dtype=int)-1 # types start at 1
    p = array(p, dtype=int)
    p[p>0] -= 1 # parent indices too, but -1 is special (root node)
    # Create and plot a LineCollection
    segs = [((x[i], y[i]), (x[p[i]], y[p[i]])) for i in xrange(len(t)) if p[i]>=0 and showtype[t[i]]]
    c = LineCollection(segs, linewidths=1, colors='k', linestyle='solid')
    gca().add_collection(c)
    gca().autoscale_view(True,True,True)    
    xticks([])
    yticks([])
    gca().set_frame_on(False)
    gca().set_aspect('equal', 'datalim')    

Here's the swc file zipped: c11563.CNG.swc.zip

installation problem

I want to install the brian2tools package in anaconda. But it failed. The Terminal command as follows:

(snn) hu@brouilly:~$ conda install -c brian-team brian2tools
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  • brian2tools -> python[version='2.7.|3.5.|3.6.|3.4.']

Your python: python=3.7

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

The following specifications were found to be incompatible with your CUDA driver:

  • feature:/linux-64::__cuda==10.2=0
  • feature:|@/linux-64::__cuda==10.2=0

Your installed CUDA driver is: 10.2

Is this mean that only python version [version='2.7.|3.5.|3.6.|3.4.'] can use brian2tools ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.