Skip to content
Snippets Groups Projects
Commit a2c99938 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME
Browse files

Add linestyle option

parent 4585d6cf
No related branches found
No related tags found
1 merge request!146Add 4-5-col files related functionalities and add click commands
Pipeline #
...@@ -80,7 +80,9 @@ def metrics(ctx, scores, evaluation, **kargs): ...@@ -80,7 +80,9 @@ def metrics(ctx, scores, evaluation, **kargs):
@common_options.y_label_option() @common_options.y_label_option()
@common_options.const_layout_option() @common_options.const_layout_option()
@common_options.style_option() @common_options.style_option()
@common_options.linestyles_option()
@common_options.figsize_option() @common_options.figsize_option()
@common_options.min_far_option()
@verbosity_option() @verbosity_option()
@click.pass_context @click.pass_context
def roc(ctx, scores, evaluation, **kargs): def roc(ctx, scores, evaluation, **kargs):
...@@ -120,8 +122,10 @@ def roc(ctx, scores, evaluation, **kargs): ...@@ -120,8 +122,10 @@ def roc(ctx, scores, evaluation, **kargs):
@common_options.points_curve_option() @common_options.points_curve_option()
@common_options.const_layout_option() @common_options.const_layout_option()
@common_options.style_option() @common_options.style_option()
@common_options.linestyles_option()
@common_options.figsize_option() @common_options.figsize_option()
@common_options.lines_at_option() @common_options.lines_at_option()
@common_options.min_far_option()
@verbosity_option() @verbosity_option()
@click.pass_context @click.pass_context
def det(ctx, scores, evaluation, **kargs): def det(ctx, scores, evaluation, **kargs):
...@@ -154,6 +158,7 @@ def det(ctx, scores, evaluation, **kargs): ...@@ -154,6 +158,7 @@ def det(ctx, scores, evaluation, **kargs):
@common_options.points_curve_option() @common_options.points_curve_option()
@common_options.const_layout_option() @common_options.const_layout_option()
@common_options.style_option() @common_options.style_option()
@common_options.linestyles_option()
@common_options.figsize_option() @common_options.figsize_option()
@verbosity_option() @verbosity_option()
@click.pass_context @click.pass_context
...@@ -187,6 +192,7 @@ def epc(ctx, scores, **kargs): ...@@ -187,6 +192,7 @@ def epc(ctx, scores, **kargs):
@common_options.x_rotation_option() @common_options.x_rotation_option()
@common_options.const_layout_option() @common_options.const_layout_option()
@common_options.style_option() @common_options.style_option()
@common_options.linestyles_option()
@common_options.figsize_option() @common_options.figsize_option()
@verbosity_option() @verbosity_option()
@click.pass_context @click.pass_context
...@@ -228,6 +234,7 @@ def cmc(ctx, scores, evaluation, **kargs): ...@@ -228,6 +234,7 @@ def cmc(ctx, scores, evaluation, **kargs):
@rank_option() @rank_option()
@common_options.const_layout_option() @common_options.const_layout_option()
@common_options.style_option() @common_options.style_option()
@common_options.linestyles_option()
@common_options.figsize_option() @common_options.figsize_option()
@verbosity_option() @verbosity_option()
@click.pass_context @click.pass_context
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import click import click
import matplotlib.pyplot as mpl import matplotlib.pyplot as mpl
import bob.measure.script.figure as measure_figure import bob.measure.script.figure as measure_figure
import bob.measure import bob.measure
from bob.measure import plot from bob.measure import plot
from tabulate import tabulate from tabulate import tabulate
...@@ -39,7 +39,7 @@ class Cmc(measure_figure.PlotBase): ...@@ -39,7 +39,7 @@ class Cmc(measure_figure.PlotBase):
:py:func:`bob.measure.plot.cmc`''' :py:func:`bob.measure.plot.cmc`'''
mpl.figure(1) mpl.figure(1)
if self._eval: 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( rank = plot.cmc(
input_scores[0], logx=self._semilogx, input_scores[0], logx=self._semilogx,
color=self._colors[idx], linestyle=linestyle, color=self._colors[idx], linestyle=linestyle,
...@@ -49,7 +49,7 @@ class Cmc(measure_figure.PlotBase): ...@@ -49,7 +49,7 @@ class Cmc(measure_figure.PlotBase):
linestyle = '--' linestyle = '--'
if self._split: if self._split:
mpl.figure(2) mpl.figure(2)
linestyle = measure_figure.LINESTYLES[idx % 14] linestyle = self._linestyles[idx]
rank = plot.cmc( rank = plot.cmc(
input_scores[1], logx=self._semilogx, input_scores[1], logx=self._semilogx,
...@@ -60,7 +60,7 @@ class Cmc(measure_figure.PlotBase): ...@@ -60,7 +60,7 @@ class Cmc(measure_figure.PlotBase):
else: else:
rank = plot.cmc( rank = plot.cmc(
input_scores[0], logx=self._semilogx, 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) label=self._label('development', input_names[0], idx)
) )
self._max_R = max(rank, self._max_R) self._max_R = max(rank, self._max_R)
...@@ -81,7 +81,7 @@ class Dir(measure_figure.PlotBase): ...@@ -81,7 +81,7 @@ class Dir(measure_figure.PlotBase):
:py:func:`bob.measure.plot.detection_identification_curve`''' :py:func:`bob.measure.plot.detection_identification_curve`'''
mpl.figure(1) mpl.figure(1)
if self._eval: 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( plot.detection_identification_curve(
input_scores[0], rank=self._rank, logx=self._semilogx, input_scores[0], rank=self._rank, logx=self._semilogx,
color=self._colors[idx], linestyle=linestyle, color=self._colors[idx], linestyle=linestyle,
...@@ -90,7 +90,7 @@ class Dir(measure_figure.PlotBase): ...@@ -90,7 +90,7 @@ class Dir(measure_figure.PlotBase):
linestyle = '--' linestyle = '--'
if self._split: if self._split:
mpl.figure(2) mpl.figure(2)
linestyle = measure_figure.LINESTYLES[idx % 14] linestyle = self._linestyles[idx]
plot.detection_identification_curve( plot.detection_identification_curve(
input_scores[1], rank=self._rank, logx=self._semilogx, input_scores[1], rank=self._rank, logx=self._semilogx,
...@@ -100,7 +100,7 @@ class Dir(measure_figure.PlotBase): ...@@ -100,7 +100,7 @@ class Dir(measure_figure.PlotBase):
else: else:
plot.detection_identification_curve( plot.detection_identification_curve(
input_scores[0], rank=self._rank, logx=self._semilogx, 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) label=self._label('development', input_names[0], idx)
) )
......
...@@ -32,7 +32,7 @@ def test_metrics(): ...@@ -32,7 +32,7 @@ def test_metrics():
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke( result = runner.invoke(
commands.metrics, ['-l', 'tmp', '-ls', 'A,B', commands.metrics, ['-l', 'tmp', '-Z', 'A,B',
dev1, test1, dev2, test2] dev1, test1, dev2, test2]
) )
assert result.exit_code == 0, (result.exit_code, result.output) assert result.exit_code == 0, (result.exit_code, result.output)
...@@ -104,7 +104,7 @@ def test_roc(): ...@@ -104,7 +104,7 @@ def test_roc():
'data/test-5col.txt') 'data/test-5col.txt')
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke(commands.roc, ['--split', '--output', result = runner.invoke(commands.roc, ['--split', '--output',
'test.pdf', 'test.pdf', '-S',
dev1, test1, dev2, test2]) dev1, test1, dev2, test2])
if result.output: if result.output:
click.echo(result.output) click.echo(result.output)
...@@ -124,7 +124,7 @@ def test_det(): ...@@ -124,7 +124,7 @@ def test_det():
'data/dev-4col.txt') 'data/dev-4col.txt')
runner = CliRunner() runner = CliRunner()
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke(commands.det, ['--no-evaluation', dev1]) result = runner.invoke(commands.det, ['--no-evaluation', dev1, '-S'])
if result.output: if result.output:
click.echo(result.output) click.echo(result.output)
assert result.exit_code == 0, (result.exit_code, result.output) assert result.exit_code == 0, (result.exit_code, result.output)
...@@ -166,7 +166,7 @@ def test_epc(): ...@@ -166,7 +166,7 @@ def test_epc():
'data/test-5col.txt') 'data/test-5col.txt')
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke(commands.epc, ['--output', 'test.pdf', result = runner.invoke(commands.epc, ['--output', 'test.pdf',
'--legends', 'A,B', '--legends', 'A,B', '-S',
dev1, test1, dev2, test2]) dev1, test1, dev2, test2])
if result.output: if result.output:
click.echo(result.output) click.echo(result.output)
...@@ -199,7 +199,7 @@ def test_hist(): ...@@ -199,7 +199,7 @@ def test_hist():
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke(commands.hist, ['--criterion', 'eer', '--output', result = runner.invoke(commands.hist, ['--criterion', 'eer', '--output',
'HISTO.pdf', '-b', '30', 'HISTO.pdf', '-b', '30',
'-ls', 'A,B', dev1, test1, dev2, '-Z', 'A,B', dev1, test1, dev2,
test2]) test2])
if result.output: if result.output:
click.echo(result.output) click.echo(result.output)
...@@ -218,7 +218,7 @@ def test_cmc(): ...@@ -218,7 +218,7 @@ def test_cmc():
'data/scores-cmc-4col.txt') 'data/scores-cmc-4col.txt')
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke(commands.cmc, ['--output', 'test.pdf', result = runner.invoke(commands.cmc, ['--output', 'test.pdf',
'--legends', 'A,B', '--legends', 'A,B', '-S',
dev1, test1, dev1, test1]) dev1, test1, dev1, test1])
if result.output: if result.output:
click.echo(result.output) click.echo(result.output)
...@@ -237,7 +237,7 @@ def test_dir(): ...@@ -237,7 +237,7 @@ def test_dir():
'data/scores-nonorm-openset-dev') 'data/scores-nonorm-openset-dev')
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke(commands.dir, ['--output', 'test.pdf', result = runner.invoke(commands.dir, ['--output', 'test.pdf',
'--legends', 'A,B', '--legends', 'A,B', '-S',
dev1, test1, dev1, test1]) dev1, test1, dev1, test1])
if result.output: if result.output:
click.echo(result.output) click.echo(result.output)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment