Skip to content

Commit 13292a4

Browse files
committed
Correct storing of created by info.
1 parent dce7007 commit 13292a4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

c3/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
logging.getLogger("tensorflow").disabled = True
2222

2323
# flake8: noqa: C901
24-
def run_cfg(cfg, debug=False):
24+
def run_cfg(cfg, opt_config_filename, debug=False):
2525
"""Execute an optimization problem described in the cfg file.
2626
2727
Parameters
@@ -80,7 +80,7 @@ def run_cfg(cfg, debug=False):
8080

8181
opt = optim_lib[optim_type](**cfg, pmap=exp.pmap)
8282
opt.set_exp(exp)
83-
opt.set_created_by(cfg)
83+
opt.set_created_by(opt_config_filename)
8484

8585
if "initial_point" in cfg:
8686
initial_points = cfg["initial_point"]
@@ -138,4 +138,4 @@ def run_cfg(cfg, debug=False):
138138
cfg = hjson.load(cfg_file)
139139
except hjson.decoder.HjsonDecodeError:
140140
raise Exception(f"Config {opt_config} is invalid.")
141-
run_cfg(cfg)
141+
run_cfg(cfg, opt_config)

test/test_optim_init.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@
1111
def test_main_c1() -> None:
1212
with open("test/c1.cfg", "r") as cfg_file:
1313
cfg = hjson.load(cfg_file)
14-
run_cfg(cfg, debug=True)
14+
run_cfg(cfg, "test/c1.cfg", debug=True)
1515

1616

1717
def test_main_c2() -> None:
1818
with open("test/c2.cfg", "r") as cfg_file:
1919
cfg = hjson.load(cfg_file)
20-
run_cfg(cfg, debug=True)
20+
run_cfg(cfg, "test/c2.cfg", debug=True)
2121

2222

2323
def test_main_c3() -> None:
2424
with open("test/c3.cfg", "r") as cfg_file:
2525
cfg = hjson.load(cfg_file)
26-
run_cfg(cfg, debug=True)
26+
run_cfg(cfg, "test/c3.cfg", debug=True)
2727

2828

2929
def test_main_sens() -> None:
3030
with open("test/sensitivity.cfg", "r") as cfg_file:
3131
cfg = hjson.load(cfg_file)
32-
run_cfg(cfg, debug=True)
32+
run_cfg(cfg, "test/sensitivity.cfg", debug=True)
3333

3434

3535
def test_create_c1() -> None:

0 commit comments

Comments
 (0)