Ejemplo n.º 1
0
def main():
    # Modules
    dgpng = '../../modules/dgpng/dgpng.py'
    tracewrangler = '../../modules/nsf-traces/tracewrangler.py'

    # Map files
    map_dir = '../london-seg4/data/100'
    edg_xml = purr.mrf(map_dir, r'*.edg.xml')
    nod_xml = purr.mrf(map_dir, r'*.nod.xml')

    # Hot file
    hot = 'simulations/dgpng'

    # Working Dir
    temp = 'temp'
    if not os.path.exists(temp):
        os.mkdir(temp)

    # Output dir
    out = '%s/out' % (hot)
    if not os.path.exists(out):
        os.mkdir(out)

    # Retrieve everthing in the hotfile
    sims = purr.lsdir(hot)

    # For each simulation
    for sim in sims:
        if not '.json' in sim:
            continue
        path = '%s/%s' % (hot, sim)

        # Trace Wrangler
        cmd = 'python %s ' % (tracewrangler)
        cmd += '--trace.json=%s ' % (path)
        cmd += '--edg.xml=%s ' % (edg_xml)
        cmd += '--color.ssv=%s/%s.ssv ' % (temp, sim)
        cmd += '--node-color=(255,255,255,255) '
        cmd += '--edge-color=(0,0,0,255)'
        os.system(cmd)

        # dgpng
        cmd = 'python %s ' % (dgpng)
        cmd += '--edg.xml=%s ' % (edg_xml)
        cmd += '--nod.xml=%s ' % (nod_xml)
        cmd += '--png=%s/%s.png ' % (out, sim)
        cmd += '--background-color=(255,255,255,0) '
        cmd += '--node-color=(255,255,255,255) '
        cmd += '--edge-color=(0,0,0,50) '
        cmd += '--internal-node-color=(0,0,0,0) '
        cmd += '--edge-thickness=10 '
        cmd += '--padding=10 '
        cmd += '--color.ssv=%s/%s.ssv ' % (temp, sim)
        os.system(cmd)
        continue

    # Clean up
    purr.deldir(temp)
    return
Ejemplo n.º 2
0
def finalize():
    if os.path.exists(env.out_dir):
        purr.deldir(env.out_dir)
    os.mkdir(env.out_dir)
    vehicle.csv()
    vehicle.out_pretty()
    target.csv()
    target.out_pretty()
    return
Ejemplo n.º 3
0
def finalize():
    if os.path.exists(env.out_dir):
        purr.deldir(env.out_dir)
    os.mkdir(env.out_dir)
    vehicle.csv()
    vehicle.out_pretty()
    target.csv()
    target.out_pretty()

    if env.method == "greedy":
        purr.save(env.nA_greedy_file, env.nash_assigner)
    else:
        purr.save(env.nA_smart_file, env.nash_assigner)
    return