Esempio n. 1
0
def test_parser_06():
    conf = hearsay.Parser()
    conf.check_file()
    fname = PATH / '../set/experiment_test.ini'
    conf.check_file(fname)
    conf.read_config_file()
    assert len(conf.p) == 25
Esempio n. 2
0
def test_parser_14():
    conf = hearsay.Parser()
    fname = PATH / '../set/experiment_test.ini'
    conf.check_file(fname)
    conf.load_config(['dir_output'], ['non_existent_dir'])
    conf.check_settings()
    assert len(conf.filenames) == 8
Esempio n. 3
0
def test_parser_12(par, key, val, expected):
    conf = hearsay.Parser()
    conf.check_file()
    fname = PATH / '../set/experiment_test.ini'
    conf.check_file(fname)
    conf.read_config_file()
    conf.load_config([par], [val])
    assert getattr(conf.p, key) == expected
Esempio n. 4
0
def test_GN_03():
    conf = hearsay.Parser()
    conf.load_config(['nran'], ['2'])
    G = hearsay.C3Net(conf)
    G.set_parameters()
    A = [20000, 30000, 40000]
    S = [10000, 12000, 14000]
    D = [10000, 12000, 14000]
    G.set_parameters(A=A, S=S, D=D)
    res = G.run(interactive=True)
    assert len(res) == 54
Esempio n. 5
0
def test_GN_04():
    conf = hearsay.Parser()
    conf.load_config(['nran'], ['1'])
    G = hearsay.C3Net(conf)
    G.set_parameters()
    A = [20000, 30000]
    S = [10000, 12000]
    D = [10000]
    lista = [A, S, D]
    G.set_parameters(spars=lista)
    res = G.run(interactive=True)
    assert len(res) == 4
Esempio n. 6
0
def test_GN_08():
    conf = hearsay.Parser()
    conf.load_config(['nran', 'njobs', 'run_parallel'], ['10', '2', 'Y'])
    G = hearsay.C3Net(conf)
    G.set_parameters()
    A = [20000]
    S = [10000]
    D = [10000]
    lista = [A, S, D]
    G.set_parameters(spars=lista)
    res = G.run(interactive=True)
    res = G.show_single_ccns(interactive=True)
    assert isinstance(res, dict)
Esempio n. 7
0
def test_GN_01():
    conf = hearsay.Parser()
    G = hearsay.C3Net(conf)
    conf.load_config(['nran'], ['7'])
    tau_awakening = 20000
    tau_survive = 20000
    D_max = 20000
    directory = ''.join(
        [G.config.filenames.dir_output, G.config.filenames.exp_id])
    filename = ''.join([directory, 'test.pk'])
    pars = [[tau_awakening, tau_survive, D_max, filename]]
    df = pd.DataFrame(
        pars, columns=['tau_awakening', 'tau_survive', 'D_max', 'filename'])
    G.set_parameters(df)
    res = G.run(interactive=True)
    assert len(res) == 1
Esempio n. 8
0
def test_results_01():
    conf = hearsay.Parser()
    conf.load_config(['nran'], ['1'])
    G = hearsay.C3Net(conf)
    G.set_parameters()
    A = [20000, 30000]
    S = [10000, 12000]
    D = [10000]
    lista = [A, S, D]
    G.set_parameters(spars=lista)
    res = G.run(interactive=True)

    R = hearsay.Results(G)
    R.load()
    res = R.show_ccns(0, True)
    assert isinstance(res, dict)
Esempio n. 9
0
def test_parser_10():
    conf = hearsay.Parser(['', 'non_existent_file'])
    assert isinstance(conf, hearsay.Parser)
Esempio n. 10
0
def test_parser_11():
    conf = hearsay.Parser()
    conf.check_file()
    fname = PATH / '../set/experiment_test.ini'
    conf.check_file(fname)
    assert len(conf.filenames) == 8
Esempio n. 11
0
def test_parser_08():
    conf = hearsay.Parser()
    assert isinstance(conf['experiment']['exp_ID'], str)
Esempio n. 12
0
def test_parser_09():
    conf = hearsay.Parser('non_existent_file')
    assert isinstance(conf, hearsay.Parser)
Esempio n. 13
0
def test_parser_01():
    conf = hearsay.Parser()
    assert isinstance(conf, hearsay.Parser)
Esempio n. 14
0
def test_parser_07():
    conf = hearsay.Parser()
    assert isinstance(conf['experiment'], configparser.SectionProxy)
Esempio n. 15
0
import numpy as np
from matplotlib import pyplot as plt
from scipy import ndimage
import matplotlib.cm as cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
import pandas as pd

####################################################
# Figura 3
####################################################

#df = pd.read_csv('F2a.csv')
#config = hearsay.Parser('F2a.ini')

if len(argv) > 1:
    config = hearsay.Parser(argv[1])
    config.load_config()
    G = hearsay.C3Net(config)
    G.set_parameters()
else:
    df = pd.read_csv('../out/KREE_02/params.csv')
    config = hearsay.Parser('../out/KREE_02/KREE_02.ini')
    conf = hearsay.Parser()
    G = hearsay.C3Net(config)
    G.set_parameters(df)

