foldername = 'Data_été'
filename = 'results_name.txt'
xlsname = 'results_name.xls'
mapname = 'map_name.png'

# Extracting data from xls files and creating 4 ppc matrices
os.chdir(foldername)
ppc = loadcase(caseproject())
bus, gen, branch, gencost = freadexcel()
ppc["bus"] = bus
ppc["branch"] = branch
ppc["gen"] = gen
ppc["gencost"] = gencost

# Running the simulation
r = rundcopf(ppc, fname=filename)

# Storing results
results_gen, results_load_lambda, results_branch = fstoreresult(r)

# Writing results in xls file
# fwriteinexcel(xlsname, results_gen, results_load_lambda, results_branch)

# Creating a map with the results
results_branch_map = []
for i in range(len(branch)):
    inter = [results_branch[i, 0], results_branch[i, 1], results_branch[i, 2], branch[i, 5]]
    results_branch_map.append(inter)
results_branch_map = np.asarray(results_branch_map, dtype=np.float64)
fmap(results_branch_map, results_gen, results_load_lambda, mapname)
Esempio n. 2
0
def test_fmap():
    seen = []
    def accum(name):
        seen.append(name)

    fmap(TESTDIR, accum)
    assert set(seen) == {'c', 'd', 'f', 'g', 'h'}

    del seen[:]
    fmap(TESTDIR, accum, max_depth=0)
    assert set(seen) == {'c', 'd'}

    del seen[:]
    fmap(TESTDIR, accum, apply_dirs=True)
    assert set(seen) == {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}

    del seen[:]
    fmap(TESTDIR, accum, apply_dirs=True, max_depth=0)
    assert set(seen) == {'a', 'b', 'c', 'd'}

    del seen[:]
    fmap(TESTDIR, accum, excludes=['a'])
    assert set(seen) == {'c', 'd', 'h'}

    del seen[:]
    fmap(TESTDIR, accum, patterns=['g', 'd', 'h'], excludes=['a'])
    assert set(seen) == {'d', 'h'}
    "children": 
    [
        { "name": "Zerg",
          "children" : []
          },
        { "name": "Protoss",
          "children" : []
          },
        { "name": "Terran",
          "children": []
          }
        ]
    }

races = {
    "Zerg": fmap(),
    "Protoss": fmap(),
    "Terran": fmap()
}

losingraces = {
    "Zerg": fmap(),
    "Protoss": fmap(),
    "Terran": fmap()
}


df = read_csv('sc2_korean_p0_p199.csv')

for i,race in enumerate(df['winner_race']):
    races[race][df['winner_name'][i]] += 1
Esempio n. 4
0
def test_fmap():
    seen = []

    def accum(name):
        seen.append(name)

    fmap(TESTDIR, accum)
    assert set(seen) == {'c', 'd', 'f', 'g', 'h'}

    del seen[:]
    fmap(TESTDIR, accum, max_depth=0)
    assert set(seen) == {'c', 'd'}

    del seen[:]
    fmap(TESTDIR, accum, apply_dirs=True)
    assert set(seen) == {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}

    del seen[:]
    fmap(TESTDIR, accum, apply_dirs=True, max_depth=0)
    assert set(seen) == {'a', 'b', 'c', 'd'}

    del seen[:]
    fmap(TESTDIR, accum, excludes=['a'])
    assert set(seen) == {'c', 'd', 'h'}

    del seen[:]
    fmap(TESTDIR, accum, patterns=['g', 'd', 'h'], excludes=['a'])
    assert set(seen) == {'d', 'h'}