Commit 665f83d3 authored by Flavio TARSETTI's avatar Flavio TARSETTI

Merge branch 'plotter-param-click-option' into 'master'

Allow plotterparameters in beat exp plot command

Closes #70

See merge request !100
parents 122122b7 b5456651
Pipeline #41558 passed with stages
in 11 minutes and 4 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)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment