From a2c9993869869e7bbe51b67b5c5ec18c83e71851 Mon Sep 17 00:00:00 2001
From: Theophile GENTILHOMME <tgentilhomme@jurasix08.idiap.ch>
Date: Tue, 1 May 2018 13:43:44 +0200
Subject: [PATCH] Add linestyle option

---
 bob/bio/base/script/commands.py    |  7 +++++++
 bob/bio/base/script/figure.py      | 14 +++++++-------
 bob/bio/base/test/test_commands.py | 14 +++++++-------
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/bob/bio/base/script/commands.py b/bob/bio/base/script/commands.py
index 5b6a3048..4276ac65 100644
--- a/bob/bio/base/script/commands.py
+++ b/bob/bio/base/script/commands.py
@@ -80,7 +80,9 @@ def metrics(ctx, scores, evaluation, **kargs):
 @common_options.y_label_option()
 @common_options.const_layout_option()
 @common_options.style_option()
+@common_options.linestyles_option()
 @common_options.figsize_option()
+@common_options.min_far_option()
 @verbosity_option()
 @click.pass_context
 def roc(ctx, scores, evaluation, **kargs):
@@ -120,8 +122,10 @@ def roc(ctx, scores, evaluation, **kargs):
 @common_options.points_curve_option()
 @common_options.const_layout_option()
 @common_options.style_option()
+@common_options.linestyles_option()
 @common_options.figsize_option()
 @common_options.lines_at_option()
+@common_options.min_far_option()
 @verbosity_option()
 @click.pass_context
 def det(ctx, scores, evaluation, **kargs):
@@ -154,6 +158,7 @@ def det(ctx, scores, evaluation, **kargs):
 @common_options.points_curve_option()
 @common_options.const_layout_option()
 @common_options.style_option()
+@common_options.linestyles_option()
 @common_options.figsize_option()
 @verbosity_option()
 @click.pass_context
@@ -187,6 +192,7 @@ def epc(ctx, scores, **kargs):
 @common_options.x_rotation_option()
 @common_options.const_layout_option()
 @common_options.style_option()
+@common_options.linestyles_option()
 @common_options.figsize_option()
 @verbosity_option()
 @click.pass_context
@@ -228,6 +234,7 @@ def cmc(ctx, scores, evaluation, **kargs):
 @rank_option()
 @common_options.const_layout_option()
 @common_options.style_option()
+@common_options.linestyles_option()
 @common_options.figsize_option()
 @verbosity_option()
 @click.pass_context
diff --git a/bob/bio/base/script/figure.py b/bob/bio/base/script/figure.py
index 7f93ef7a..00242f77 100644
--- a/bob/bio/base/script/figure.py
+++ b/bob/bio/base/script/figure.py
@@ -2,7 +2,7 @@
 
 import click
 import matplotlib.pyplot as mpl
-import  bob.measure.script.figure as measure_figure
+import bob.measure.script.figure as measure_figure
 import bob.measure
 from bob.measure import plot
 from tabulate import tabulate
@@ -39,7 +39,7 @@ class Cmc(measure_figure.PlotBase):
         :py:func:`bob.measure.plot.cmc`'''
         mpl.figure(1)
         if self._eval:
-            linestyle = '-' if not self._split else measure_figure.LINESTYLES[idx % 14]
+            linestyle = '-' if not self._split else self._linestyles[idx]
             rank = plot.cmc(
                 input_scores[0], logx=self._semilogx,
                 color=self._colors[idx], linestyle=linestyle,
@@ -49,7 +49,7 @@ class Cmc(measure_figure.PlotBase):
             linestyle = '--'
             if self._split:
                 mpl.figure(2)
-                linestyle = measure_figure.LINESTYLES[idx % 14]
+                linestyle = self._linestyles[idx]
 
             rank = plot.cmc(
                 input_scores[1], logx=self._semilogx,
@@ -60,7 +60,7 @@ class Cmc(measure_figure.PlotBase):
         else:
             rank = plot.cmc(
                 input_scores[0], logx=self._semilogx,
-                color=self._colors[idx], linestyle=measure_figure.LINESTYLES[idx % 14],
+                color=self._colors[idx], linestyle=self._linestyles[idx],
                 label=self._label('development', input_names[0], idx)
             )
             self._max_R = max(rank, self._max_R)
@@ -81,7 +81,7 @@ class Dir(measure_figure.PlotBase):
         :py:func:`bob.measure.plot.detection_identification_curve`'''
         mpl.figure(1)
         if self._eval:
