Ejemplo n.º 1
0
def add_lamina_LPU(config, i, lamina, manager):
    output_filename = config["Lamina"]["output_file"]
    gexf_filename = config["Lamina"]["gexf_file"]
    suffix = config["General"]["file_suffix"]

    dt = config["General"]["dt"]
    debug = config["Lamina"]["debug"]
    time_sync = config["Lamina"]["time_sync"]

    output_file = "{}{}{}.h5".format(output_filename, i, suffix)
    gexf_file = "{}{}{}.gexf.gz".format(gexf_filename, i, suffix)
    G = lamina.get_graph()
    nx.write_gexf(G, gexf_file)

    n_dict_ret, s_dict_ret = LPU.lpu_parser(gexf_file)
    lamina_id = get_lamina_id(i)
    modules = []
    manager.add(
        LPU,
        lamina_id,
        dt,
        n_dict_ret,
        s_dict_ret,
        input_file=None,
        output_file=output_file,
        device=2 * i + 1,
        debug=debug,
        time_sync=time_sync,
        modules=modules,
        input_generator=None,
    )
Ejemplo n.º 2
0
def add_lamina_LPU(config, i, lamina, manager):
    '''
        This method adds Lamina LPU and its parameters to the manager
        so that it can be initialized later.

        --
        config: configuration dictionary like object
        i: identifier of eye in case more than one is used
        lamina: lamina array object required for the generation of
            graph.
        manager: manager object to which LPU will be added
        generator: generator object or None
    '''

    output_filename = config['Lamina']['output_file']
    gexf_filename = config['Lamina']['gexf_file']
    suffix = config['General']['file_suffix']

    dt = config['General']['dt']
    debug = config['Lamina']['debug']
    time_sync = config['Lamina']['time_sync']

    output_file = '{}{}{}.h5'.format(output_filename, i, suffix)
    gexf_file = '{}{}{}.gexf.gz'.format(gexf_filename, i, suffix)
    G = lamina.get_graph()
    nx.write_gexf(G, gexf_file)

    n_dict_ret, s_dict_ret = lLPU.lpu_parser(gexf_file)
    lamina_id = get_lamina_id(i)
    modules = []
    manager.add(lLPU, lamina_id, dt, n_dict_ret, s_dict_ret,
                input_file=None, output_file=output_file,
                device=2*i+1, debug=debug, time_sync=time_sync,
                modules=modules, input_generator=None)