示例#1
0
import arbor
from arbor import mechanism as mech
from arbor import location as loc
import pandas, seaborn
import sys

# Load a cell morphology from an nml file.
# Example present here: morph.nml
if len(sys.argv) < 2:
    print("No NeuroML file passed to the program")
    sys.exit(0)

filename = sys.argv[1]

# Read the NeuroML morphology from the file.
morpho_nml = arbor.neuroml(filename)

# Read the morphology data associated with morphology "m1".
morpho_data = morpho_nml.morphology("m1")

# Get the morphology.
morpho = morpho_data.morphology

# Get the region label dictionaries associated with the morphology.
morpho_segments = morpho_data.segments()
morpho_named = morpho_data.named_segments()
morpho_groups = morpho_data.groups()

# Create new label dict add to it all the NeuroML dictionaries.
labels = arbor.label_dict()
labels.append(morpho_segments)
import arbor
import numpy as np
import matplotlib.pyplot as plt

cell_id = 'BallAndStick'
nml = arbor.neuroml('%s.cell.nml' % cell_id)

cell_ids = nml.cell_ids()
morpho_data = nml.cell_morphology(cell_id)
morpho = morpho_data.morphology

# Get the region label dictionaries associated with the morphology.
morpho_segments = morpho_data.segments()
morpho_named = morpho_data.named_segments()  # (label_dict)
morpho_groups = morpho_data.groups()

# Create new label dict add to it all the NeuroML dictionaries.
labels = arbor.label_dict()
labels.append(morpho_segments)
labels.append(morpho_named)
labels.append(morpho_groups)

print(nml)
# >>> print([reg for reg in labels.regions if not reg.isdigit()])
# ['all', 'soma_group', 'dendrite_group', 'axon_group', ...]

# Add locsets to the label dictionary.
labels['stim_site'] = '(location 0 0.5)'  # site for the stimulus
#labels['axon_end']  = '(restrict (terminal) (region "axon_group"))' # end of the axon.
labels[
    'dend_end'] = '(restrict (terminal) (region "dendrite_group"))'  # end of the axon.