Exemple #1
0
def _try_arb_morpho(path):
    import arbor

    try:
        morfo = arbor.load_swc_arbor(path)
        labels = arbor.label_dict({})
    except:
        try:
            m = arbor.load_asc(path)
        except:
            raise IOError(f"Can't load '{path}' as an SWC or ASC morphology.")
        morfo, labels = m.morphology, m.labels
    return morfo, labels
import sys
from arbor import mechanism as mech

#(1) Creat a cell.

# Create the morphology

# Read the SWC filename from input
# Example from docs: single_cell_detailed.swc

if len(sys.argv) < 2:
    print("No SWC file passed to the program")
    sys.exit(0)

filename = sys.argv[1]
morph = arbor.load_swc_arbor(filename)

# Create and populate the label dictionary.

labels = arbor.label_dict()

# Regions:

labels['soma'] = '(tag 1)'
labels['axon'] = '(tag 2)'
labels['dend'] = '(tag 3)'
labels['last'] = '(tag 4)'

labels['all'] = '(all)'

labels['gt_1.5'] = '(radius-ge (region "all") 1.5)'
Exemple #3
0
tree = arbor.segment_tree()
tree.append(mnpos, mpoint(-3.0, 0.0, 0.0, 3.0),   mpoint( 3.0, 0.0, 0.0, 3.0), tag=1)
tree.append(0,     mpoint( 3.0,  0.0,  0.0, 0.6), mpoint(9.0,-1.0,  0.0, 0.5), tag=3)
tree.append(1,     mpoint(14.0,  0.0,  0.0, 0.5), tag= 3)
tree.append(2,     mpoint(17.0, -4.0,  0.0, 0.3), tag= 3)
tree.append(2,     mpoint(19.0,  3.0,  0.0, 0.3), tag= 3)
tree.append(0,     mpoint( 3.0,  0.0,  0.0, 0.6), mpoint(13.0, 3.0,  0.0, 0.5), tag=3)
tree.append(5,     mpoint(19.0,  3.0,  0.0, 0.3), tag= 3)
tree.append(5,     mpoint(17.0,  8.0,  0.0, 0.1), tag= 3)
tree.append(mnpos, mpoint(-3.0,  0.0,  0.0, 1.5), mpoint(-5.5,-0.2,  0.0, 0.5), tag=2)
tree.append(8,     mpoint(-14.5,-0.1,  0.0, 0.5), tag=2)
ysoma_morph3 = arbor.morphology(tree)

fn = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__), "../concepts/example.swc"))
swc_morph = arbor.load_swc_arbor(fn)

regions  = {
            'empty': '(nil)',
            'all': '(all)',
            'tag1': '(tag 1)',
            'tag2': '(tag 2)',
            'tag3': '(tag 3)',
            'tag4': '(tag 4)',
            'soma': '(region "tag1")',
            'axon': '(region "tag2")',
            'dend': '(join (region "tag3") (region "tag4"))',
            'radlt5': '(radius-lt (all) 0.5)',
            'radle5': '(radius-le (all) 0.5)',
            'radgt5': '(radius-gt (all) 0.5)',
            'radge5': '(radius-ge (all) 0.5)',
Exemple #4
0
            arbor.cable_probe_membrane_voltage_cell(),
            arbor.cable_probe_total_current_cell(),
            arbor.cable_probe_stimulus_current_cell()
        ]


# Read the SWC filename from input
# Example from docs: single_cell_detailed.swc
if len(sys.argv) < 2:
    print("No SWC file passed to the program")
    sys.exit(0)

filename = sys.argv[1]

# define morphology (needed for arbor.place_pwlin)
morphology = arbor.load_swc_arbor(filename)

# number of CVs per branch
nseg = 3

# Label dictionary
defs = {}
labels = arbor.label_dict(defs)

# decor
decor = arbor.decor()

# set initial voltage, temperature, axial resistivity, membrane capacitance
decor.set_property(
    Vm=-65,  # Initial membrane voltage [mV]
    tempK=300,  # Temperature [Kelvin]