-            linestyle = '-' if not self._split else measure_figure.LINESTYLES[idx % 14]
+            linestyle = '-' if not self._split else self._linestyles[idx]
             plot.detection_identification_curve(
                 input_scores[0], rank=self._rank, logx=self._semilogx,
                 color=self._colors[idx], linestyle=linestyle,
@@ -90,7 +90,7 @@ class Dir(measure_figure.PlotBase):
             linestyle = '--'
             if self._split:
                 mpl.figure(2)
-                linestyle = measure_figure.LINESTYLES[idx % 14]
+                linestyle = self._linestyles[idx]
 
             plot.detection_identification_curve(
                 input_scores[1], rank=self._rank, logx=self._semilogx,
@@ -100,7 +100,7 @@ class Dir(measure_figure.PlotBase):
         else:
             plot.detection_identification_curve(
                 input_scores[0], rank=self._rank, logx=self._semilogx,
-                color=self._colors[idx], linestyle=measure_figure.LINESTYLES[idx % 14],
+                color=self._colors[idx], linestyle=self._linestyles[idx],
                 label=self._label('development', input_names[0], idx)
             )
 
diff --git a/bob/bio/base/test/test_commands.py b/bob/bio/base/test/test_commands.py
index 0d617651..33f57c04 100644
--- a/bob/bio/base/test/test_commands.py
+++ b/bob/bio/base/test/test_commands.py
@@ -32,7 +32,7 @@ def test_metrics():
 
     with runner.isolated_filesystem():
         result = runner.invoke(
-            commands.metrics, ['-l', 'tmp', '-ls', 'A,B',
+            commands.metrics, ['-l', 'tmp', '-Z', 'A,B',
                                dev1, test1, dev2, test2]
         )
         assert result.exit_code == 0, (result.exit_code, result.output)
@@ -104,7 +104,7 @@ def test_roc():
                                             'data/test-5col.txt')
     with runner.isolated_filesystem():
         result = runner.invoke(commands.roc, ['--split', '--output',
-                                              'test.pdf',
+                                              'test.pdf', '-S',
                                               dev1, test1, dev2, test2])
         if result.output:
             click.echo(result.output)
@@ -124,7 +124,7 @@ def test_det():
                                            'data/dev-4col.txt')
     runner = CliRunner()
     with runner.isolated_filesystem():
-        result = runner.invoke(commands.det, ['--no-evaluation', dev1])
+        result = runner.invoke(commands.det, ['--no-evaluation', dev1, '-S'])
         if result.output:
             click.echo(result.output)
         assert result.exit_code == 0, (result.exit_code, result.output)
@@ -166,7 +166,7 @@ def test_epc():
                                             'data/test-5col.txt')
     with runner.isolated_filesystem():
         result = runner.invoke(commands.epc, ['--output', 'test.pdf',
-                                              '--legends', 'A,B',
+                                              '--legends', 'A,B', '-S',
                                               dev1, test1, dev2, test2])
         if result.output:
             click.echo(result.output)
@@ -199,7 +199,7 @@ def test_hist():
     with runner.isolated_filesystem():
         result = runner.invoke(commands.hist, ['--criterion', 'eer', '--output',
                                                'HISTO.pdf', '-b', '30',
-                                               '-ls', 'A,B', dev1, test1, dev2,
+                                               '-Z', 'A,B', dev1, test1, dev2,
                                                test2])
         if result.output:
             click.echo(result.output)
@@ -218,7 +218,7 @@ def test_cmc():
                                             'data/scores-cmc-4col.txt')
     with runner.isolated_filesystem():
         result = runner.invoke(commands.cmc, ['--output', 'test.pdf',
-                                              '--legends', 'A,B',
+                                              '--legends', 'A,B', '-S',
                                               dev1, test1, dev1, test1])
         if result.output:
             click.echo(result.output)
@@ -237,7 +237,7 @@ def test_dir():
                                             'data/scores-nonorm-openset-dev')
     with runner.isolated_filesystem():
         result = runner.invoke(commands.dir, ['--output', 'test.pdf',
-                                              '--legends', 'A,B',
+                                              '--legends', 'A,B', '-S',
                                               dev1, test1, dev1, test1])
         if result.output:
             click.echo(result.output)
-- 
GitLab