From 50525939f9f698e2704a6b21ba675c4c8ff05027 Mon Sep 17 00:00:00 2001 From: Theophile GENTILHOMME <tgentilhomme@jurasix08.idiap.ch> Date: Tue, 5 Jun 2018 09:51:17 +0200 Subject: [PATCH] [script/test][commands,figure,test_commands] Modify --title option to --titles Allows a list of titles --- bob/bio/base/script/commands.py | 11 +++++------ bob/bio/base/script/figure.py | 12 ++++++------ bob/bio/base/test/test_commands.py | 1 + 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bob/bio/base/script/commands.py b/bob/bio/base/script/commands.py index 78bb2450..8416b3f2 100644 --- a/bob/bio/base/script/commands.py +++ b/bob/bio/base/script/commands.py @@ -69,7 +69,7 @@ def metrics(ctx, scores, evaluation, **kargs): @click.command() @common_options.scores_argument(nargs=-1) -@common_options.title_option() +@common_options.titles_option() @common_options.legends_option() @common_options.legend_loc_option(dflt=None) @common_options.no_legend_option() @@ -117,7 +117,7 @@ def roc(ctx, scores, evaluation, **kargs): @click.command() @common_options.scores_argument(nargs=-1) -@common_options.title_option() +@common_options.titles_option() @common_options.output_plot_file_option(default_out='det.pdf') @common_options.legends_option() @common_options.legend_loc_option(dflt='upper-right') @@ -163,7 +163,7 @@ def det(ctx, scores, evaluation, **kargs): @click.command() @common_options.scores_argument(min_arg=1, force_eval=True, nargs=-1) -@common_options.title_option() +@common_options.titles_option() @common_options.output_plot_file_option(default_out='epc.pdf') @common_options.legends_option() @common_options.legend_loc_option(dflt='upper-center') @@ -197,7 +197,7 @@ def epc(ctx, scores, **kargs): @click.command() @common_options.scores_argument(nargs=-1) -@common_options.title_option() +@common_options.titles_option() @common_options.legends_option() @common_options.sep_dev_eval_option() @common_options.output_plot_file_option(default_out='cmc.pdf') @@ -240,7 +240,7 @@ def cmc(ctx, scores, evaluation, **kargs): @click.command() @common_options.scores_argument(nargs=-1) -@common_options.title_option() +@common_options.titles_option() @common_options.legends_option() @common_options.sep_dev_eval_option() @common_options.output_plot_file_option(default_out='dir.pdf') @@ -293,7 +293,6 @@ def dir(ctx, scores, evaluation, **kargs): @click.command() @common_options.scores_argument(nargs=-1) -@common_options.title_option() @common_options.output_plot_file_option(default_out='hist.pdf') @common_options.eval_option() @common_options.n_bins_option() diff --git a/bob/bio/base/script/figure.py b/bob/bio/base/script/figure.py index a39aa7e7..faf51b3b 100644 --- a/bob/bio/base/script/figure.py +++ b/bob/bio/base/script/figure.py @@ -31,7 +31,7 @@ class Cmc(measure_figure.PlotBase): def __init__(self, ctx, scores, evaluation, func_load): super(Cmc, self).__init__(ctx, scores, evaluation, func_load) self._semilogx = ctx.meta.get('semilogx', True) - self._title = self._title or 'CMC' + self._titles = self._titles or ['CMC dev', 'CMC eval'] self._x_label = self._x_label or 'Rank' self._y_label = self._y_label or 'Identification rate' self._max_R = 0 @@ -45,7 +45,7 @@ class Cmc(measure_figure.PlotBase): rank = plot.cmc( input_scores[0], logx=self._semilogx, color=self._colors[idx], linestyle=linestyle, - label=self._label('development', input_names[0], idx) + label=self._label('dev', input_names[0], idx) ) self._max_R = max(rank, self._max_R) linestyle = '--' @@ -63,7 +63,7 @@ class Cmc(measure_figure.PlotBase): rank = plot.cmc( input_scores[0], logx=self._semilogx, color=self._colors[idx], linestyle=self._linestyles[idx], - label=self._label('development', input_names[0], idx) + label=self._label('dev', input_names[0], idx) ) self._max_R = max(rank, self._max_R) @@ -75,7 +75,7 @@ class Dir(measure_figure.PlotBase): super(Dir, self).__init__(ctx, scores, evaluation, func_load) self._semilogx = ctx.meta.get('semilogx', True) self._rank = ctx.meta.get('rank', 1) - self._title = self._title or 'DIR curve' + self._titles = self._titles or ['DIR curve'] * 2 self._x_label = self._x_label or 'False Alarm Rate' self._y_label = self._y_label or 'Detection and Identification Rate' @@ -88,7 +88,7 @@ class Dir(measure_figure.PlotBase): plot.detection_identification_curve( input_scores[0], rank=self._rank, logx=self._semilogx, color=self._colors[idx], linestyle=linestyle, - label=self._label('development', input_names[0], idx) + label=self._label('dev', input_names[0], idx) ) linestyle = '--' if self._split: @@ -104,7 +104,7 @@ class Dir(measure_figure.PlotBase): plot.detection_identification_curve( input_scores[0], rank=self._rank, logx=self._semilogx, color=self._colors[idx], linestyle=self._linestyles[idx], - label=self._label('development', input_names[0], idx) + label=self._label('dev', input_names[0], idx) ) if self._min_dig is not None: diff --git a/bob/bio/base/test/test_commands.py b/bob/bio/base/test/test_commands.py index 7ed0a6a6..e705e7fe 100644 --- a/bob/bio/base/test/test_commands.py +++ b/bob/bio/base/test/test_commands.py @@ -272,6 +272,7 @@ def test_cmc(): with runner.isolated_filesystem(): result = runner.invoke(commands.cmc, ['--output', 'test.pdf', '--legends', 'A,B', '-S', + '-ts', 'TA,TB', dev1, test1, dev1, test1]) if result.output: click.echo(result.output) -- GitLab