Git Product home page Git Product logo

Comments (4)

kaeldai avatar kaeldai commented on May 27, 2024

@crohlicek I created a branch + bionet example that should record all the mechanism states and parameters from the soma of the cells. You'll need to pull the feature/record_mechanisms branch; if you running from the source code:
$ git fetch && get checkout feature/record_mechanisms

or using pip
$ pip install --upgrade git+https://github.com/AllenInstitute/bmtk@feature/record_mechanisms

Then try running the example simulation under docs/examples/bio_record_mechanisms/. If everything runs correctly then in the output/ folder you should see a bunch of csv files titled cell.<mechanism_name>.csv; where is the cell node_id and <mechanism_name> is for one of the compiled mechanism mod files found here. Each column in the csv will have the trace of a state/parameter variable throughout the simulation and can be read using pandas pd.read_csv('output/cell0.Ih.csv', sep=' ', index=False).

If you're able to get it working you can copy the "record_mechanisms" section of config.json to your own simulation config. Let me know if you run into any issues.

from bmtk.

crohlicek avatar crohlicek commented on May 27, 2024

@kaeldai Thank you so much for making this branch, but I have a couple of questions. First, about running the example simulation, I got the following error when I pip installed the branch and downloaded all the files from the rubdirectory (this followed a call to python run_bionet.py config.json):

2020-09-19 11:23:44,668 [INFO] Created log file
NEURON mechanisms not found in /Users/chris/Documents/Brown/Research/allen_bmtk_record_test/bio_record_mechanisms/../biophys_components/mechanisms.
2020-09-19 11:23:44,752 [ERROR] Could not find node dynamics_params file /Users/chris/Documents/Brown/Research/allen_bmtk_record_test/bio_record_mechanisms/../biophys_components/biophysical_neuron_templates/472363762_fit.json.
Traceback (most recent call last):
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/site-packages/bmtk/simulator/core/sonata_reader/node_adaptor.py", line 157, in preprocess_node_types
    params_val = json.load(open(params_path, 'r'))
FileNotFoundError: [Errno 2] No such file or directory: '/Users/chris/Documents/Brown/Research/allen_bmtk_record_test/bio_record_mechanisms/../biophys_components/biophysical_neuron_templates/472363762_fit.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run_bionet.py", line 18, in <module>
    run(sys.argv[-1])
  File "run_bionet.py", line 10, in run
    graph = bionet.BioNetwork.from_config(conf)
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/site-packages/bmtk/simulator/core/simulator_network.py", line 246, in from_config
    network.add_nodes(node_pop)
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/site-packages/bmtk/simulator/bionet/bionetwork.py", line 115, in add_nodes
    super(BioNetwork, self).add_nodes(node_population)
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/site-packages/bmtk/simulator/core/simulator_network.py", line 91, in add_nodes
    node_population.initialize(self)
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/site-packages/bmtk/simulator/core/sonata_reader/network_reader.py", line 61, in initialize
    self._adaptor.preprocess_node_types(network, self._node_pop)
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/site-packages/bmtk/simulator/core/sonata_reader/node_adaptor.py", line 161, in preprocess_node_types
    network.io.log_exception('Could not find node dynamics_params file {}.'.format(params_path))
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/site-packages/bmtk/simulator/core/io_tools.py", line 109, in log_exception
    raise Exception(message)
Exception: Could not find node dynamics_params file /Users/chris/Documents/Brown/Research/allen_bmtk_record_test/bio_record_mechanisms/../biophys_components/biophysical_neuron_templates/472363762_fit.json.

Does the above look like an error with how I'm running the example simulation? I tried running it with exactly the contents of the subdirectory you attached but the error looks as though I need to include some other files.

Separately, I tried copying the "record_mechanisms" into the configuration file of my original simulation (making the right substitutions for the way that model is defined) and got this error:

Traceback (most recent call last):
  File "run_bionet.py", line 21, in <module>
    run(sys.argv[-1])
  File "run_bionet.py", line 14, in run
    sim = bionet.BioSimulator.from_config(conf, network=graph)
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/site-packages/bmtk/simulator/bionet/biosimulator.py", line 500, in from_config
    mod = mods.SpikesMod(**report.params)
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/site-packages/bmtk/simulator/bionet/modules/record_spikes.py", line 61, in __init__
    cache_name = os.path.basename(self._h5_fname or self._csv_fname or self._nwb_fname)
  File "/opt/anaconda3/envs/sim_env/lib/python3.6/posixpath.py", line 146, in basename
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Let me know if these errors point to any simple fix that I'm missing -- thanks again!

from bmtk.

kaeldai avatar kaeldai commented on May 27, 2024

Hi @crohlicek - it looks like you're missing the biophys_components/ directory. You'll need to download all the subdirectories otherwise bmtk/NEURON won't be able to find the cell/synapse/mechanism files. If you have downloaded it but it's in a different location on your computer, you can change the config.json file's $COMPONENT_DIR value in the "manifest" section.

You'll also need to (re)-compile the mechanism mod files using NEURON (in the tutorial it's done automatically).

$ cd biophys_components/mechanisms
$ nrnivmodl modfiles/

Hopefully after that it should be ready to run.

from bmtk.

crohlicek avatar crohlicek commented on May 27, 2024

Hi @kaeldai, thanks again for all of this great help -- I took a winding research detour but am back to sorting out a way of getting the full bmtk ODE output and have another question. I've just gone back through your instructions above and tried again to run everything, but I'm running into issues with the config file in this directory not being able to find the spike inputs in this directory. I'm trying to chase down the paths given in the config file but I'm actually finding that I can't see any spike .h5 files in the biophys_components directory. Are the spike inputs that the config file tries to link to (first the lgn spikes and then the tw spikes) located somewhere else where I might be able to find them or is there another way to generate them?

from bmtk.

Related Issues (20)

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.