Git Product home page Git Product logo

bluebrain / bluepyopt Goto Github PK

View Code? Open in Web Editor NEW
198.0 18.0 95.0 58.69 MB

Blue Brain Python Optimisation Library

Home Page: https://bluepyopt.readthedocs.io/en/latest/

License: Other

Makefile 0.47% Python 74.19% Shell 0.14% Dockerfile 0.13% Jinja 0.84% TeX 24.24%
python optimisations neuroscience parameter modelling electrophysiology neurons computational-neuroscience cross-platform biological-simulations

bluepyopt's Introduction

banner

BluePyOpt

Latest Release latest release
Documentation latest documentation
License license
Build Status actions build status
Coverage coverage
Gitter Join the chat at https://gitter.im/BlueBrain/BluePyOpt
Zenodo zenodo

Introduction

The Blue Brain Python Optimisation Library (BluePyOpt) is an extensible framework for data-driven model parameter optimisation that wraps and standardises several existing open-source tools.

It simplifies the task of creating and sharing these optimisations, and the associated techniques and knowledge. This is achieved by abstracting the optimisation and evaluation tasks into various reusable and flexible discrete elements according to established best-practices.

Further, BluePyOpt provides methods for setting up both small- and large-scale optimisations on a variety of platforms, ranging from laptops to Linux clusters and cloud-based compute infrastructures.

Citation

When you use the BluePyOpt software or method for your research, we ask you to cite the following publication (this includes poster presentations):

Van Geit W, Gevaert M, Chindemi G, Rössert C, Courcol J, Muller EB, Schürmann F, Segev I and Markram H (2016). BluePyOpt: Leveraging open source software and cloud infrastructure to optimise model parameters in neuroscience. Front. Neuroinform. 10:17. doi: 10.3389/fninf.2016.00017.

