Skip to content

Commit b400143

Browse files
committed
velinized docstrings
1 parent 6a54024 commit b400143

18 files changed

+81
-157
lines changed

mir_eval/alignment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def evaluate(reference_timestamps, estimated_timestamps, **kwargs):
324324
reference timestamp locations, in seconds
325325
estimated_timestamps : np.ndarray
326326
estimated timestamp locations, in seconds
327-
kwargs
327+
**kwargs
328328
Additional keyword arguments which will be passed to the
329329
appropriate metric or preprocessing functions.
330330

mir_eval/beat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ def evaluate(reference_beats, estimated_beats, **kwargs):
727727
Reference beat times, in seconds
728728
estimated_beats : np.ndarray
729729
Query beat times, in seconds
730-
kwargs
730+
**kwargs
731731
Additional keyword arguments which will be passed to the
732732
appropriate metric or preprocessing functions.
733733

mir_eval/chord.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def scale_degree_to_semitone(scale_degree):
177177
178178
Parameters
179179
----------
180-
scale degree : str
180+
scale_degree : str
181181
Spelling of a relative scale degree, e.g. 'b3', '7', '#5'
182182
183183
Returns
@@ -345,7 +345,7 @@ def validate_chord_label(chord_label):
345345
346346
Parameters
347347
----------
348-
chord : str
348+
chord_label : str
349349
Chord label to validate.
350350
351351
"""
@@ -1551,20 +1551,16 @@ def evaluate(ref_intervals, ref_labels, est_intervals, est_labels, **kwargs):
15511551
ref_intervals : np.ndarray, shape=(n, 2)
15521552
Reference chord intervals, in the format returned by
15531553
:func:`mir_eval.io.load_labeled_intervals`.
1554-
15551554
ref_labels : list, shape=(n,)
15561555
reference chord labels, in the format returned by
15571556
:func:`mir_eval.io.load_labeled_intervals`.
1558-
15591557
est_intervals : np.ndarray, shape=(m, 2)
15601558
estimated chord intervals, in the format returned by
15611559
:func:`mir_eval.io.load_labeled_intervals`.
1562-
15631560
est_labels : list, shape=(m,)
15641561
estimated chord labels, in the format returned by
15651562
:func:`mir_eval.io.load_labeled_intervals`.
1566-
1567-
kwargs
1563+
**kwargs
15681564
Additional keyword arguments which will be passed to the
15691565
appropriate metric or preprocessing functions.
15701566

mir_eval/display.py

+8-30
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def __get_axes(ax=None, fig=None):
5757
ax : matplotlib.pyplot.axes
5858
An axis handle on which to draw the segmentation.
5959
If none is provided, a new set of axes is created.
60-
6160
new_axes : bool
6261
If `True`, the axis object was newly constructed.
6362
If `False`, the axis object already existed.
@@ -98,33 +97,26 @@ def segments(
9897
segment intervals, in the format returned by
9998
:func:`mir_eval.io.load_intervals` or
10099
:func:`mir_eval.io.load_labeled_intervals`.
101-
102100
labels : list, shape=(n,)
103101
reference segment labels, in the format returned by
104102
:func:`mir_eval.io.load_labeled_intervals`.
105-
106103
base : number
107104
The vertical position of the base of the rectangles.
108105
By default, this will be the bottom of the plot.
109-
110106
height : number
111107
The height of the rectangles.
112108
By default, this will be the top of the plot (minus ``base``).
113-
114109
text : bool
115110
If true, each segment's label is displayed in its
116111
upper-left corner
117-
118112
text_kw : dict
119113
If ``text == True``, the properties of the text
120114
object can be specified here.
121115
See ``matplotlib.pyplot.Text`` for valid parameters
122-
123116
ax : matplotlib.pyplot.axes
124117
An axis handle on which to draw the segmentation.
125118
If none is provided, a new set of axes is created.
126-
127-
kwargs
119+
**kwargs
128120
Additional keyword arguments to pass to
129121
``matplotlib.patches.Rectangle``.
130122
@@ -255,7 +247,7 @@ def labeled_intervals(
255247
tick : bool
256248
If ``True``, sets tick positions and labels on the y-axis.
257249
258-
kwargs
250+
**kwargs
259251
Additional keyword arguments to pass to
260252
`matplotlib.collection.BrokenBarHCollection`.
261253
@@ -369,17 +361,14 @@ def hierarchy(intervals_hier, labels_hier, levels=None, ax=None, **kwargs):
369361
:func:`mir_eval.io.load_intervals` or
370362
:func:`mir_eval.io.load_labeled_intervals`.
371363
Segmentations should be ordered by increasing specificity.
372-
373364
labels_hier : list of list-like
374365
A list of segmentation labels. Each element should
375366
be a list of labels for the corresponding element in
376367
`intervals_hier`.
377-
378368
levels : list of string
379369
Each element ``levels[i]`` is a label for the ```i`` th segmentation.
380370
This is used in the legend to denote the levels in a segment hierarchy.
381-
382-
kwargs
371+
**kwargs
383372
Additional keyword arguments to `labeled_intervals`.
384373
385374
Returns
@@ -416,29 +405,23 @@ def events(times, labels=None, base=None, height=None, ax=None, text_kw=None, **
416405
event times, in the format returned by
417406
:func:`mir_eval.io.load_events` or
418407
:func:`mir_eval.io.load_labeled_events`.
419-
420408
labels : list, shape=(n,), optional
421409
event labels, in the format returned by
422410
:func:`mir_eval.io.load_labeled_events`.
423-
424411
base : number
425412
The vertical position of the base of the line.
426413
By default, this will be the bottom of the plot.
427-
428414
height : number
429415
The height of the lines.
430416
By default, this will be the top of the plot (minus `base`).
431-
432417
ax : matplotlib.pyplot.axes
433418
An axis handle on which to draw the segmentation.
434419
If none is provided, a new set of axes is created.
435-
436420
text_kw : dict
437421
If `labels` is provided, the properties of the text
438422
objects can be specified here.
439423
See `matplotlib.pyplot.Text` for valid parameters
440-
441-
kwargs
424+
**kwargs
442425
Additional keyword arguments to pass to
443426
`matplotlib.pyplot.vlines`.
444427
@@ -535,7 +518,7 @@ def pitch(times, frequencies, midi=False, unvoiced=False, ax=None, **kwargs):
535518
An axis handle on which to draw the pitch contours.
536519
If none is provided, a new set of axes is created.
537520
538-
kwargs
521+
**kwargs
539522
Additional keyword arguments to `matplotlib.pyplot.plot`.
540523
541524
Returns
@@ -622,7 +605,7 @@ def multipitch(times, frequencies, midi=False, unvoiced=False, ax=None, **kwargs
622605
An axis handle on which to draw the pitch contours.
623606
If none is provided, a new set of axes is created.
624607
625-
kwargs
608+
**kwargs
626609
Additional keyword arguments to `plt.scatter`.
627610
628611
Returns
@@ -703,7 +686,7 @@ def piano_roll(intervals, pitches=None, midi=None, ax=None, **kwargs):
703686
An axis handle on which to draw the intervals.
704687
If none is provided, a new set of axes is created.
705688
706-
kwargs
689+
**kwargs
707690
Additional keyword arguments to :func:`labeled_intervals`.
708691
709692
Returns
@@ -742,21 +725,16 @@ def separation(sources, fs=22050, labels=None, alpha=0.75, ax=None, **kwargs):
742725
----------
743726
sources : np.ndarray, shape=(nsrc, nsampl)
744727
A list of waveform buffers corresponding to each source
745-
746728
fs : number > 0
747729
The sampling rate
748-
749730
labels : list of strings
750731
An optional list of descriptors corresponding to each source
751-
752732
alpha : float in [0, 1]
753733
Maximum alpha (opacity) of spectrogram values.
754-
755734
ax : matplotlib.pyplot.axes
756735
An axis handle on which to draw the spectrograms.
757736
If none is provided, a new set of axes is created.
758-
759-
kwargs
737+
**kwargs
760738
Additional keyword arguments to ``scipy.signal.spectrogram``
761739
762740
Returns

mir_eval/hierarchy.py

+3-25
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def _round(t, frame_size):
6868
----------
6969
t : number or ndarray
7070
The time-stamp to round
71-
7271
frame_size : number > 0
7372
The resolution to round to
7473
@@ -110,10 +109,8 @@ def _align_intervals(int_hier, lab_hier, t_min=0.0, t_max=None):
110109
Hierarchical segment annotations, encoded as a
111110
list of list of intervals (int_hier) and list of
112111
list of strings (lab_hier)
113-
114112
t_min : None or number >= 0
115113
The minimum time value for the segmentation
116-
117114
t_max : None or number >= t_min
118115
The maximum time value for the segmentation
119116
@@ -149,7 +146,6 @@ def _lca(intervals_hier, frame_size):
149146
intervals_hier : list of ndarray
150147
An ordered list of segment interval arrays.
151148
The list is assumed to be ordered by increasing specificity (depth).
152-
153149
frame_size : number
154150
The length of the sample frames (in seconds)
155151
@@ -194,11 +190,9 @@ def _meet(intervals_hier, labels_hier, frame_size):
194190
intervals_hier : list of ndarray
195191
An ordered list of segment interval arrays.
196192
The list is assumed to be ordered by increasing specificity (depth).
197-
198193
labels_hier : list of list of str
199194
``labels_hier[i]`` contains the segment labels for the
200195
``i``th layer of the annotations
201-
202196
frame_size : number
203197
The length of the sample frames (in seconds)
204198
@@ -251,6 +245,7 @@ def _gauc(ref_lca, est_lca, transitive, window):
251245
Parameters
252246
----------
253247
ref_lca : scipy.sparse
248+
254249
est_lca : scipy.sparse
255250
The least common ancestor matrices for the reference and
256251
estimated annotations
@@ -380,7 +375,6 @@ def _compare_frame_rankings(ref, est, transitive=False):
380375
est : np.ndarray, shape=(n,)
381376
Reference and estimate ranked lists.
382377
`ref[i]` is the relevance score for point `i`.
383-
384378
transitive : bool
385379
If true, all pairs of reference levels are compared.
386380
If false, only adjacent pairs of reference levels are compared.
@@ -390,7 +384,6 @@ def _compare_frame_rankings(ref, est, transitive=False):
390384
inversions : int
391385
The number of pairs of indices `i, j` where
392386
`ref[i] < ref[j]` but `est[i] >= est[j]`.
393-
394387
normalizer : float
395388
The total number of pairs (i, j) under consideration.
396389
If transitive=True, then this is |{(i,j) : ref[i] < ref[j]}|
@@ -493,32 +486,25 @@ def tmeasure(
493486
(in seconds) for the ``i`` th layer of the annotations. Layers are
494487
ordered from top to bottom, so that the last list of intervals should
495488
be the most specific.
496-
497489
estimated_intervals_hier : list of ndarray
498490
Like ``reference_intervals_hier`` but for the estimated annotation
499-
500491
transitive : bool
501492
whether to compute the t-measures using transitivity or not.
502-
503493
window : float > 0
504494
size of the window (in seconds). For each query frame q,
505495
result frames are only counted within q +- window.
506-
507496
frame_size : float > 0
508497
length (in seconds) of frames. The frame size cannot be longer than
509498
the window.
510-
511499
beta : float > 0
512500
beta parameter for the F-measure.
513501
514502
Returns
515503
-------
516504
t_precision : number [0, 1]
517505
T-measure Precision
518-
519506
t_recall : number [0, 1]
520507
T-measure Recall
521-
522508
t_measure : number [0, 1]
523509
F-beta measure for ``(t_precision, t_recall)``
524510
@@ -583,31 +569,25 @@ def lmeasure(
583569
(in seconds) for the ``i`` th layer of the annotations. Layers are
584570
ordered from top to bottom, so that the last list of intervals should
585571
be the most specific.
586-
587572
reference_labels_hier : list of list of str
588573
``reference_labels_hier[i]`` contains the segment labels for the
589574
``i``th layer of the annotations
590-
591575
estimated_intervals_hier : list of ndarray
592576
estimated_labels_hier : list of ndarray
593577
Like ``reference_intervals_hier`` and ``reference_labels_hier``
594578
but for the estimated annotation
595-
596579
frame_size : float > 0
597580
length (in seconds) of frames. The frame size cannot be longer than
598581
the window.
599-
600582
beta : float > 0
601583
beta parameter for the F-measure.
602584
603585
Returns
604586
-------
605587
l_precision : number [0, 1]
606588
L-measure Precision
607-
608589
l_recall : number [0, 1]
609590
L-measure Recall
610-
611591
l_measure : number [0, 1]
612592
F-beta measure for ``(l_precision, l_recall)``
613593
@@ -694,7 +674,6 @@ def evaluate(
694674
'T-Recall full': 0.6523334654992341,
695675
'T-Recall reduced': 0.60799919710921635}
696676
697-
698677
Parameters
699678
----------
700679
ref_intervals_hier : list of list-like
@@ -705,13 +684,12 @@ def evaluate(
705684
of segmentations. Each segmentation itself is a list (or list-like)
706685
of intervals (\*_intervals_hier) and a list of lists of labels
707686
(\*_labels_hier).
708-
709-
kwargs
687+
**kwargs
710688
additional keyword arguments to the evaluation metrics.
711689
712690
Returns
713691
-------
714-
scores : OrderedDict
692+
scores : OrderedDict
715693
Dictionary of scores, where the key is the metric name (str) and
716694
the value is the (float) score achieved.
717695

0 commit comments

Comments
 (0)