Skip to content

Commit

Permalink
save results to json file
Browse files Browse the repository at this point in the history
  • Loading branch information
fakufaku committed Apr 9, 2020
1 parent 197994e commit 1c45c92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions experiment1.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import json
import datetime
from multiprocessing import Pool
from pathlib import Path

Expand Down Expand Up @@ -53,6 +54,9 @@ def gen_args(config_fn):
if args.test:
sim_args = sim_args[:2]

# date of simulation in string format
date_str = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")

all_results = []

if args.seq:
Expand All @@ -64,3 +68,8 @@ def gen_args(config_fn):
results = p.map(process, sim_args)
for r in results:
all_results += r

filename = f"{date_str}_smd_results.json"
with open(filename, "w") as f:
json.dump(all_results, f)

4 changes: 3 additions & 1 deletion process.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ def process(args):
Y, X[:, :, ref_mic], p=p, q=q, **kwargs
)

y, t["sdr"], t["sir"], _ = reconstruct_evaluate(
y, sdr, sir, _ = reconstruct_evaluate(
ref, Z, nfft, hop, win=win_s
)
t["sdr"] = sdr.tolist()
t["sir"] = sir.tolist()
results.append(t.copy())

return results

0 comments on commit 1c45c92

Please sign in to comment.