示例#1
0
    # Reshape the result into two columns
    idx.shape = (-1, 2)
    return idx

results = {}

for direct in ('forward', 'reverse'):
    edict = ds.edict_for_direction(direct)
    results[direct] = {}
    for I in edict.keys():
        #sres = psearch.search(zrange, cvfrange, I, T, update_pbar, direct)
        #savetxt(get_fname('{}_I{}.csv'.format(direct, I)), sres, delimiter=',')
        sres = genfromtxt(get_fname('{}_I{}.csv'.format(direct, I)), delimiter=',')

        results[direct][I] = sres
        plot_search_map(sres, (zrange[0], zrange[-1]), (cvfrange[0], cvfrange[-1]), I, direct,
                        get_fname('{}_I{}.png'.format(direct, I)))

results['combined'] = {}
zs = []
for I in results['forward'].keys():
    results['combined'][I] = results['forward'][I] * results['reverse'][I]
    savetxt(get_fname('{}_I{}.csv'.format('combined', I)), results['combined'][I], delimiter=',')
    plot_search_map(results['combined'][I], (zrange[0], zrange[-1]), (cvfrange[0], cvfrange[-1]), I, 'combined',
                    get_fname('{}_I{}.png'.format('combined', I)))

    r = results['combined'][I]
    min_indicies = unravel_index(r.argmin(), r.shape)
    min_val = (zrange[min_indicies[0]], cvfrange[min_indicies[1]])
    print('I = {}: z* = {}, cvf = {}'.format(I, min_val[0], min_val[1]))
    if I != 0:
        zs.append(min_val[0])
示例#2
0
    # do search for forward/back
    for direction, result_stash in [("forward", fresults), ("reverse", rresults)]:
        search_engine = ParamSearchEngine(accelcs, dstore)
        edict = dstore.edict_for_direction(direction)
        for I in edict.keys():
            print(str.format("{} bias, I = {}", direction, I))
            pbar = ProgressBar(
                widgets=["Parameter search: ", Percentage(), " ", Bar()], maxval=len(zrange) * len(cvfrange)
            )
            pbar.start()
            search_map = search_engine.search(zrange, cvfrange, I, args.temperature, pbar.update, direction)
            print("\n")
            result_stash[I] = search_map
            outpath = path.join(args.outputdir, str.format("Searchmap_I{}_{}.png", I, direction))
            dmplots.plot_search_map(
                search_map, (zrange[0], zrange[-1]), (cvfrange[0], cvfrange[-1]), I, direction, outpath
            )
            outpath = path.join(args.outputdir, str.format("Searchmap_I{}_{}.csv", I, direction))
            np.savetxt(outpath, search_map, delimiter=",")

fzaverage = 0
ict = 0
zvalues = []
cresults = {}

# multiply forward/reverse maps to get current-min maps
for I in fresults.keys():
    combined_map = fresults[I] * rresults[I]
    outpath = path.join(args.outputdir, str.format("Searchmap_I{}_combined.png", I))
    dmplots.plot_search_map(combined_map, (zrange[0], zrange[-1]), (cvfrange[0], cvfrange[-1]), I, "combined", outpath)
    cresults[I] = combined_map