R = hearsay.Results(G)
R.load()

fn = G.config.filenames
fname = fn.dir_output + fn.exp_id
Esempio n. 16
0
    tau_a.append(i[0])
    tau_s.append(i[1])
    d_max.append(i[2])
    fname.append(f"../out/F2b/{str(k).zfill(5)}_001.pk")

df = pd.DataFrame(
    list(zip(tau_a, tau_s, d_max, fname)),
    columns=['tau_awakening', 'tau_survive', 'D_max', 'filename'])

df.to_csv('F2b.csv')

# 1) Correr las simulaciones :::::::::::::::::::

# ....(a)
df = pd.read_csv('F2b.csv')
config = hearsay.Parser('F2b.ini')
config.load_config()
G = hearsay.C3Net(config)
G.set_parameters(df)

G.run()

# 2) Leer las simulaciones :::::::::::::::::::::

dfa = pd.read_csv('F2b.csv')
config = hearsay.Parser('F2b.ini')
config.load_config()
G = hearsay.C3Net(config)
G.set_parameters(dfa)

R = hearsay.Results(G)
Esempio n. 17
0
File: T2.py Progetto: mlares/hearsay
for k, i in enumerate(z):
    tau_a.append(i[0])
    tau_s.append(i[1])
    d_max.append(i[2])
    fname.append(f"../out/T2/{str(k).zfill(5)}_001.pk")

df = pd.DataFrame(
    list(zip(tau_a, tau_s, d_max, fname)),
    columns=['tau_awakening', 'tau_survive', 'D_max', 'filename'])

df.to_csv('T2.csv')

# 2) Correr las simulaciones :::::::::::::::::::

df = pd.read_csv('T2.csv')
config = hearsay.Parser('T2.ini')
config.load_config()
G = hearsay.C3Net(config)
G.set_parameters(df)

G.run()

df = pd.read_csv('T2.csv')
config = hearsay.Parser('T2.ini')
config.load_config()
G = hearsay.C3Net(config)
G.set_parameters(df)

R = hearsay.Results(G)
R.load()
res = R.redux()
Esempio n. 18
0
def test_parser_12():
    conf = hearsay.Parser(['', '../set/experiment_test.ini'])
    conf.check_file(fname)
    assert len(conf.filenames) == 8
Esempio n. 19
0
def test_parser_02():
    conf = hearsay.Parser()
    fname = PATH / '../set/experiment_test.ini'
    conf.check_file(fname)
    assert isinstance(conf.filename, str)
Esempio n. 20
0
def test_parser_13():
    conf = hearsay.Parser(['non_existent_file'])
    assert len(conf.filenames) == 8
Esempio n. 21
0
def test_parser_03():
    conf = hearsay.Parser()
    fname = PATH / '../set/experiment_test.ini'
    conf.check_file(fname)
    conf.check_file('../set/experiment_test.ini')
    assert conf.filename == '../set/experiment_test.ini'
Esempio n. 22
0
fname = []

for k, i in enumerate(z):
    tau_a.append(i[0])
    tau_s.append(i[1])
    d_max.append(i[2])
    fname.append(f"../out/F5a/{str(k).zfill(5)}_001.pk")

df = pd.DataFrame(
    list(zip(tau_a, tau_s, d_max, fname)),
    columns=['tau_awakening', 'tau_survive', 'D_max', 'filename'])

df.to_csv('F5a.csv')
df = pd.read_csv('F5a.csv')

conf = hearsay.Parser('F5a.ini')
conf.load_config()
G = hearsay.C3Net(conf)
G.set_parameters(df)

print('RUN simulation')
G.run()

print('REDUCE simulation')
R = hearsay.Results(G)
R.load()
res = R.redux()
FirstContactTimes = res['lF']

minval = 9999.
maxval = -9999.
Esempio n. 23
0
def test_parser_04():
    conf = hearsay.Parser()
    conf.check_file()
    assert conf.filename == '../set/experiment.ini'
Esempio n. 24
0
from hearsay import hearsay
from sys import argv

if len(argv) > 1:
    conf = hearsay.Parser(argv[1])
else:
    conf = hearsay.Parser()

G = hearsay.C3Net(conf)
G.set_parameters()
G.run()
Esempio n. 25
0
# Formas de cargar el modulo interactivo:
# En la terminal de ipython poner:
# %load_ext autoreload
# %autoreload 2

from hearsay import hearsay
import pandas as pd
from matplotlib import pyplot as plt
import numpy as np

# TUTORIAL 1: experiment from ini file

conf = hearsay.Parser('experiment.ini')
G = hearsay.C3Net(conf)
G.set_parameters()
net = G.run(interactive=True)
R = hearsay.Results(G)
R.load()
res = R.redux_1d()
plt.hist(res['A'])
plt.show()

# TUTORIAL 2: CORRER UNA SIMULACION

conf = hearsay.Parser()
G = hearsay.C3Net(conf)
conf.load_config(['nran'], ['7'])
tau_awakening = 20000
tau_survive = 20000
D_max = 20000
directory = ''.join([G.config.filenames.dir_output, G.config.filenames.exp_id])