Пример #1
0
def _generate_cell_indices_seg_ids(pop_id, indices_segids, network):

    a = {}
    pop = network.get_child(pop_id, 'populations')

    if not isinstance(indices_segids, str) or not ':' in indices_segids:
        seg_ids = None
        indices = indices_segids
    else:
        indices = indices_segids.split(':')[0]
        seg_id_info = indices_segids.split(':')[1]
        l = parse_list_like(seg_id_info)
        print_v('Parsed %s as %s'%(seg_id_info, l))
        seg_ids = l

    if indices=='*':
        size = evaluate(pop.size, network.parameters)
        for index in range(size):
            a[index] = seg_ids
    else:
        l = parse_list_like(indices)
        print_v('Parsed %s (full: %s) as %s'%(indices,indices_segids, l))
        for index in l:
            a[index] = seg_ids
    return a
Пример #2
0
def load_network_json(filename):

    data = load_json(filename)

    print_v("Loaded network specification from %s" % filename)

    net = Network()
    net = _parse_element(data, net)

    return net
Пример #3
0
def load_network_json(filename):
    """
    Load a NeuroMLlite network JSON file
    """

    data = load_json(filename)

    print_v("Loaded network specification from %s"%filename)

    net = Network()
    net = _parse_element(data, net)

    return net
Пример #4
0
def load_simulation_json(filename):
    import json

    with open(filename, 'r') as f:

        data = json.load(f, object_hook=ascii_encode_dict)

    print_v("Loaded simulation specification from %s" % filename)

    sim = Simulation()
    sim = _parse_element(data, sim)

    return sim