Skip to content

64 add default parameter sweep to run notebook command#65

Open
capn-freako wants to merge 2 commits intomasterfrom
64-add-default-parameter-sweep-to-run-notebook-command
Open

64 add default parameter sweep to run notebook command#65
capn-freako wants to merge 2 commits intomasterfrom
64-add-default-parameter-sweep-to-run-notebook-command

Conversation

@capn-freako
Copy link
Owner

No description provided.

@capn-freako capn-freako linked an issue Mar 7, 2026 that may be closed by this pull request
@capn-freako capn-freako requested a review from jdpatt March 7, 2026 11:57
Copy link
Collaborator

@jdpatt jdpatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't make use of this feature but giving feedback where I can!


# Write parameter sweep specification template file.
root_name = str(pcfg.input_ami_params[ParamName("root_name")])
run_file_path = Path(root_name + ".run").resolve()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use .with_suffix() over string concatenation.

if not notebook.exists():
raise RuntimeError(f"Can't find notebook file, {notebook}!")
if "params" not in notebook_params or notebook_params["params"] == "":
dummy_run_file_name = mk_dummy_run_file(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If out_dir is provided, shouldn't we write the run file to that file path?

"Run a *Jupyter* notebook on an IBIS-AMI model file."
arguments_list = sys.argv
full_command_line = "run-notebook " + " ".join(shlex.quote(arg) for arg in arguments_list[1:])
if out_dir:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just set this once. I would add an else that sets it to the ibis file and remove the second update of it in run_notebook.

    if out_dir:
        out_dir=Path(out_dir).resolve()
    else:
        out_dir = Path(ibis_file).resolve().parent
    out_dir.mkdir(exist_ok=True)

Comment on lines 181 to 182
@click.option("--fig-x", default=10, show_default=True, help="x-dimmension for plot figures (in).")
@click.option("--fig-y", default=3, show_default=True, help="y-dimmension for plot figures (in).")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dimmension -> dimension?

# Write parameter sweep specification template file.
root_name = str(pcfg.input_ami_params[ParamName("root_name")])
run_file_path = Path(root_name + ".run").resolve()
with open(run_file_path, mode="wt", encoding="utf-8") as run_file:
Copy link
Collaborator

@jdpatt jdpatt Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we already generate *.run files in the mk_tests function; can we extract this to a write_run_file(filepath, dict) helper that does the same for both? Just have to give each the proper formatted dictonary so if we make edits later; both outputs are lock step and not segmented. This can be a future improvement if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add default parameter sweep to run-notebook command.

2 participants