Exemplo n.º 1
0
def main():
    if not os.path.isdir(save_path):
        os.mkdir(save_path)
    process = 6
    main = Main(process)
    main.form_parm()

    for i in range(0, main.cycle_multiproc):

        pool = Pool(process)
        cb = pool.map(main.simulate, range(process))

        # for recording
        tmp = []
        for k in range(process):
            tmp.append(cb[k].numneu)

        print(main.multiproc_co)
        main.multiproc_co += process

        # record
        for k, j in itertools.product(range(process), range(tmp[k])):
            d = datetime.datetime.today()

            # generate file name
            cb[k].parm_dict = str(cb[k].parm_dict)
            cb[k].parm_dict = cb[k].parm_dict.replace(':', '_')
            cb[k].parm_dict = cb[k].parm_dict.replace('{', '_')
            cb[k].parm_dict = cb[k].parm_dict.replace('}', '_')
            cb[k].parm_dict = cb[k].parm_dict.replace('\'', '')
            cb[k].parm_dict = cb[k].parm_dict.replace(',', '_')
            filename = (str(d.year) + '_' + str(d.month) + '_' + str(d.day) +
                        '_' + str(d.hour) + '_' + str(d.minute) + '_' +
                        str(d.second) + '_' + cb[k].parm_dict + '_' + 'N' +
                        str(j) + '_' + "HR.csv")

            df = pd.DataFrame({
                't': cb[k].tmhist,
                'Iext': cb[k].Iext[j, 1],
                'x': cb[k].x[j],
                'y': cb[k].y[j],
                'z': cb[k].z[j],
                'Isyn': cb[k].Isyn[j],
                'alpha': cb[k].alpha,
                'beta': cb[k].beta,
                'D': cb[k].D,
                'tausyn': cb[k].tausyn,
                'Pmax': cb[k].Pmax
            })
            df.to_csv(save_path + '/' + filename)

        pool.close()
        pool.join()

    elapsed_time = time.time() - starttime
    print("elapsed_time:{0}".format(elapsed_time) + "[sec]\n")

    pic = Picture(save_path)
    pic.run()
    print("ちょう終わりました~♪")
Exemplo n.º 2
0
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 15 18:10:29 2017

@author: Hattori
"""
from picture import Picture

pic = Picture("F:/simulation")
pic.run()