Code Monkey home page Code Monkey logo

bsb-core's Issues

Make morphology repository config attribute folder independent

Currently the morphology_repository attribute is problematic: It looks for the specified file relative to the cwd and not to where the configuration was found or some other sane behavior, so when you compile from another folder it won't find the morphology repository anymore

Divergence check

For some connections, divergence values are not used for connectivity (e.g. for IO to PC connections), but it should be checked and a warning should be thrown.

  • For IO to PC values see Helveg/cerebellum-scaffold#104.

  • For PC-DCN: "Because 30โ€“50 Purkinje cells converge onto each CbN cell (Person & Raman, 2012a), the number of inhibitory inputs was held constant at 40 in all experiments." [https://physoc.onlinelibrary.wiley.com/doi/pdf/10.1113/JP274321]

Options module

Currently the global CLI arguments are position specific and there's no unified way access global scaffold settings. It would be better that there's an options module where the values of singleton settings can be read from and stored in from 3 sources:

  • environment variables
  • cli arguments
  • set by script bsb.options.verbosity = 2?
class Options(types.ModuleType):
  verbosity = IntegerOption(cli=("verbosity", "v"), env="BSB_VERBOSITY", default=1)
  log = StringOption(cli=("log", "l"), env="BSB_LOG")

sys.modules[__name__] = Options()

Error with GolgiAxonFix(PostProcessingHook)

File "/home/alberto/workspace/cerebellum-scaffold/scaffold/postprocessing.py", line 263, in after_connectivity
    compartment_matrix = self.scaffold.connection_compartments[tag]
KeyError: 'golgi_to_glomerulus'

Even if using "detailed" for golgi_to_glomerulus:

"golgi_to_glomerulus": {
      "class": "scaffold.connectivity.ConnectomeGolgiGlomerulus",
      "from_cell_types": [{"type": "golgi_cell", "compartments": ["axon"]}],
      "to_cell_types": [{"type": "glomerulus", "compartments": ["soma"]}],
      "divergence": 40,
      "detailed": true
    },

Re-enable tests with old mouse_cerebellum.json

Tests are being skipped to allow #494 to merge. We should:

A) Check if we can do weekly builds and tests of full scale networks that we can then cache on Travis, or upload as build artifacts to possibly Amazon AWS or our own cluster?

B) Re-enable push and branch testing by using the old mouse_cerebellum.json as basis for these smaller per-commit tests

Error with GolgiAxonFix(PostProcessingHook)

File "/home/alberto/workspace/cerebellum-scaffold/scaffold/postprocessing.py", line 263, in after_connectivity
    compartment_matrix = self.scaffold.connection_compartments[tag]
KeyError: 'golgi_to_glomerulus'

Even if using "detailed" for golgi_to_glomerulus:

"golgi_to_glomerulus": {
      "class": "scaffold.connectivity.ConnectomeGolgiGlomerulus",
      "from_cell_types": [{"type": "golgi_cell", "compartments": ["axon"]}],
      "to_cell_types": [{"type": "glomerulus", "compartments": ["soma"]}],
      "divergence": 40,
      "detailed": true
    },

Add `as_cache` method to the MR API

as_cache should return an empty MorphologyCache based on the MR. MorphologyCaches should produce singleton morphologies that are immutable by default.

NEURON is needed at compilation time

Usecase:

The user wants to compile an hdf5 exploiting the morphologies, but it does not want to simulate it in NEURON and does not have NEURON installed.

Actual behaviour:

The user has to remove from the json the"NEURON" simulation part.

Desired behaviour:

The compilation should in principle work even if NEURON is not installed.

Re-enable tests with old mouse_cerebellum.json

Tests are being skipped to allow #494 to merge. We should:

A) Check if we can do weekly builds and tests of full scale networks that we can then cache on Travis, or upload as build artifacts to possibly Amazon AWS or our own cluster?

B) Re-enable push and branch testing by using the old mouse_cerebellum.json as basis for these smaller per-commit tests

Renamed the `scaffold` package to the `bsb` package

Describe the work done

  • The setup now produces a wheel named bsb
  • The console_script entry point is renamed to bsb (so the command is bsb compile instead of scaffold compile)
  • The package source directory has been renamed to bsb
  • Imports should import the bsb module instead of the scaffold module.
  • Removed the obfuscation module. Since the package will go public we don't need to encrypt our public releases anymore.

Migration

Users (which we don't have) need to uninstall the dbbs-scaffold package and pip install bsb instead.

Developers need to run pip install -e . from the git repo root to register the new bsb command and change all from scaffold/ import scaffold statements to from bsb/import bsb

List which issues this resolves:

Closes #482

Tasks

  • Added tests
  • Updated documentation

NEURON is needed at compilation time

Usecase:

The user wants to compile an hdf5 exploiting the morphologies, but it does not want to simulate it in NEURON and does not have NEURON installed.

Actual behaviour:

The user has to remove from the json the"NEURON" simulation part.

Desired behaviour:

The compilation should in principle work even if NEURON is not installed.

Unbuffered reporting

In order to print output during an MPI process stdout needs to operate in unbuffered mode. The reporting module can overwrite stdout if MPI is present.

ConnectionSet optimization for multiple synaptic contacts in point neuron simulators

Since point neuron models ignore any compartments given, there are many duplicate entries between the same neuron pairs in connectivity sets created with detailed connectivity strategies. To optimize, a reduced dataset with unique pairs and a parallel dataset with the amount of times they occur could be provided.

Impact on ConnectivitySet

The ConnectivitySets get_intersection method should be adapted to incorporate a get_intersection_iterator.

Impact on NEST adapter

Multi-contact connections are created only once. Unitary weights are tuned to get the right population firing rates, and then multiplied by the synaptic contact multiplicity to get the single connection weight (population weight will be an array)

Impact on NEURON adapter

None, the get_intersections function should produce the same result. To optimize, we should switch to the get_intersection_iterator to reduce memory footprint.

mpiexec virtual processes nest ERROR

  File "/home/claudia/.local/bin/scaffold", line 11, in <module>
    load_entry_point('dbbs-scaffold', 'console_scripts', 'scaffold')()
  File "/home/claudia/cerebellum-scaffold/scaffold/cli.py", line 26, in scaffold_cli
    start_cli()
  File "/home/claudia/cerebellum-scaffold/scaffold/cli.py", line 238, in start_cli
    scaffoldInstance.run_simulation(cl_args.simulation, quit=True)
  File "/home/claudia/cerebellum-scaffold/scaffold/core.py", line 381, in run_simulation
    simulation, simulator = self.prepare_simulation(simulation_name)
  File "/home/claudia/cerebellum-scaffold/scaffold/core.py", line 415, in prepare_simulation
    simulator = simulation.prepare()
  File "/home/claudia/cerebellum-scaffold/scaffold/simulators/nest.py", line 328, in prepare
    self.reset_kernel()
  File "/home/claudia/cerebellum-scaffold/scaffold/simulators/nest.py", line 418, in reset_kernel
    self.set_threads(self.threads)
  File "/home/claudia/cerebellum-scaffold/scaffold/simulators/nest.py", line 458, in set_threads
    "total_num_virtual_procs": virtual,
  File "/home/claudia/nest-simulator-2.18.0-build/lib/python3.6/site-packages/nest/ll_api.py", line 246, in stack_checker_func
    return f(*args, **kwargs)
  File "/home/claudia/nest-simulator-2.18.0-build/lib/python3.6/site-packages/nest/lib/hl_api_simulation.py", line 243, in SetKernelStatus
    sr('SetStatus')
  File "/home/claudia/nest-simulator-2.18.0-build/lib/python3.6/site-packages/nest/ll_api.py", line 132, in catching_sli_run
    raise exceptionCls(commandname, message)
nest.ll_api.BadProperty: ('BadProperty in SetStatus_id: Number of virtual processes (threads*processes) must be an integer multiple of the number of processes. Value unchanged.', 'BadProperty', <SLILiteral: SetStatus_id>, ': Number of virtual processes (threads*processes) must be an integer multiple of the number of processes. Value unchanged.')

Can't load default config from outside repository

In [2]: conf = JSONConfig()  # loads the default config which has granule & golgi configured
   ...: scaffold = Scaffold(conf)
   ...: 
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-2-6bd56f02d068> in <module>()
      1 conf = JSONConfig()  # loads the default config which has granule & golgi configured
----> 2 scaffold = Scaffold(conf)

/home/stefano/Documenti/cerebellum-scaffold/scaffold/core.py in __init__(self, config, from_file)
     74         # Use the configuration to initialise all components such as cells and layers
     75         # to prepare for the network architecture compilation.
---> 76         self._intialise_components()
     77         self._intialise_simulators()
     78 

/home/stefano/Documenti/cerebellum-scaffold/scaffold/core.py in _intialise_components(self)
    117         self._initialise_morphologies()
    118         self._initialise_placement_strategies()
--> 119         self._initialise_connection_types()
    120         self._initialise_simulations()
    121         self._initialise_hooks()

/home/stefano/Documenti/cerebellum-scaffold/scaffold/core.py in _initialise_connection_types(self)
    166     def _initialise_connection_types(self):
    167         for connection_type in self.configuration.connection_types.values():
--> 168             connection_type.initialise(self)
    169             # Wrap the connect function.
    170             connection_type._wrap_connect()

/home/stefano/Documenti/cerebellum-scaffold/scaffold/helpers.py in initialise(self, scaffold)
     51         self.cast_config()
     52         self.boot()
---> 53         self.validate()
     54 
     55     def boot(self):

/home/stefano/Documenti/cerebellum-scaffold/scaffold/connectivity/connectome/glomerulus_granule.py in validate(self)
     26                 )
     27             mr = self.scaffold.morphology_repository
---> 28             morphology = mr.get_morphology(morphologies[0])
     29             dendritic_compartments = morphology.get_compartments(["dendrites"])
     30             dendrites = {}

/home/stefano/Documenti/cerebellum-scaffold/scaffold/output.py in get_morphology(self, name, scaffold)
    443             Load a morphology from repository data
    444         """
--> 445         with self.load() as handler:
    446             # Check if morphology exists
    447             if not self.morphology_exists(name):

/usr/lib/python3.6/contextlib.py in __enter__(self)
     79     def __enter__(self):
     80         try:
---> 81             return next(self.gen)
     82         except StopIteration:
     83             raise RuntimeError("generator didn't yield") from None

/home/stefano/Documenti/cerebellum-scaffold/scaffold/output.py in load(self, mode)
     29             if self._handle is not None:
     30                 self.release_handle(self._handle)
---> 31             self._handle = self.get_handle(mode)
     32 
     33         def handler():

/home/stefano/Documenti/cerebellum-scaffold/scaffold/output.py in get_handle(self, mode)
    238         """
    239         # Open a new handle to the HDF5 resource.
--> 240         handle = HDF5TreeHandler.get_handle(self, mode)
    241         if handle.mode != "r":
    242             # Repository structure missing from resource? Create it.

/home/stefano/Documenti/cerebellum-scaffold/scaffold/output.py in get_handle(self, mode)
     68         """
     69         # Open a new handle to the resource.
---> 70         return h5py.File(self.file, mode)
     71 
     72     def release_handle(self, handle):

/home/stefano/.local/lib/python3.6/site-packages/h5py/_hl/files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, rdcc_w0, track_order, **kwds)
    406                 fid = make_fid(name, mode, userblock_size,
    407                                fapl, fcpl=make_fcpl(track_order=track_order),
--> 408                                swmr=swmr)
    409 
    410             if isinstance(libver, tuple):

/home/stefano/.local/lib/python3.6/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
    171         if swmr and swmr_support:
    172             flags |= h5f.ACC_SWMR_READ
--> 173         fid = h5f.open(name, flags, fapl=fapl)
    174     elif mode == 'r+':
    175         fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (unable to open file: name = 'morphologies.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Add `as_cache` method to the MR API

as_cache should return an empty MorphologyCache based on the MR. MorphologyCaches should produce singleton morphologies that are immutable by default.

Reporting rework (+ remove report file)

The report module requires a slight refactoring so that report listeners can be added. Reporting to screen should then be added as a default report listener. This should improve the design for a variety of future logging functions (better than the messy report file which is mostly obsolete when #495 is implemented)

Unbuffered reporting

In order to print output during an MPI process stdout needs to operate in unbuffered mode. The reporting module can overwrite stdout if MPI is present.

ConnectionSet optimization for multiple synaptic contacts in point neuron simulators

Since point neuron models ignore any compartments given, there are many duplicate entries between the same neuron pairs in connectivity sets created with detailed connectivity strategies. To optimize, a reduced dataset with unique pairs and a parallel dataset with the amount of times they occur could be provided.

Impact on ConnectivitySet

The ConnectivitySets get_intersection method should be adapted to incorporate a get_intersection_iterator.

Impact on NEST adapter

Multi-contact connections are created only once. Unitary weights are tuned to get the right population firing rates, and then multiplied by the synaptic contact multiplicity to get the single connection weight (population weight will be an array)

Impact on NEURON adapter

None, the get_intersections function should produce the same result. To optimize, we should switch to the get_intersection_iterator to reduce memory footprint.

Plot wrapping

Describe the work done

More plotting functions now return their produced figs, and fixed some other small bugs. PSTHs can now be stacked.

Make morphology repository config attribute folder independent

Currently the morphology_repository attribute is problematic: It looks for the specified file relative to the cwd and not to where the configuration was found or some other sane behavior, so when you compile from another folder it won't find the morphology repository anymore

MLI-PC microzone segregation

SC and BC (not labelled) should be connected to PC (labelled) implicitly respecting the microzone division.
In the current neuron.json scaffold the segregation is ok, but we should check that this is consistent with morphologies orientations:

image

Divergence check

For some connections, divergence values are not used for connectivity (e.g. for IO to PC connections), but it should be checked and a warning should be thrown.

  • For IO to PC values see #104.

  • For PC-DCN: "Because 30โ€“50 Purkinje cells converge onto each CbN cell (Person & Raman, 2012a), the number of inhibitory inputs was held constant at 40 in all experiments." [https://physoc.onlinelibrary.wiley.com/doi/pdf/10.1113/JP274321]

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.