@ARTICLE{bluepyopt,
AUTHOR={Van Geit, Werner  and  Gevaert, Michael  and  Chindemi, Giuseppe  and  Rössert, Christian  and  Courcol, Jean-Denis  and  Muller, Eilif Benjamin  and  Schürmann, Felix  and  Segev, Idan  and  Markram, Henry},
TITLE={BluePyOpt: Leveraging open source software and cloud infrastructure to optimise model parameters in neuroscience},
JOURNAL={Frontiers in Neuroinformatics},
VOLUME={10},
YEAR={2016},
NUMBER={17},
URL={http://www.frontiersin.org/neuroinformatics/10.3389/fninf.2016.00017/abstract},
DOI={10.3389/fninf.2016.00017},
ISSN={1662-5196}
}

Publications that use or mention BluePyOpt

The list of publications that use or mention BluePyOpt can be found on the github wiki page.

Support

We are providing support using a chat channel on Gitter, or the Github discussion page.

News

Requirements

  • Python 3.8+
  • Pip (installed by default in newer versions of Python)
  • Neuron 7.4+ (compiled with Python support)
  • eFEL eFeature Extraction Library (automatically installed by pip)
  • Numpy (automatically installed by pip)
  • Pandas (automatically installed by pip)
  • The instruction below are written assuming you have access to a command shell on Linux / UNIX / MacOSX / Cygwin

Installation

If you want to use the ephys module of BluePyOpt, you first need to install NEURON with Python support on your machine.

And then bluepyopt itself:

pip install bluepyopt

Support for simulators other than NEURON is optional and not installed by default. If you want to use [Arbor](https://arbor-sim.org/) to run your models, use the following line instead to install bluepyopt.

pip install bluepyopt[arbor]

Cloud infrastructure

We provide instructions on how to set up an optimisation environment on cloud infrastructure or cluster computers here

Quick Start

Single compartmental model

An iPython notebook with an introductory optimisation of a one compartmental model with 2 HH channels can be found at

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/simplecell/simplecell.ipynb (NEURON) https://github.com/BlueBrain/BluePyOpt/blob/master/examples/simplecell/simplecell_arbor.ipynb (Arbor)

landscape_example

Figure: The solution space of a single compartmental model with two parameters: the maximal conductance of Na and K ion channels. The color represents how well the model fits two objectives: when injected with two different currents, the model has to fire 1 and 4 action potential respectively during the stimuli. Dark blue is the best fitness. The blue circles represent solutions with a perfect score.

Neocortical Layer 5 Pyramidal Cell

Scripts for a more complex neocortical L5PC are in this directory

With a notebook:

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/l5pc/L5PC.ipynb (NEURON) https://github.com/BlueBrain/BluePyOpt/blob/master/examples/l5pc/L5PC_arbor.ipynb (Arbor)

Thalamocortical Cells

Scripts for 2 thalamocortical cell types are in this directory

With a notebook:

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/thalamocortical-cell/thalamocortical-cell_opt.ipynb

Tsodyks-Markram Model of Short-Term Plasticity

Scripts for 2 version of fitting the Tsodyks-Markram model to synaptic traces are in this directory

With 2 notebooks:

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/tsodyksmarkramstp/tsodyksmarkramstp.ipynb https://github.com/BlueBrain/BluePyOpt/blob/master/examples/tsodyksmarkramstp/tsodyksmarkramstp_multiplefreqs.ipynb

Exporting cell in neuroml format

An iPython notebook showing how to export a BluePyOpt cell in the neuroml format, how to create a LEMS simulation, and how to run the LEMS simulation with the neuroml cell can be found at:

https://github.com/BlueBrain/BluePyOpt/blob/master/examples/neuroml/neuroml.ipynb

API documentation

The API documentation can be found on ReadTheDocs.

Funding

This work has been partially funded by the European Union Seventh Framework Program (FP7/2007­2013) under grant agreement no. 604102 (HBP), the European Union’s Horizon 2020 Framework Programme for Research and Innovation under the Specific Grant Agreement No. 720270, 785907 (Human Brain Project SGA1/SGA2) and by the EBRAINS research infrastructure, funded from the European Union’s Horizon 2020 Framework Programme for Research and Innovation under the Specific Grant Agreement No. 945539 (Human Brain Project SGA3). This project/research was supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government’s ETH Board of the Swiss Federal Institutes of Technology.

Copyright (c) 2016-2022 Blue Brain Project/EPFL

bluepyopt's People

Contributors

alberto-antonietti avatar alejoe91 avatar alex4200 avatar andrisecker avatar anilbey avatar arnaudon avatar asanin-epfl avatar asvg avatar aurelienjaquier avatar cclauss avatar chriscurrin avatar croessert avatar danielelinaro avatar darshanmandge avatar drtada avatar helveg avatar jdcourcol avatar liesbethvanherpe avatar lkoelman avatar lukasgd avatar mgeplf avatar musicinmybrain avatar penguinpee avatar pitmonticone avatar wvangeit avatar

Stargazers

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

Watchers

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

bluepyopt's Issues

HocModel constructor signature needs to be changed

Needs to allow for:

  • hoc code should be read from string (See #143). hoc_path is not necessary anymore. Should be first argument after name.
  • we need a morph_dir argument to specify morphology directory. when this is specified morph filename in hoc can be used.
  • morph_filename, overwrite morph_filename specified in hoc
  • hoc code should not have full path to morpho anymore (only morph_filename)
  • have an argument extra_params which is a list of (e.g. Global) parameters that have to be set outside of the hoc template, like celsius / v_init etc.

We could slowly change by calling the class with the above constructor 'HocCellModel' (that should be the name anyway). Then we can phase out slowly the HocModel.

Allow user to force bound on scores

Reported by @elisabettai.
Some features (e.g. inv_time_to_first_spike when first spike is very close to start of stimulus) can create very very high scores. This confuses the algorithm.
At the moment scores that don't generate an error are not bounded (when an error occurs the score is set to 250 though).
Option should be added to EFelFeature to allow the user to force a bound on the scores, and to allow to set the value of the bound.

Optimizing channel models

@gsarma and I are working on optimization of ion channel models here for the Open Worm project, and are interested in using BluePyOpt. We reviewed your example with the HH neuron, but were wondering how we might handle an objective function constructed around channel recordings (e.g. peak and steady-state current during measurement of an IV curve). One option would be to create these objectives by hand, but are there any objective functions for this sort of purpose that are already being used with BluePyOpt, possibly for ion channel model optimizations as part of HBP? More generally, do you have any example scripts/notebooks doing ion channel model optimization?

manage the value of several 'sub'Parameter objects at the same time

Add a new subclass of Parameter, that would manage the value of several 'sub'Parameter objects at the same time.

Same global variable in the Neuron block in two or more mod files should have same values at the end of optimization.

At the moment variable alpha in the Neuron block of one mod file is defined as

NEURON {
SUFFIX kmdb
GLOBAL inf, tau,alpha
}

while in one other mod file alpha is defined as

NEURON {
SUFFIX kdr
GLOBAL ninf,taun,zetan,vhalfn,vhalfn2,zetan2,alpha
}

When we refer to the variable in the parameters.json for the optimization we refer to it as alpha_kmdb in the first case and alpha_kdr in the second case.

The two mod files are present in different sections in the morphology. Let's say one in the axonal and one in the somatic.

We would like to have the same value for all the alpha variables in the different mod files.

If we write in the json something like this

"optimized": {
"all": [
],
"axonal": [
["alpha_kmdb", 0.025, 0.15, "uniform" ]
],
"somatic": [
["alpha_kdr", 0.025, 0.15, "uniform" ]
]

the two values will have different values at the end of the optimization.

Difference between calculating the features using efel versus when using fitcalc.calculate_scores

Hi I am comparing the results of the efel vs fitcalc.calculate_scores and it seems that there is a difference.

scores = fitcalc.calculate_scores(best_responses)


import efel
import pandas as pd
trace1 = {'T': best_responses['IDRest_7.soma.v'].response['time'], 'V':best_responses['IDRest_7.soma.v'].response['voltage']}
trace1['stim_start'] = [700]
trace1['stim_end'] = [2700]
traces_results = efel.getFeatureValues([trace1],
                                ['AP_height','AP_amplitude','Spikecount','AHP_depth_abs'])


traces_results


print('IDRest_7_AHP_depth_abs')
print('manual calculation - ' + str((-69.4687143541 - traces_results[0]['AHP_depth_abs'].mean())/0.539758874442))
print('bluepyopt calculation - ' + str(scores['IDRest_7.soma.AHP_depth_abs']))

IIDRest_7_AHP_depth_abs
manual calculation : 29.24285168089122
bluepyopt calculation : 36.269754996091436

See full example in the attached zip -Show_Bug.zip - file, open Show_error.ipynb for full details,
Thanks.

Might be related to BlueBrain/eFEL#166

Including tests + licenses in release tars

Hi,

Would it be possible to please include tests and the license files in the release tars? At the moment, they are not included in the pypi release downloads.

Alternatively, if these are deemed unnecessary for the pypi tar, could the tags/releases on github please match the pypi releases so that downstream maintainers can use the sources from here?

It is currently in review for inclusion in NeuroFedora, where these issues cropped up: https://bugzilla.redhat.com/show_bug.cgi?id=1727505

scidash branch of BluePyOpt

I have created a fork of bluepyopt, that is designed to work with dask distributed instead of scoop. Also it uses model parameter dictionaries that get mapped from GA genes. It also uses error functions objective functions that are created by interfacing with neuronunit.

Since these changes, are not necessarily helpful for general use cases of BluePyOpt, I have discussed how to best integrate these changes with a colleague, and we decided to propose making a sciunit branch of BluePyOpt.

The main places where code is substantially different are:
https://github.com/russelljjarvis/BluePyOpt/blob/scidash/bluepyopt/deapext/optimisations.py#L101-#L144

and:

https://github.com/russelljjarvis/BluePyOpt/blob/scidash/bluepyopt/deapext/optimisations.py#L218-#L231

@rgerkin

Let evaluator catch exceptions

Allow users to specify in the evaluator which protocol execution exceptions don't crash bluepyopt but return a bad fitness value instead

Tag versions, add changelog, update package.json

We should add a new mechanism to improve version tracking.
We should add also a changelog file.
It should something like this:
if travis passes in master, and it's going to push to pypi, this should happen:

  • something like this should be used to create a changelog: https://github.com/vaab/gitchangelog
  • the package.json should get the latest version
  • these 2 files should be commit automatically into the main repo
  • the current version is tagged in the repo
  • the tags are pushed to the main repo
  • (maybe a github 'release' is created)

There is one chicken-and-egg problem here. The commit will change the version again. An option here would be to 'predict' that version, since it will be the current_version + 1 commit.
Another issue to look at, is how versioneer reacts if all the patch versions are tagged in the repo also.

There is a before_deploy travis block we might be able to use for this.

CVode error with SequenceProtocol.run()

Hello,

I'm having some trouble using the run function in BluePyOpt. I download multi-compartment models from Allen Brain Institute and use BluePyOpt to re-optimize the parameters. When running the optimization it appears to run fine and "optimized" parameter sets are generated by the end, however when I use the SequenceProtocol.run() function to plot the optimized models at the end, it generates errors along these lines (same error was generated across two tested models):

CVode-- At t = 0 and h = 2.11201e-11, the corrector
convergence failed repeatedly or with |h| = hmin.

CVode 0x7fb2c9cadb10 PutativePV[0].soma[0] advance_tn failed, err=-7.
err=-7
NEURON: variable step integrator error
 near line 0
 {dend[48] { pt3dadd(834.5686, 543.95477, 6.7634001, 0.43239999) }}
                                                                   ^
        fadvance()
      advance()
    step()
  continuerun(4000)
and others

This error is generated when I run it on my computer (i.e. with isolate = False) as well as on Neuroscience Gateway (i.e. with isolate = True). As suggested by the error message, CVode is enabled. When CVode is not enabled (i.e. on my computer), it appears to be running when viewing NEURON's RunControl, but the voltage never changes, despite square pulses being present in the protocol - also the voltage never actually plots in the NEURON Graph. As well the simulation actually keeps starting over to no end. In line with this, when CVode is not enabled when running the code on Neuroscience Gateway, the job reaches the time limit without completing.

From reading different entries on the NEURON forum, I get the impression that the error might might have to do with one of the MOD files, but removing each of the MOD mechanisms does not alter the error message. Also, if this were the case, I would imaging getting an error during the optimization itself, however the optimization appears to run to completion. Additionally, when running the models purely in NEURON/Python (i.e. outside of BluePyOpt), with CVode enabled and all the same MOD file mechanisms present, no error is generated, which tells me that it's not the MOD files, but in fact possibly something in the SequenceProtocol.run() function.

In case it helps, the two models that I tested my code with are the following:
http://celltypes.brain-map.org/experiment/electrophysiology/529807751
http://celltypes.brain-map.org/experiment/electrophysiology/528687520

Side note: I also tried using CellEvaluator.run_protocols on my computer, but nothing appears to happen when I do this (i.e. in the terminal it appears as though it's simulating, but looking at RunControl, nothing is changing - possibly because there is no option to input Isolate = False).

Any insight into this would be most helpful. Thanks,

Alex GM

IBEA documentation

At description of how the evolutionary algorithm works to the documentation

IPython and Map_function

I would like to run in parallel the BluePyOpt using ipyparallel.
To instantiate an bluepyopt.optimisations.DEAPOptimisation object in ipyparallel,
do I need to set a new map_function that differ from the built-in map?

In case, what kind of parallel map object do you suggest to use?

Hall of fame empty after checkpoint restore

After restoring an optimization from a checkpoint, the hall of fame object returned by DEAPoptimisation.run is empty.
The bug could be solved by returning the checkpoint loaded hall of fame in algorithms.eaAlphaMuPlusLambdaCheckpoint.

Problems installing BluePyOpt

Hey,
I'm very happy you've build this toolbox but since I have set up a python 2.7 kernel on my Jupyter Notebook I can't install BluePyOpt anymore. I've explained my problem in more detail here. I hope you guys can help!

ephys.create_hoc

Hi!
Considering that ephys.create_hoc.create_hoc allows to specify a custom template via template_filename and template_dir, it would be really great to allow additional custom arguments for rendering. For example my custom template would be the same as cell_template.jinja2 but with custom geom_nseg that requires my_custom_number param:

// the same as `cell_template.jinja2`
...
proc geom_nseg() {
  this.geom_nseg_fixed({{my_custom_number}})
}
...
// the same as `cell_template.jinja2`

Then one can use the custom template easily with:

ephys.create_hoc.create_hoc(..., my_custom_number=13)

Also can we replace template_dir and template_filename with template_filepath? It would reduce the number of args but won't change functionality.

BluePyOpt can't be installed in pip editable mode

Reported by @pineider

When installing bluepyopt from source using
pip install -e .
one gets (after importing bluepyopt):
ValueError: unknown style 'pep440-minor'

This is due to a non-default version of versioneer.py in the root of the source dir, to control the version numbering format.
Need to figure out how to fix this.

'Not disabling banner' error

Hi,

I get the following error after I run nrn = ephys.simulators.NrNSimulator() in simplecell.ipynb:

/Users/jyang/opt/anaconda3/lib/python3.7/site-packages/bluepyopt/ephys/simulators.py:75: UserWarning: Unable to find Neuron hoc shared library in /Applications/NEURON-7.7/nrn/lib/python/neuron, not disabling banner
'not disabling banner' % nrnpy_path)

Any ideas why I'm getting this error? Thanks in advance.

load morphologies from hoc files rather than swc or asc files

Hello,
I would like to optimize parameters of a single compartment from some experimental data. Instead of describing morphology in swf or asc files, I'd rather do it in a hoc file. How I can make it from one of the functions or classes provided by the bluepyopt.ephys Module?

thank

Add ability to kill neuron simulation after certain amount of time

Sometimes certian individuals in the population take a long time to evaluate.
It's necessary to provide a mechanism to kill this individuals prematurely, and possible return a bad error score.
At least two mechanisms for this should be implemented:

  • based on absolute walltime (disadvantage: walltime can e.g. depend on the compute resources)
  • based on slowest in a population, e.g. kill all individuals that take longer than 80% of the population. (disadvantage: requires sending a signal from the object that knows about the population all the way down to the evaluator/simulator.)

Make checkpointing safer

As mentioned by @Aman-A on gitter, there is a possibility of the checkpoint disappearing if (probably) something goes wrong during the write of the checkpoint. This loses all history of the optimization. We should make this a bit safer.

One option see is doing the following:

  • first write checkpoint to temporary file (just same name with extra .tmp extension?)
  • issue a copy command from tmp -> main file
  • leave the .tmp file there until the next generation

This way there are always two copies around, and the copy command is mostly more atomic.

opt_l5pc.py: problem with importing an internal module simulators.

I have tried to get started and to explore this issue by reproducing the examples in the example folder. I compiled the appropriate nmodl mechanisms with

/work/scidash/BluePyOpt/examples/l5pc/mechanisms$ nrnivmodl

I have both scoop and ipyparallel installed. However I just launch opt_l5pc.py without any flags first because it exposes the most fundamental error messages.

When I run the command:

jovyan@650b8092666a:~/work/scidash/BluePyOpt/examples/l5pc$ python opt_l5pc.py 

I get the output below. Is there particular branch of bluepyopt that contains a simulator module? If its an external module I wonder where I can get it?

Traceback (most recent call last):
  File "opt_l5pc.py", line 44, in <module>
    import l5pc_evaluator
  File "/home/jovyan/work/scidash/BluePyOpt/examples/l5pc/l5pc_evaluator.py", line 26, in <module>
    import l5pc_model  # NOQA
  File "/home/jovyan/work/scidash/BluePyOpt/examples/l5pc/l5pc_model.py", line 26, in <module>
    import bluepyopt.ephys as ephys
  File "/opt/conda/lib/python3.5/site-packages/bluepyopt-1.2.87-py3.5.egg/bluepyopt/ephys/__init__.py", line 24, in <module>
    import simulators  # NOQA
ImportError: No module named 'simulators'

Thanks.
Russell.

Update on IP information

Following up on the discussion with Werner, I am creating this ticket for changes.

  1. Copyright: Please update the information on copyright. (c) 2016-2020, Blue Brain Project/ EPFL. The last year (2020) should be updated each new year. Please make it consistent where it appears.

  2. Authors: Currently Giuseppe, JDC, Mike, Christian, and Werner are listed as authors. Please update it to reflect the current status. (<- Tanguy!)

Thank you.

Start/Restart an optimization with a deap population

Hi,
I would like to start/restart optimization with a population rather than just specifying a random seed. This would really help if after n generations I want to change the fitness function and reinitialize the optimization with the population at the n_th generation.

Thanks

BluePyOpt does not install on Python 2.7 if ipython is not installed

This is because of ipyparallel that have a dependency on ipython but I don't know how to solve it (other than installing ipython 5 manually)

Here is the end of the pip install bluepyopt output log:

Collecting ipython>=4 (from ipyparallel->bluepyopt)
  Downloading https://bbpteam.epfl.ch/repository/devpi/root/pypi/+f/eca/537aa61592aca/ipython-6.4.0.tar.gz (5.1MB)
    100% |████████████████████████████████| 5.1MB 69.6MB/s 
    Complete output from command python setup.py egg_info:
    
    IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
    Beginning with IPython 6.0, Python 3.3 and above is required.
    
    See IPython `README.rst` file for more information:
    
        https://github.com/ipython/ipython/blob/master/README.rst
    
    Python sys.version_info(major=2, minor=7, micro=12, releaselevel='final', serial=0) detected.

How to chose eta, crossing over probability and mutation probability

The class DEAPOptimisation has parameters, that affect the optimization, most importantly mutpb, cxpb and eta. How do you usually chose these parameters? I see, that they default to cxpb = 1, mutpb = 1, eta = 10. In the example of the L5PC, the default values are (implicitly) used in the toy example of 2 generations. in gaupnerbrunelstdp, eta=20, mutpb=0.3, cxpb=0.7 is used. Why? Is there a rule of thumb, which parameters give good results?

If I use 1000 individuals and 1000 generations, I see, that a feasible solution is only found in ~30% of the optimizations and I am therefore wondering, if I just choose the parameters wrong. Or is this the expected success rate?

Unit checking in EPhys parameters

Hi there,

It would be great if unit checking could be added to Ephys parameters when they are instantiated. This would be pretty easy to implement. Units of Hoc variables can be queried using h.units() (if they are defined), and Python has some great unit checking/conversion packages. I have hacked together some code that may be a good start:

import re
import pint # popular units package
from neuron import h
ureg = pint.UnitRegistry()

nrn_units = h.units(hoc_varname)
units_nodash = nrn_units.replace('-', '*') # some NEURON units are defined with dashes
units_exponents = re.sub(r'([a-zA-Z]+)(\d)',r'\1^\2', units_nodash) # adds '^' char for exponents
target_units = ureg(units_exponents)

param_quantity = ureg.Quantity(param_value, param_units_str)
try:
    converted_quantity = param_quantity.to(target_units)
except pint.errors.DimensionalityError:
    raise ValueError('incompatible units')

setattr(nrn_obj, hoc_varname, converted_quantity.magnitude)

Would something like this be possible?

Cheers,
Lucas.

Autogenerate package.json

There is at the moment a hardcoded internal BBP related file in the repo: 'package.json'.
This file should be automatically generated.
Related to:
#225

OSError: Morphology not found at 'simple.swc'

hello

When I execute on jupyter the following lines for the simplecell.ipynb example:

default_params = {'gnabar_hh': 0.1, 'gkbar_hh': 0.03}
responses = twostep_protocol.run(cell_model=simple_cell, param_values=default_params, sim=nrn)

the following error appears. I use Python 3.6 the Anaconda release on Windows.
Thanks for any help/suggestions.


RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py", line 155, in _run_func
cell_model.instantiate(sim=sim)
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\models.py", line 222, in instantiate
self.morphology.instantiate(sim=sim, icell=self.icell)
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\morphologies.py", line 91, in instantiate
self.morphology_path)
OSError: Morphology not found at 'simple.swc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Alexandra\Anaconda3\lib\multiprocessing\pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py", line 185, in _run_func
traceback.format_exception(*sys.exc_info())))
Exception: Traceback (most recent call last):
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py", line 155, in _run_func
cell_model.instantiate(sim=sim)
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\models.py", line 222, in instantiate
self.morphology.instantiate(sim=sim, icell=self.icell)
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\morphologies.py", line 91, in instantiate
self.morphology_path)
OSError: Morphology not found at 'simple.swc'

