예제 #1
0
    initial_populations.append((sw0, aw0, scenario))

# plt.show()


###############################################################################
# main

plots = {}

for sw0, aw0, mix in initial_populations:

    logging.info("MIX: %s", mix)

    sw = ABBSW()
    aw = ABBAW()

    for k in [ sw, aw ]:
        k.L, k.U = L, U
        k.setup(MidPoint(), N)

    T = range(30)
    n = np.zeros((len(T)+1, 2, len(sw.x)))

    n[0, 0] = sw0
    n[0, 1] = aw0

    for j, t in enumerate(T):

        for k in [ sw, aw ]:
            k.update(n[j, 0], n[j, 1], t)
예제 #2
0
with open('out/abb_with_comp.pkl', 'r') as f:
    plots = pickle.load(f)


###############################################################################
# main

for plotname in plots:

    plot = plots[plotname]

    # init

    sw = ABBSW()
    aw = ABBAW()

    L, U, N, T, x, plotfile = plot['attrs']
    nsw, naw = plot['nsw'], plot['naw']

    dx = float(U - L) / N

    plotname = plotfile.split('/')[-1].split('.')[0]

    # setup kernels and connect them to each other
    for k in [ sw, aw ]:
        k.L, k.U = L, U
        k.setup(MidPoint(), N)
        k.measurements(plotfile, plotname)

예제 #3
0
    "CD": {"color": "c", "marker": "^"},
    "DC": {"color": "m", "marker": "v"},
}

figsph, sph = plt.subplots(1, 3, sharey=True)
figba, ba = plt.subplots(1, 3, sharey=True)


for plotname in plots:

    plot = plots[plotname]

    # init

    sw = ABBSW()
    aw = ABBAW()

    L, U, N, T, x, name = plot["attrs"]
    nsw, naw = plot["nsw"], plot["naw"]

    dx = float(U - L) / N

    # setup kernels and connect them to each other
    for k in [sw, aw]:
        k.L, k.U = L, U
        k.setup(MidPoint(), N)

    mrates = []
    for j in range(1, nsw.shape[0] - 1):
        mr = sw.population(nsw[j + 1]) / sw.population(nsw[j])
        mrates.append(mr)