Skip to content

Commit

Permalink
backport #116 to v0.13.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Böck committed Mar 14, 2016
1 parent 9e2c2d2 commit 74cb58f
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Release Notes
=============

Version 0.13.1 (release date: 2016-03-14)
-----------------------------------------

This is a bugfix release.

* Fix beat evaluation argument parsing (#116)

Version 0.13 (release date: 2016-03-07)
---------------------------------------

Expand Down
18 changes: 10 additions & 8 deletions madmom/evaluation/beats.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ def add_parser(parser):
Each line represents a beat and must have the following format with values
being separated by whitespace [brackets indicate optional values]:
`beat_time [[bar.]beat]`
`beat_time [beat_inside_bar]`
Lines starting with # are treated as comments and are ignored.
Expand Down Expand Up @@ -1256,11 +1256,11 @@ def add_parser(parser):
type=float, default=FMEASURE_WINDOW,
help='evaluation window for F-measure '
'[seconds, default=%(default).3f]')
g.add_argument('--tolerance', action='store', type=float,
default=PSCORE_TOLERANCE,
g.add_argument('--tolerance', dest='pscore_tolerance', action='store',
type=float, default=PSCORE_TOLERANCE,
help='evaluation tolerance for P-score '
'[default=%(default).3f]')
g.add_argument('--sigma', action='store', type=float,
g.add_argument('--sigma', dest='cemgil_sigma', action='store', type=float,
default=CEMGIL_SIGMA,
help='sigma for Cemgil accuracy [default=%(default).3f]')
g.add_argument('--goto_threshold', action='store', type=float,
Expand All @@ -1272,16 +1272,18 @@ def add_parser(parser):
g.add_argument('--goto_mu', action='store', type=float,
default=GOTO_MU,
help='µ for Goto error [default=%(default).3f]')
g.add_argument('--phase_tolerance', action='store', type=float,
g.add_argument('--phase_tolerance', dest='continuity_phase_tolerance',
action='store', type=float,
default=CONTINUITY_PHASE_TOLERANCE,
help='phase tolerance window for continuity accuracies '
'[default=%(default).3f]')
g.add_argument('--tempo_tolerance', action='store', type=float,
g.add_argument('--tempo_tolerance', dest='continuity_tempo_tolerance',
action='store', type=float,
default=CONTINUITY_TEMPO_TOLERANCE,
help='tempo tolerance window for continuity accuracies '
'[default=%(default).3f]')
g.add_argument('--bins', action='store', type=int,
default=INFORMATION_GAIN_BINS,
g.add_argument('--bins', dest='information_gain_bins', action='store',
type=int, default=INFORMATION_GAIN_BINS,
help='number of histogram bins for information gain '
'[default=%(default)i]')
# return the sub-parser and evaluation argument group
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import numpy as np

# define version
version = '0.13'
version = '0.13.1'

# define which extensions need to be compiled
extensions = [Extension('madmom.ml.rnn',
Expand Down
43 changes: 42 additions & 1 deletion tests/test_evaluation_beats.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import unittest
import math

from . import ANNOTATIONS_PATH
from . import ANNOTATIONS_PATH, DETECTIONS_PATH
from madmom.evaluation.beats import *
# noinspection PyProtectedMember
from madmom.evaluation.beats import (_histogram_bins, _error_histogram,
Expand Down Expand Up @@ -1076,3 +1076,44 @@ def test_results(self):

def test_tostring(self):
print(BeatMeanEvaluation([]))


class TestAddParserFunction(unittest.TestCase):

def setUp(self):
import argparse
self.parser = argparse.ArgumentParser()
sub_parser = self.parser.add_subparsers()
self.sub_parser, self.group = add_parser(sub_parser)

def test_args(self):
args = self.parser.parse_args(['beats', ANNOTATIONS_PATH,
DETECTIONS_PATH])
self.assertTrue(args.ann_dir is None)
self.assertTrue(args.ann_suffix == '.beats')
self.assertTrue(args.cemgil_sigma == 0.04)
self.assertTrue(args.continuity_phase_tolerance == 0.175)
self.assertTrue(args.continuity_tempo_tolerance == 0.175)
self.assertTrue(args.det_dir is None)
self.assertTrue(args.det_suffix == '.beats.txt')
self.assertTrue(args.double is True)
self.assertTrue(args.downbeats is False)
self.assertTrue(args.eval == BeatEvaluation)
self.assertTrue(args.files == [ANNOTATIONS_PATH, DETECTIONS_PATH])
self.assertTrue(args.fmeasure_window == 0.07)
self.assertTrue(args.goto_mu == 0.1)
self.assertTrue(args.goto_sigma == 0.1)
self.assertTrue(args.goto_threshold == 0.175)
self.assertTrue(args.ignore_non_existing is False)
self.assertTrue(args.information_gain_bins == 40)
self.assertTrue(args.mean_eval == BeatMeanEvaluation)
self.assertTrue(args.offbeat is True)
# self.assertTrue(args.outfile == StringIO.StringIO)
from madmom.evaluation import tostring
self.assertTrue(args.output_formatter == tostring)
self.assertTrue(args.pscore_tolerance == 0.2)
self.assertTrue(args.quiet is False)
self.assertTrue(args.skip == 0)
self.assertTrue(args.sum_eval is None)
self.assertTrue(args.triple is True)
self.assertTrue(args.verbose == 0)

0 comments on commit 74cb58f

Please sign in to comment.