Skip to content

Commit

Permalink
Correct storing of created by info.
Browse files Browse the repository at this point in the history
  • Loading branch information
nwittler committed May 27, 2021
1 parent dce7007 commit 13292a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions c3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
logging.getLogger("tensorflow").disabled = True

# flake8: noqa: C901
def run_cfg(cfg, debug=False):
def run_cfg(cfg, opt_config_filename, debug=False):
"""Execute an optimization problem described in the cfg file.
Parameters
Expand Down Expand Up @@ -80,7 +80,7 @@ def run_cfg(cfg, debug=False):

opt = optim_lib[optim_type](**cfg, pmap=exp.pmap)
opt.set_exp(exp)
opt.set_created_by(cfg)
opt.set_created_by(opt_config_filename)

if "initial_point" in cfg:
initial_points = cfg["initial_point"]
Expand Down Expand Up @@ -138,4 +138,4 @@ def run_cfg(cfg, debug=False):
cfg = hjson.load(cfg_file)
except hjson.decoder.HjsonDecodeError:
raise Exception(f"Config {opt_config} is invalid.")
run_cfg(cfg)
run_cfg(cfg, opt_config)
8 changes: 4 additions & 4 deletions test/test_optim_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@
def test_main_c1() -> None:
with open("test/c1.cfg", "r") as cfg_file:
cfg = hjson.load(cfg_file)
run_cfg(cfg, debug=True)
run_cfg(cfg, "test/c1.cfg", debug=True)


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


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


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


def test_create_c1() -> None:
Expand Down

0 comments on commit 13292a4

Please sign in to comment.