"""

The above exception was the direct cause of the following exception:

Exception Traceback (most recent call last)
in ()
1 default_params = {'gnabar_hh': 0.1, 'gkbar_hh': 0.03}
----> 2 responses = twostep_protocol.run(cell_model=simple_cell, param_values=default_params, sim=nrn)

~\Anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py in run(self, cell_model, param_values, sim, isolate)
71 param_values=param_values,
72 sim=sim,
---> 73 isolate=isolate)
74
75 key_intersect = set(

~\Anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py in run(self, cell_model, param_values, sim, isolate)
208 'cell_model': cell_model,
209 'param_values': param_values,
--> 210 'sim': sim})
211
212 pool.terminate()

~\Anaconda3\lib\multiprocessing\pool.py in apply(self, func, args, kwds)
257 '''
258 assert self._state == RUN
--> 259 return self.apply_async(func, args, kwds).get()
260
261 def map(self, func, iterable, chunksize=None):

~\Anaconda3\lib\multiprocessing\pool.py in get(self, timeout)
642 return self._value
643 else:
--> 644 raise self._value
645
646 def _set(self, i, obj):

Exception: Traceback (most recent call last):
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\protocols.py", line 155, in _run_func
cell_model.instantiate(sim=sim)
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\models.py", line 222, in instantiate
self.morphology.instantiate(sim=sim, icell=self.icell)
File "C:\Users\Alexandra\Anaconda3\lib\site-packages\bluepyopt\ephys\morphologies.py", line 91, in instantiate
self.morphology_path)
OSError: Morphology not found at 'simple.swc'

IOError: Morphology not found at 'simple.swc'

Hey,
I've managed to run BluePyOpt and Neuron on a Linux Cluster and I'm very excited to work with it! Using the example you provide here, (I basically just copy pasted everything) I get the following error:

responses = twostep_protocol.run(cell_model=simple_cell, param_values=default_params, sim=nrn) 

Exception: Traceback (most recent call last):
  File "/cm/shared/uniol/software/Python/2.7.12-intel-2016b/lib/python2.7/site-packages/bluepyopt/ephys/protocols.py", line 130, in _run_func
    cell_model.instantiate(sim=sim)
  File "/cm/shared/uniol/software/Python/2.7.12-intel-2016b/lib/python2.7/site-packages/bluepyopt/ephys/models.py", line 222, in instantiate
    self.morphology.instantiate(sim=sim, icell=self.icell)
  File "/cm/shared/uniol/software/Python/2.7.12-intel-2016b/lib/python2.7/site-packages/bluepyopt/ephys/morphologies.py", line 91, in instantiate
    self.morphology_path)
IOError: Morphology not found at 'simple.swc'

Do you know how I can check where 'simple.swc' is stored and how I can tell python to grap it?

Create test that runs L5PC optimisation

Atm the L5PC test only creates and runs the template and imports the optimisation.
There should be a functionality test that runs a tiny optimisation (using scoop).

Hey maintainers!

I am interested in this project and have worked on few such things before. I wanted this as a side project working in free time. I asked few questions on tickets, I think mostly minor inputs, do you accept contributions from people outside the organisation? Please let me know. I just felt weird w/ the lack of communication from an open source project.

'hoc.HocObject' object has no attribute 'instatiate'

Hello

I use a hoc cell template with Bluepyopt, called 'class_axoaxoniccell_temp.hoc' attached below, and I run into the following issue when I run my bluepyopt script 'test.py' using my hoc cell template.
error:

  File "/usr/local/lib/python2.7/dist-packages/bluepyopt/ephys/locations.py", line 205, in instantiate
    isectionlist = getattr(icell, self.seclist_name)
AttributeError: 'hoc.HocObject' object has no attribute 'soma_list'

According to locations.py in ephys, 'hoc.HocObject namely 'icell' reflects 'my_cell[0]' in my case. 'my_cell[0]' does have a soma_list attribute which can be found in the hoc code. If for example I explicitly define "somatic_loc=my_cell.soma_list" in the python script, then the code runs just fine, it is when I define somatic_loc using the "class NrnSeclistLocation" as shown in the python script below, that I get the error mentioned above. To me both methods should ultimately call the same object: "my_cell.soma_list" but they don't. Any help with this would be much appreciated.

thank you,
Alexandra

test.py:

"""Expsyn synapse parameter fitting"""

# pylint: disable=R0914

import os

import bluepyopt as bpopt
import bluepyopt.ephys as ephys
import neuron
from neuron import h, gui
import matplotlib.pyplot as plt

h.load_file('class_axoaxoniccell_temp.hoc')
my_cell=h.axoaxoniccell_temp()

morph = ephys.morphologies.NrnFileMorphology('class_axoaxoniccell_temp.hoc') 

somatic_loc = ephys.locations.NrnSeclistLocation('somatic', seclist_name='soma_list')
basal_loc = ephys.locations.NrnSeclistLocation('basal', seclist_name='basal_list')
axonal_loc = ephys.locations.NrnSeclistLocation('axonal', seclist_name='axonal_list')

soma_loc=my_cell.soma[0]
#somatic_loc=my_cell.soma_list  #alternatively if I use this line it works 

ch_KvA_mech = ephys.mechanisms.NrnMODMechanism(
     name='ch_KvA',
     suffix='ch_KvA',
     locations=[soma_loc])#[somatic_loc])
# Non-Frozen Mechanism Parameters
gmax_ch_KvA_param = ephys.parameters.NrnSectionParameter(
    name ='gmax_ch_KvA',
    param_name ='gmax_ch_KvA',
    locations = [somatic_loc],
    value = h.axoaxoniccell_temp().gKvA,
    bounds=[0.00005, 0.00055],
    frozen = False
)

simple_cell = ephys.models.CellModel(
        name='my_cell',
        morph=morph,
        mechs=[ch_KvA_mech],
        params=[gmax_ch_KvA_param])
.....etc

class_axoaxonicell_temp.hoc

begintemplate axoaxoniccell_temp
public init, connect_sections, size_sections, append_sections, define_synapses
public mechinit, insert_mechs, set_biophys, get_root
public pre_list, connect_pre, is_art, is_connected, gid, randi
public soma, dend
public all, basal_list, apical_list, soma_list, axon_list, dendrite_list
public x, y, z, position, myroot, myrootsec, Vrest
public NumSoma, NumApical, NumBasal, NumAxon
public ExpSyn
public celsius


// strings
strdef myroot

// objects
objref syn, pre_list, templist, rootlist, myrootsec, this

// external variables
//external numCellTypes, cellType

// create the sections[segments]
NumSoma=1
NumApical=16
NumBasal=0
NumAxon=0

create soma[NumSoma], dend[NumApical]

proc init() {
        gid = 1
        randi = 2

        // morphology
        connect_sections()      // local fcn: connect soma, dendrites, axon initial segment
        size_sections()         // local fcn: set the size dimensions of each section
        define_shape()          // builtin fcn: fill in 3d info for sections defined by only L and diam, translate 3d points for consistency with their connections
        append_sections()       // local fcn: append all sections to the section list
        set_nseg()                      // local fcn: set the number of segments in each section
        get_root()                      // local fcn: perform morphology checks

        // electrophysiology
        mechinit()                      // local fcn: set values for max conductances and reversal potentials of ion channels and other ephys parameters that are subject to fitting
        insert_mechs()          // local fcn: insert ion channels and actually set values determined in the mechinit fcn
        set_chanparams()        // local fcn: after all channels have been inserted, then their other parameters can be set

        // synapses
        //pre_list = new List() // define a list for the presynaptic connections
        //define_synapses($3)   // local fcn: define all possible synaptic connections received by this cell
        NumSoma=1
        celsius = 37
}
......etc

ENH: support .hoc format for morphologies

I've been trying to follow these two examples:

examples/simplecell/simplecell.ipynb
examples l5pc/L5PC.ipynb

However, I cannot load the morphology with the ephys.morphologies.NrnFileMorphology method as it only supports the .asc and .swc format.

(How) can a morphology described in the .hoc format be used within BluePyOpt?

Tutorial / Wiki / Guide

Hey again,
I wanted to ask whether you can recommend any sort of documentation, tutorial or guide for BluePyOpt? I went through your simple cell example and now I wonder where I can find ressources if I want to adapt the code to my needs. I wanted to start understanding bpop.optimisations.DEAPOptimisation() for example but the only wiki I found was pretty empty.

Example in Quick Start needs to be updated

I was following alone the optimization set up in the jupyter notebook in Quick Start, and this happened

opt_issue1

Either DEAPOptimization is deprecated or the example has a typo.

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.