Commit b5456651 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Allow plotterparameters in beat exp plot command

So far it was not possible to specify a plotterparameter when producing
the experiment plots locally.

This merge request adds an option in the command line which allows users
to change the plotterparameter of each output plot.

Fixes #70
parent 122122b7
Pipeline #41556 passed with stage
in 9 minutes and 25 seconds
......@@ -43,7 +43,7 @@ import queue
import signal
import textwrap
import threading
import traceback
from datetime import timedelta
import click
......@@ -505,7 +505,7 @@ def pull_impl(webapi, prefix, names, force, indentation, format_cache):
return status + tc_status + db_status + algo_status
def plot_impl(configuration, names, remote, show, output_folder):
def plot_impl(configuration, names, remote, show, output_folder, plotterparameters):
"""Plots experiments from the server.
......@@ -634,13 +634,13 @@ def plot_impl(configuration, names, remote, show, output_folder):
return plotter
def _get_parametters_for(plotter):
"""Return the parameters for the given plotter"""
def _get_parametters_for(plotter_param_name):
"""Return the requested plotter parameter"""
parameters_path = os.path.join(prefix, "plotterparameters")
with open(
os.path.join(parameters_path, + ".json")
os.path.join(parameters_path, plotter_param_name + ".json")
) as parameters_file:
declaration = simplejson.load(parameters_file)
return declaration["data"]
......@@ -665,7 +665,9 @@ def plot_impl(configuration, names, remote, show, output_folder):
default_parameters = _get_parametters_for(plotter)
default_parameters = _get_parametters_for(
runner = plotter.runner()
......@@ -837,15 +839,33 @@ def draw(ctx, names, path):
"--remote", help="Only acts on the remote copy of the experiment", is_flag=True
@click.option("--show", help="Show...", is_flag=True)
@click.option("--show", help="Show the saved images", is_flag=True)
@click.option("--output-folder", help="<folder>", type=click.Path(exists=True))
help="The plotterparameter to use for each plot. Specify the plot output name "
"(output name in the analyzer) and plotterparameter name to use for it separated "
"with commas, e.g. `-p roc,plot/isoroc/1 -p scores_distribution,plot/scatter/1",
def plot(ctx, names, remote, show, output_folder):
def plot(ctx, names, remote, show, output_folder, params):
"""Plots output images of the experiment."""
config = ctx.meta.get("config")
plot_impl(config, names, remote, show, output_folder)
plotterparameters = dict(p.split(",") for p in params)
except Exception:
raise click.UsageError(
f"Failed to parse --param: {params} as a mapping of output names to "
f"plotterparameters. {traceback.format_exc()}\nUse the -p option like: "
"-p roc,plot/isoroc/1 -p scores_distribution,plot/scatter/1"
plot_impl(config, names, remote, show, output_folder, plotterparameters)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment