repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
dgovil/PySignal
PySignal.py
SignalFactory.connect
def connect(self, signalName, slot): """ Connects a given signal to a given slot :param signalName: the signal name to connect to :param slot: the callable slot to register """ assert signalName in self, "%s is not a registered signal" % signalName self[signalName...
python
def connect(self, signalName, slot): """ Connects a given signal to a given slot :param signalName: the signal name to connect to :param slot: the callable slot to register """ assert signalName in self, "%s is not a registered signal" % signalName self[signalName...
Connects a given signal to a given slot :param signalName: the signal name to connect to :param slot: the callable slot to register
https://github.com/dgovil/PySignal/blob/72f4ced949f81e5438bd8f15247ef7890e8cc5ff/PySignal.py#L158-L165
dgovil/PySignal
PySignal.py
SignalFactory.block
def block(self, signals=None, isBlocked=True): """ Sets the block on any provided signals, or to all signals :param signals: defaults to all signals. Accepts either a single string or a list of strings :param isBlocked: the state to set the signal to """ if signals: ...
python
def block(self, signals=None, isBlocked=True): """ Sets the block on any provided signals, or to all signals :param signals: defaults to all signals. Accepts either a single string or a list of strings :param isBlocked: the state to set the signal to """ if signals: ...
Sets the block on any provided signals, or to all signals :param signals: defaults to all signals. Accepts either a single string or a list of strings :param isBlocked: the state to set the signal to
https://github.com/dgovil/PySignal/blob/72f4ced949f81e5438bd8f15247ef7890e8cc5ff/PySignal.py#L167-L187
craffel/mir_eval
mir_eval/io.py
_open
def _open(file_or_str, **kwargs): '''Either open a file handle, or use an existing file-like object. This will behave as the `open` function if `file_or_str` is a string. If `file_or_str` has the `read` attribute, it will return `file_or_str`. Otherwise, an `IOError` is raised. ''' if hasattr...
python
def _open(file_or_str, **kwargs): '''Either open a file handle, or use an existing file-like object. This will behave as the `open` function if `file_or_str` is a string. If `file_or_str` has the `read` attribute, it will return `file_or_str`. Otherwise, an `IOError` is raised. ''' if hasattr...
Either open a file handle, or use an existing file-like object. This will behave as the `open` function if `file_or_str` is a string. If `file_or_str` has the `read` attribute, it will return `file_or_str`. Otherwise, an `IOError` is raised.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L18-L33
craffel/mir_eval
mir_eval/io.py
load_delimited
def load_delimited(filename, converters, delimiter=r'\s+'): r"""Utility function for loading in data from an annotation file where columns are delimited. The number of columns is inferred from the length of the provided converters list. Examples -------- >>> # Load in a one-column list of even...
python
def load_delimited(filename, converters, delimiter=r'\s+'): r"""Utility function for loading in data from an annotation file where columns are delimited. The number of columns is inferred from the length of the provided converters list. Examples -------- >>> # Load in a one-column list of even...
r"""Utility function for loading in data from an annotation file where columns are delimited. The number of columns is inferred from the length of the provided converters list. Examples -------- >>> # Load in a one-column list of event times (floats) >>> load_delimited('events.txt', [float]) ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L36-L105
craffel/mir_eval
mir_eval/io.py
load_events
def load_events(filename, delimiter=r'\s+'): r"""Import time-stamp events from an annotation file. The file should consist of a single column of numeric values corresponding to the event times. This is primarily useful for processing events which lack duration, such as beats or onsets. Parameters ...
python
def load_events(filename, delimiter=r'\s+'): r"""Import time-stamp events from an annotation file. The file should consist of a single column of numeric values corresponding to the event times. This is primarily useful for processing events which lack duration, such as beats or onsets. Parameters ...
r"""Import time-stamp events from an annotation file. The file should consist of a single column of numeric values corresponding to the event times. This is primarily useful for processing events which lack duration, such as beats or onsets. Parameters ---------- filename : str Path to...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L108-L137
craffel/mir_eval
mir_eval/io.py
load_labeled_events
def load_labeled_events(filename, delimiter=r'\s+'): r"""Import labeled time-stamp events from an annotation file. The file should consist of two columns; the first having numeric values corresponding to the event times and the second having string labels for each event. This is primarily useful for p...
python
def load_labeled_events(filename, delimiter=r'\s+'): r"""Import labeled time-stamp events from an annotation file. The file should consist of two columns; the first having numeric values corresponding to the event times and the second having string labels for each event. This is primarily useful for p...
r"""Import labeled time-stamp events from an annotation file. The file should consist of two columns; the first having numeric values corresponding to the event times and the second having string labels for each event. This is primarily useful for processing labeled events which lack duration, such as...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L140-L172
craffel/mir_eval
mir_eval/io.py
load_labeled_intervals
def load_labeled_intervals(filename, delimiter=r'\s+'): r"""Import labeled intervals from an annotation file. The file should consist of three columns: Two consisting of numeric values corresponding to start and end time of each interval and a third corresponding to the label of each interval. This is...
python
def load_labeled_intervals(filename, delimiter=r'\s+'): r"""Import labeled intervals from an annotation file. The file should consist of three columns: Two consisting of numeric values corresponding to start and end time of each interval and a third corresponding to the label of each interval. This is...
r"""Import labeled intervals from an annotation file. The file should consist of three columns: Two consisting of numeric values corresponding to start and end time of each interval and a third corresponding to the label of each interval. This is primarily useful for processing events which span a dur...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L208-L242
craffel/mir_eval
mir_eval/io.py
load_time_series
def load_time_series(filename, delimiter=r'\s+'): r"""Import a time series from an annotation file. The file should consist of two columns of numeric values corresponding to the time and value of each sample of the time series. Parameters ---------- filename : str Path to the annotatio...
python
def load_time_series(filename, delimiter=r'\s+'): r"""Import a time series from an annotation file. The file should consist of two columns of numeric values corresponding to the time and value of each sample of the time series. Parameters ---------- filename : str Path to the annotatio...
r"""Import a time series from an annotation file. The file should consist of two columns of numeric values corresponding to the time and value of each sample of the time series. Parameters ---------- filename : str Path to the annotation file delimiter : str Separator regular e...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L245-L271
craffel/mir_eval
mir_eval/io.py
load_patterns
def load_patterns(filename): """Loads the patters contained in the filename and puts them into a list of patterns, each pattern being a list of occurrence, and each occurrence being a list of (onset, midi) pairs. The input file must be formatted as described in MIREX 2013: http://www.music-ir.org/m...
python
def load_patterns(filename): """Loads the patters contained in the filename and puts them into a list of patterns, each pattern being a list of occurrence, and each occurrence being a list of (onset, midi) pairs. The input file must be formatted as described in MIREX 2013: http://www.music-ir.org/m...
Loads the patters contained in the filename and puts them into a list of patterns, each pattern being a list of occurrence, and each occurrence being a list of (onset, midi) pairs. The input file must be formatted as described in MIREX 2013: http://www.music-ir.org/mirex/wiki/2013:Discovery_of_Repeated...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L274-L350
craffel/mir_eval
mir_eval/io.py
load_wav
def load_wav(path, mono=True): """Loads a .wav file as a numpy array using ``scipy.io.wavfile``. Parameters ---------- path : str Path to a .wav file mono : bool If the provided .wav has more than one channel, it will be converted to mono if ``mono=True``. (Default value = T...
python
def load_wav(path, mono=True): """Loads a .wav file as a numpy array using ``scipy.io.wavfile``. Parameters ---------- path : str Path to a .wav file mono : bool If the provided .wav has more than one channel, it will be converted to mono if ``mono=True``. (Default value = T...
Loads a .wav file as a numpy array using ``scipy.io.wavfile``. Parameters ---------- path : str Path to a .wav file mono : bool If the provided .wav has more than one channel, it will be converted to mono if ``mono=True``. (Default value = True) Returns ------- audi...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L353-L387
craffel/mir_eval
mir_eval/io.py
load_key
def load_key(filename, delimiter=r'\s+'): r"""Load key labels from an annotation file. The file should consist of two string columns: One denoting the key scale degree (semitone), and the other denoting the mode (major or minor). The file should contain only one row. Parameters ---------- ...
python
def load_key(filename, delimiter=r'\s+'): r"""Load key labels from an annotation file. The file should consist of two string columns: One denoting the key scale degree (semitone), and the other denoting the mode (major or minor). The file should contain only one row. Parameters ---------- ...
r"""Load key labels from an annotation file. The file should consist of two string columns: One denoting the key scale degree (semitone), and the other denoting the mode (major or minor). The file should contain only one row. Parameters ---------- filename : str Path to the annotation ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L431-L464
craffel/mir_eval
mir_eval/io.py
load_tempo
def load_tempo(filename, delimiter=r'\s+'): r"""Load tempo estimates from an annotation file in MIREX format. The file should consist of three numeric columns: the first two correspond to tempo estimates (in beats-per-minute), and the third denotes the relative confidence of the first value compared to ...
python
def load_tempo(filename, delimiter=r'\s+'): r"""Load tempo estimates from an annotation file in MIREX format. The file should consist of three numeric columns: the first two correspond to tempo estimates (in beats-per-minute), and the third denotes the relative confidence of the first value compared to ...
r"""Load tempo estimates from an annotation file in MIREX format. The file should consist of three numeric columns: the first two correspond to tempo estimates (in beats-per-minute), and the third denotes the relative confidence of the first value compared to the second (in the range [0, 1]). The file s...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L467-L508
craffel/mir_eval
mir_eval/io.py
load_ragged_time_series
def load_ragged_time_series(filename, dtype=float, delimiter=r'\s+', header=False): r"""Utility function for loading in data from a delimited time series annotation file with a variable number of columns. Assumes that column 0 contains time stamps and columns 1 through n contain ...
python
def load_ragged_time_series(filename, dtype=float, delimiter=r'\s+', header=False): r"""Utility function for loading in data from a delimited time series annotation file with a variable number of columns. Assumes that column 0 contains time stamps and columns 1 through n contain ...
r"""Utility function for loading in data from a delimited time series annotation file with a variable number of columns. Assumes that column 0 contains time stamps and columns 1 through n contain values. n may be variable from time stamp to time stamp. Examples -------- >>> # Load a ragged list...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/io.py#L511-L583
craffel/mir_eval
mir_eval/chord.py
_pitch_classes
def _pitch_classes(): r'''Map from pitch class (str) to semitone (int).''' pitch_classes = ['C', 'D', 'E', 'F', 'G', 'A', 'B'] semitones = [0, 2, 4, 5, 7, 9, 11] return dict([(c, s) for c, s in zip(pitch_classes, semitones)])
python
def _pitch_classes(): r'''Map from pitch class (str) to semitone (int).''' pitch_classes = ['C', 'D', 'E', 'F', 'G', 'A', 'B'] semitones = [0, 2, 4, 5, 7, 9, 11] return dict([(c, s) for c, s in zip(pitch_classes, semitones)])
r'''Map from pitch class (str) to semitone (int).
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L124-L128
craffel/mir_eval
mir_eval/chord.py
_scale_degrees
def _scale_degrees(): r'''Mapping from scale degrees (str) to semitones (int).''' degrees = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'] semitones = [0, 2, 4, 5, 7, 9, 11, 12, 14, 16, 17, 19, 21] return dict([(d, s) for d, s in zip(degrees, semitones)])
python
def _scale_degrees(): r'''Mapping from scale degrees (str) to semitones (int).''' degrees = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'] semitones = [0, 2, 4, 5, 7, 9, 11, 12, 14, 16, 17, 19, 21] return dict([(d, s) for d, s in zip(degrees, semitones)])
r'''Mapping from scale degrees (str) to semitones (int).
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L131-L136
craffel/mir_eval
mir_eval/chord.py
pitch_class_to_semitone
def pitch_class_to_semitone(pitch_class): r'''Convert a pitch class to semitone. Parameters ---------- pitch_class : str Spelling of a given pitch class, e.g. 'C#', 'Gbb' Returns ------- semitone : int Semitone value of the pitch class. ''' semitone = 0 for idx...
python
def pitch_class_to_semitone(pitch_class): r'''Convert a pitch class to semitone. Parameters ---------- pitch_class : str Spelling of a given pitch class, e.g. 'C#', 'Gbb' Returns ------- semitone : int Semitone value of the pitch class. ''' semitone = 0 for idx...
r'''Convert a pitch class to semitone. Parameters ---------- pitch_class : str Spelling of a given pitch class, e.g. 'C#', 'Gbb' Returns ------- semitone : int Semitone value of the pitch class.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L143-L168
craffel/mir_eval
mir_eval/chord.py
scale_degree_to_semitone
def scale_degree_to_semitone(scale_degree): r"""Convert a scale degree to semitone. Parameters ---------- scale degree : str Spelling of a relative scale degree, e.g. 'b3', '7', '#5' Returns ------- semitone : int Relative semitone of the scale degree, wrapped to a single o...
python
def scale_degree_to_semitone(scale_degree): r"""Convert a scale degree to semitone. Parameters ---------- scale degree : str Spelling of a relative scale degree, e.g. 'b3', '7', '#5' Returns ------- semitone : int Relative semitone of the scale degree, wrapped to a single o...
r"""Convert a scale degree to semitone. Parameters ---------- scale degree : str Spelling of a relative scale degree, e.g. 'b3', '7', '#5' Returns ------- semitone : int Relative semitone of the scale degree, wrapped to a single octave Raises ------ InvalidChordExc...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L175-L206
craffel/mir_eval
mir_eval/chord.py
scale_degree_to_bitmap
def scale_degree_to_bitmap(scale_degree, modulo=False, length=BITMAP_LENGTH): """Create a bitmap representation of a scale degree. Note that values in the bitmap may be negative, indicating that the semitone is to be removed. Parameters ---------- scale_degree : str Spelling of a relat...
python
def scale_degree_to_bitmap(scale_degree, modulo=False, length=BITMAP_LENGTH): """Create a bitmap representation of a scale degree. Note that values in the bitmap may be negative, indicating that the semitone is to be removed. Parameters ---------- scale_degree : str Spelling of a relat...
Create a bitmap representation of a scale degree. Note that values in the bitmap may be negative, indicating that the semitone is to be removed. Parameters ---------- scale_degree : str Spelling of a relative scale degree, e.g. 'b3', '7', '#5' modulo : bool, default=True If a s...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L209-L238
craffel/mir_eval
mir_eval/chord.py
quality_to_bitmap
def quality_to_bitmap(quality): """Return the bitmap for a given quality. Parameters ---------- quality : str Chord quality name. Returns ------- bitmap : np.ndarray Bitmap representation of this quality (12-dim). """ if quality not in QUALITIES: raise Inva...
python
def quality_to_bitmap(quality): """Return the bitmap for a given quality. Parameters ---------- quality : str Chord quality name. Returns ------- bitmap : np.ndarray Bitmap representation of this quality (12-dim). """ if quality not in QUALITIES: raise Inva...
Return the bitmap for a given quality. Parameters ---------- quality : str Chord quality name. Returns ------- bitmap : np.ndarray Bitmap representation of this quality (12-dim).
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L276-L294
craffel/mir_eval
mir_eval/chord.py
validate_chord_label
def validate_chord_label(chord_label): """Test for well-formedness of a chord label. Parameters ---------- chord : str Chord label to validate. """ # This monster regexp is pulled from the JAMS chord namespace, # which is in turn derived from the context-free grammar of # Hart...
python
def validate_chord_label(chord_label): """Test for well-formedness of a chord label. Parameters ---------- chord : str Chord label to validate. """ # This monster regexp is pulled from the JAMS chord namespace, # which is in turn derived from the context-free grammar of # Hart...
Test for well-formedness of a chord label. Parameters ---------- chord : str Chord label to validate.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L338-L357
craffel/mir_eval
mir_eval/chord.py
split
def split(chord_label, reduce_extended_chords=False): """Parse a chord label into its four constituent parts: - root - quality shorthand - scale degrees - bass Note: Chords lacking quality AND interval information are major. - If a quality is specified, it is returned. ...
python
def split(chord_label, reduce_extended_chords=False): """Parse a chord label into its four constituent parts: - root - quality shorthand - scale degrees - bass Note: Chords lacking quality AND interval information are major. - If a quality is specified, it is returned. ...
Parse a chord label into its four constituent parts: - root - quality shorthand - scale degrees - bass Note: Chords lacking quality AND interval information are major. - If a quality is specified, it is returned. - If an interval is specified WITHOUT a quality, the quali...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L360-L431
craffel/mir_eval
mir_eval/chord.py
join
def join(chord_root, quality='', extensions=None, bass=''): r"""Join the parts of a chord into a complete chord label. Parameters ---------- chord_root : str Root pitch class of the chord, e.g. 'C', 'Eb' quality : str Quality of the chord, e.g. 'maj', 'hdim7' (Default value ...
python
def join(chord_root, quality='', extensions=None, bass=''): r"""Join the parts of a chord into a complete chord label. Parameters ---------- chord_root : str Root pitch class of the chord, e.g. 'C', 'Eb' quality : str Quality of the chord, e.g. 'maj', 'hdim7' (Default value ...
r"""Join the parts of a chord into a complete chord label. Parameters ---------- chord_root : str Root pitch class of the chord, e.g. 'C', 'Eb' quality : str Quality of the chord, e.g. 'maj', 'hdim7' (Default value = '') extensions : list Any added or absent scaled d...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L434-L465
craffel/mir_eval
mir_eval/chord.py
encode
def encode(chord_label, reduce_extended_chords=False, strict_bass_intervals=False): """Translate a chord label to numerical representations for evaluation. Parameters ---------- chord_label : str Chord label to encode. reduce_extended_chords : bool Whether to map the uppe...
python
def encode(chord_label, reduce_extended_chords=False, strict_bass_intervals=False): """Translate a chord label to numerical representations for evaluation. Parameters ---------- chord_label : str Chord label to encode. reduce_extended_chords : bool Whether to map the uppe...
Translate a chord label to numerical representations for evaluation. Parameters ---------- chord_label : str Chord label to encode. reduce_extended_chords : bool Whether to map the upper voicings of extended chords (9's, 11's, 13's) to semitone extensions. (Default value...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L469-L520
craffel/mir_eval
mir_eval/chord.py
encode_many
def encode_many(chord_labels, reduce_extended_chords=False): """Translate a set of chord labels to numerical representations for sane evaluation. Parameters ---------- chord_labels : list Set of chord labels to encode. reduce_extended_chords : bool Whether to map the upper voici...
python
def encode_many(chord_labels, reduce_extended_chords=False): """Translate a set of chord labels to numerical representations for sane evaluation. Parameters ---------- chord_labels : list Set of chord labels to encode. reduce_extended_chords : bool Whether to map the upper voici...
Translate a set of chord labels to numerical representations for sane evaluation. Parameters ---------- chord_labels : list Set of chord labels to encode. reduce_extended_chords : bool Whether to map the upper voicings of extended chords (9's, 11's, 13's) to semitone extensi...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L523-L556
craffel/mir_eval
mir_eval/chord.py
rotate_bitmap_to_root
def rotate_bitmap_to_root(bitmap, chord_root): """Circularly shift a relative bitmap to its asbolute pitch classes. For clarity, the best explanation is an example. Given 'G:Maj', the root and quality map are as follows:: root=5 quality=[1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0] # Relative chor...
python
def rotate_bitmap_to_root(bitmap, chord_root): """Circularly shift a relative bitmap to its asbolute pitch classes. For clarity, the best explanation is an example. Given 'G:Maj', the root and quality map are as follows:: root=5 quality=[1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0] # Relative chor...
Circularly shift a relative bitmap to its asbolute pitch classes. For clarity, the best explanation is an example. Given 'G:Maj', the root and quality map are as follows:: root=5 quality=[1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0] # Relative chord shape After rotating to the root, the resulting...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L559-L591
craffel/mir_eval
mir_eval/chord.py
rotate_bitmaps_to_roots
def rotate_bitmaps_to_roots(bitmaps, roots): """Circularly shift a relative bitmaps to asbolute pitch classes. See :func:`rotate_bitmap_to_root` for more information. Parameters ---------- bitmap : np.ndarray, shape=(N, 12) Bitmap of active notes, relative to the given root. root : np....
python
def rotate_bitmaps_to_roots(bitmaps, roots): """Circularly shift a relative bitmaps to asbolute pitch classes. See :func:`rotate_bitmap_to_root` for more information. Parameters ---------- bitmap : np.ndarray, shape=(N, 12) Bitmap of active notes, relative to the given root. root : np....
Circularly shift a relative bitmaps to asbolute pitch classes. See :func:`rotate_bitmap_to_root` for more information. Parameters ---------- bitmap : np.ndarray, shape=(N, 12) Bitmap of active notes, relative to the given root. root : np.ndarray, shape=(N,) Absolute pitch class num...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L594-L615
craffel/mir_eval
mir_eval/chord.py
validate
def validate(reference_labels, estimated_labels): """Checks that the input annotations to a comparison function look like valid chord labels. Parameters ---------- reference_labels : list, len=n Reference chord labels to score against. estimated_labels : list, len=n Estimated ch...
python
def validate(reference_labels, estimated_labels): """Checks that the input annotations to a comparison function look like valid chord labels. Parameters ---------- reference_labels : list, len=n Reference chord labels to score against. estimated_labels : list, len=n Estimated ch...
Checks that the input annotations to a comparison function look like valid chord labels. Parameters ---------- reference_labels : list, len=n Reference chord labels to score against. estimated_labels : list, len=n Estimated chord labels to score against.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L619-L644
craffel/mir_eval
mir_eval/chord.py
weighted_accuracy
def weighted_accuracy(comparisons, weights): """Compute the weighted accuracy of a list of chord comparisons. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est...
python
def weighted_accuracy(comparisons, weights): """Compute the weighted accuracy of a list of chord comparisons. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est...
Compute the weighted accuracy of a list of chord comparisons. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_intervals, est_labels = mir_eval....
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L647-L709
craffel/mir_eval
mir_eval/chord.py
thirds
def thirds(reference_labels, estimated_labels): """Compare chords along root & third relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') ...
python
def thirds(reference_labels, estimated_labels): """Compare chords along root & third relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') ...
Compare chords along root & third relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_intervals, est_labels = mir_eval.util.adjust_i...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L712-L756
craffel/mir_eval
mir_eval/chord.py
thirds_inv
def thirds_inv(reference_labels, estimated_labels): """Score chords along root, third, & bass relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est....
python
def thirds_inv(reference_labels, estimated_labels): """Score chords along root, third, & bass relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est....
Score chords along root, third, & bass relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_intervals, est_labels = mir_eval.util.adj...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L759-L804
craffel/mir_eval
mir_eval/chord.py
triads
def triads(reference_labels, estimated_labels): """Compare chords along triad (root & quality to #5) relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_interval...
python
def triads(reference_labels, estimated_labels): """Compare chords along triad (root & quality to #5) relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_interval...
Compare chords along triad (root & quality to #5) relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_intervals, est_labels = mir_ev...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L807-L852
craffel/mir_eval
mir_eval/chord.py
triads_inv
def triads_inv(reference_labels, estimated_labels): """Score chords along triad (root, quality to #5, & bass) relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled...
python
def triads_inv(reference_labels, estimated_labels): """Score chords along triad (root, quality to #5, & bass) relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled...
Score chords along triad (root, quality to #5, & bass) relationships. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_intervals, est_labels = m...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L855-L901
craffel/mir_eval
mir_eval/chord.py
root
def root(reference_labels, estimated_labels): """Compare chords according to roots. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_interva...
python
def root(reference_labels, estimated_labels): """Compare chords according to roots. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_interva...
Compare chords according to roots. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_intervals, est_labels = mir_eval.util.adjust_intervals( ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L999-L1042
craffel/mir_eval
mir_eval/chord.py
mirex
def mirex(reference_labels, estimated_labels): """Compare chords along MIREX rules. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_interva...
python
def mirex(reference_labels, estimated_labels): """Compare chords along MIREX rules. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_interva...
Compare chords along MIREX rules. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> est_intervals, est_labels = mir_eval.util.adjust_intervals( ....
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L1045-L1104
craffel/mir_eval
mir_eval/chord.py
majmin
def majmin(reference_labels, estimated_labels): """Compare chords along major-minor rules. Chords with qualities outside Major/minor/no-chord are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_...
python
def majmin(reference_labels, estimated_labels): """Compare chords along major-minor rules. Chords with qualities outside Major/minor/no-chord are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_...
Compare chords along major-minor rules. Chords with qualities outside Major/minor/no-chord are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab')...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L1107-L1170
craffel/mir_eval
mir_eval/chord.py
majmin_inv
def majmin_inv(reference_labels, estimated_labels): """Compare chords along major-minor rules, with inversions. Chords with qualities outside Major/minor/no-chord are ignored, and the bass note must exist in the triad (bass in [1, 3, 5]). Examples -------- >>> (ref_intervals, ... ref_label...
python
def majmin_inv(reference_labels, estimated_labels): """Compare chords along major-minor rules, with inversions. Chords with qualities outside Major/minor/no-chord are ignored, and the bass note must exist in the triad (bass in [1, 3, 5]). Examples -------- >>> (ref_intervals, ... ref_label...
Compare chords along major-minor rules, with inversions. Chords with qualities outside Major/minor/no-chord are ignored, and the bass note must exist in the triad (bass in [1, 3, 5]). Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L1173-L1235
craffel/mir_eval
mir_eval/chord.py
sevenths
def sevenths(reference_labels, estimated_labels): """Compare chords along MIREX 'sevenths' rules. Chords with qualities outside [maj, maj7, 7, min, min7, N] are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals...
python
def sevenths(reference_labels, estimated_labels): """Compare chords along MIREX 'sevenths' rules. Chords with qualities outside [maj, maj7, 7, min, min7, N] are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals...
Compare chords along MIREX 'sevenths' rules. Chords with qualities outside [maj, maj7, 7, min, min7, N] are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_interva...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L1238-L1290
craffel/mir_eval
mir_eval/chord.py
sevenths_inv
def sevenths_inv(reference_labels, estimated_labels): """Compare chords along MIREX 'sevenths' rules. Chords with qualities outside [maj, maj7, 7, min, min7, N] are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_inter...
python
def sevenths_inv(reference_labels, estimated_labels): """Compare chords along MIREX 'sevenths' rules. Chords with qualities outside [maj, maj7, 7, min, min7, N] are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_inter...
Compare chords along MIREX 'sevenths' rules. Chords with qualities outside [maj, maj7, 7, min, min7, N] are ignored. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_interva...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L1293-L1350
craffel/mir_eval
mir_eval/chord.py
directional_hamming_distance
def directional_hamming_distance(reference_intervals, estimated_intervals): """Compute the directional hamming distance between reference and estimated intervals as defined by [#harte2010towards]_ and used for MIREX 'OverSeg', 'UnderSeg' and 'MeanSeg' measures. Examples -------- >>> (ref_interv...
python
def directional_hamming_distance(reference_intervals, estimated_intervals): """Compute the directional hamming distance between reference and estimated intervals as defined by [#harte2010towards]_ and used for MIREX 'OverSeg', 'UnderSeg' and 'MeanSeg' measures. Examples -------- >>> (ref_interv...
Compute the directional hamming distance between reference and estimated intervals as defined by [#harte2010towards]_ and used for MIREX 'OverSeg', 'UnderSeg' and 'MeanSeg' measures. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L1353-L1398
craffel/mir_eval
mir_eval/chord.py
seg
def seg(reference_intervals, estimated_intervals): """Compute the MIREX 'MeanSeg' score. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> score ...
python
def seg(reference_intervals, estimated_intervals): """Compute the MIREX 'MeanSeg' score. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> score ...
Compute the MIREX 'MeanSeg' score. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.lab') >>> score = mir_eval.chord.seg(ref_intervals, est_intervals) Pa...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L1455-L1480
craffel/mir_eval
mir_eval/chord.py
merge_chord_intervals
def merge_chord_intervals(intervals, labels): """ Merge consecutive chord intervals if they represent the same chord. Parameters ---------- intervals : np.ndarray, shape=(n, 2), dtype=float Chord intervals to be merged, in the format returned by :func:`mir_eval.io.load_labeled_inter...
python
def merge_chord_intervals(intervals, labels): """ Merge consecutive chord intervals if they represent the same chord. Parameters ---------- intervals : np.ndarray, shape=(n, 2), dtype=float Chord intervals to be merged, in the format returned by :func:`mir_eval.io.load_labeled_inter...
Merge consecutive chord intervals if they represent the same chord. Parameters ---------- intervals : np.ndarray, shape=(n, 2), dtype=float Chord intervals to be merged, in the format returned by :func:`mir_eval.io.load_labeled_intervals`. labels : list, shape=(n,) Chord labels ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L1483-L1514
craffel/mir_eval
mir_eval/chord.py
evaluate
def evaluate(ref_intervals, ref_labels, est_intervals, est_labels, **kwargs): """Computes weighted accuracy for all comparison functions for the given reference and estimated annotations. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') ...
python
def evaluate(ref_intervals, ref_labels, est_intervals, est_labels, **kwargs): """Computes weighted accuracy for all comparison functions for the given reference and estimated annotations. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') ...
Computes weighted accuracy for all comparison functions for the given reference and estimated annotations. Examples -------- >>> (ref_intervals, ... ref_labels) = mir_eval.io.load_labeled_intervals('ref.lab') >>> (est_intervals, ... est_labels) = mir_eval.io.load_labeled_intervals('est.la...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/chord.py#L1517-L1604
craffel/mir_eval
mir_eval/pattern.py
_n_onset_midi
def _n_onset_midi(patterns): """Computes the number of onset_midi objects in a pattern Parameters ---------- patterns : A list of patterns using the format returned by :func:`mir_eval.io.load_patterns()` Returns ------- n_onsets : int Number of onsets within the pat...
python
def _n_onset_midi(patterns): """Computes the number of onset_midi objects in a pattern Parameters ---------- patterns : A list of patterns using the format returned by :func:`mir_eval.io.load_patterns()` Returns ------- n_onsets : int Number of onsets within the pat...
Computes the number of onset_midi objects in a pattern Parameters ---------- patterns : A list of patterns using the format returned by :func:`mir_eval.io.load_patterns()` Returns ------- n_onsets : int Number of onsets within the pattern.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L64-L79
craffel/mir_eval
mir_eval/pattern.py
validate
def validate(reference_patterns, estimated_patterns): """Checks that the input annotations to a metric look like valid pattern lists, and throws helpful errors if not. Parameters ---------- reference_patterns : list The reference patterns using the format returned by :func:`mir_eval...
python
def validate(reference_patterns, estimated_patterns): """Checks that the input annotations to a metric look like valid pattern lists, and throws helpful errors if not. Parameters ---------- reference_patterns : list The reference patterns using the format returned by :func:`mir_eval...
Checks that the input annotations to a metric look like valid pattern lists, and throws helpful errors if not. Parameters ---------- reference_patterns : list The reference patterns using the format returned by :func:`mir_eval.io.load_patterns()` estimated_patterns : list Th...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L82-L112
craffel/mir_eval
mir_eval/pattern.py
_occurrence_intersection
def _occurrence_intersection(occ_P, occ_Q): """Computes the intersection between two occurrences. Parameters ---------- occ_P : list of tuples (onset, midi) pairs representing the reference occurrence. occ_Q : list second list of (onset, midi) tuples Returns ------- S :...
python
def _occurrence_intersection(occ_P, occ_Q): """Computes the intersection between two occurrences. Parameters ---------- occ_P : list of tuples (onset, midi) pairs representing the reference occurrence. occ_Q : list second list of (onset, midi) tuples Returns ------- S :...
Computes the intersection between two occurrences. Parameters ---------- occ_P : list of tuples (onset, midi) pairs representing the reference occurrence. occ_Q : list second list of (onset, midi) tuples Returns ------- S : set Set of the intersection between occ_P ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L115-L133
craffel/mir_eval
mir_eval/pattern.py
_compute_score_matrix
def _compute_score_matrix(P, Q, similarity_metric="cardinality_score"): """Computes the score matrix between the patterns P and Q. Parameters ---------- P : list Pattern containing a list of occurrences. Q : list Pattern containing a list of occurrences. similarity_metric : str ...
python
def _compute_score_matrix(P, Q, similarity_metric="cardinality_score"): """Computes the score matrix between the patterns P and Q. Parameters ---------- P : list Pattern containing a list of occurrences. Q : list Pattern containing a list of occurrences. similarity_metric : str ...
Computes the score matrix between the patterns P and Q. Parameters ---------- P : list Pattern containing a list of occurrences. Q : list Pattern containing a list of occurrences. similarity_metric : str A string representing the metric to be used when computing the ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L136-L170
craffel/mir_eval
mir_eval/pattern.py
standard_FPR
def standard_FPR(reference_patterns, estimated_patterns, tol=1e-5): """Standard F1 Score, Precision and Recall. This metric checks if the prototype patterns of the reference match possible translated patterns in the prototype patterns of the estimations. Since the sizes of these prototypes must be equa...
python
def standard_FPR(reference_patterns, estimated_patterns, tol=1e-5): """Standard F1 Score, Precision and Recall. This metric checks if the prototype patterns of the reference match possible translated patterns in the prototype patterns of the estimations. Since the sizes of these prototypes must be equa...
Standard F1 Score, Precision and Recall. This metric checks if the prototype patterns of the reference match possible translated patterns in the prototype patterns of the estimations. Since the sizes of these prototypes must be equal, this metric is quite restictive and it tends to be 0 in most of 2013...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L173-L239
craffel/mir_eval
mir_eval/pattern.py
establishment_FPR
def establishment_FPR(reference_patterns, estimated_patterns, similarity_metric="cardinality_score"): """Establishment F1 Score, Precision and Recall. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns...
python
def establishment_FPR(reference_patterns, estimated_patterns, similarity_metric="cardinality_score"): """Establishment F1 Score, Precision and Recall. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns...
Establishment F1 Score, Precision and Recall. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns("est_pattern.txt") >>> F, P, R = mir_eval.pattern.establishment_FPR(ref_patterns, ... ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L242-L303
craffel/mir_eval
mir_eval/pattern.py
occurrence_FPR
def occurrence_FPR(reference_patterns, estimated_patterns, thres=.75, similarity_metric="cardinality_score"): """Establishment F1 Score, Precision and Recall. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_pa...
python
def occurrence_FPR(reference_patterns, estimated_patterns, thres=.75, similarity_metric="cardinality_score"): """Establishment F1 Score, Precision and Recall. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_pa...
Establishment F1 Score, Precision and Recall. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns("est_pattern.txt") >>> F, P, R = mir_eval.pattern.occurrence_FPR(ref_patterns, ... ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L306-L387
craffel/mir_eval
mir_eval/pattern.py
three_layer_FPR
def three_layer_FPR(reference_patterns, estimated_patterns): """Three Layer F1 Score, Precision and Recall. As described by Meridith. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns("est_pattern.txt") >>> F, P, R = m...
python
def three_layer_FPR(reference_patterns, estimated_patterns): """Three Layer F1 Score, Precision and Recall. As described by Meridith. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns("est_pattern.txt") >>> F, P, R = m...
Three Layer F1 Score, Precision and Recall. As described by Meridith. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns("est_pattern.txt") >>> F, P, R = mir_eval.pattern.three_layer_FPR(ref_patterns, ... ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L390-L520
craffel/mir_eval
mir_eval/pattern.py
first_n_three_layer_P
def first_n_three_layer_P(reference_patterns, estimated_patterns, n=5): """First n three-layer precision. This metric is basically the same as the three-layer FPR but it is only applied to the first n estimated patterns, and it only returns the precision. In MIREX and typically, n = 5. Examples ...
python
def first_n_three_layer_P(reference_patterns, estimated_patterns, n=5): """First n three-layer precision. This metric is basically the same as the three-layer FPR but it is only applied to the first n estimated patterns, and it only returns the precision. In MIREX and typically, n = 5. Examples ...
First n three-layer precision. This metric is basically the same as the three-layer FPR but it is only applied to the first n estimated patterns, and it only returns the precision. In MIREX and typically, n = 5. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L523-L568
craffel/mir_eval
mir_eval/pattern.py
first_n_target_proportion_R
def first_n_target_proportion_R(reference_patterns, estimated_patterns, n=5): """First n target proportion establishment recall metric. This metric is similar is similar to the establishment FPR score, but it only takes into account the first n estimated patterns and it only outputs the Recall value of...
python
def first_n_target_proportion_R(reference_patterns, estimated_patterns, n=5): """First n target proportion establishment recall metric. This metric is similar is similar to the establishment FPR score, but it only takes into account the first n estimated patterns and it only outputs the Recall value of...
First n target proportion establishment recall metric. This metric is similar is similar to the establishment FPR score, but it only takes into account the first n estimated patterns and it only outputs the Recall value of it. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L571-L614
craffel/mir_eval
mir_eval/pattern.py
evaluate
def evaluate(ref_patterns, est_patterns, **kwargs): """Load data and perform the evaluation. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns("est_pattern.txt") >>> scores = mir_eval.pattern.evaluate(ref_patterns, est...
python
def evaluate(ref_patterns, est_patterns, **kwargs): """Load data and perform the evaluation. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns("est_pattern.txt") >>> scores = mir_eval.pattern.evaluate(ref_patterns, est...
Load data and perform the evaluation. Examples -------- >>> ref_patterns = mir_eval.io.load_patterns("ref_pattern.txt") >>> est_patterns = mir_eval.io.load_patterns("est_pattern.txt") >>> scores = mir_eval.pattern.evaluate(ref_patterns, est_patterns) Parameters ---------- ref_patterns ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/pattern.py#L617-L683
craffel/mir_eval
mir_eval/transcription_velocity.py
validate
def validate(ref_intervals, ref_pitches, ref_velocities, est_intervals, est_pitches, est_velocities): """Checks that the input annotations have valid time intervals, pitches, and velocities, and throws helpful errors if not. Parameters ---------- ref_intervals : np.ndarray, shape=(n,2)...
python
def validate(ref_intervals, ref_pitches, ref_velocities, est_intervals, est_pitches, est_velocities): """Checks that the input annotations have valid time intervals, pitches, and velocities, and throws helpful errors if not. Parameters ---------- ref_intervals : np.ndarray, shape=(n,2)...
Checks that the input annotations have valid time intervals, pitches, and velocities, and throws helpful errors if not. Parameters ---------- ref_intervals : np.ndarray, shape=(n,2) Array of reference notes time intervals (onset and offset times) ref_pitches : np.ndarray, shape=(n,) ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/transcription_velocity.py#L62-L95
craffel/mir_eval
mir_eval/transcription_velocity.py
match_notes
def match_notes( ref_intervals, ref_pitches, ref_velocities, est_intervals, est_pitches, est_velocities, onset_tolerance=0.05, pitch_tolerance=50.0, offset_ratio=0.2, offset_min_tolerance=0.05, strict=False, velocity_tolerance=0.1): """Match notes, taking note velocity into considera...
python
def match_notes( ref_intervals, ref_pitches, ref_velocities, est_intervals, est_pitches, est_velocities, onset_tolerance=0.05, pitch_tolerance=50.0, offset_ratio=0.2, offset_min_tolerance=0.05, strict=False, velocity_tolerance=0.1): """Match notes, taking note velocity into considera...
Match notes, taking note velocity into consideration. This function first calls :func:`mir_eval.transcription.match_notes` to match notes according to the supplied intervals, pitches, onset, offset, and pitch tolerances. The velocities of the matched notes are then used to estimate a slope and intercep...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/transcription_velocity.py#L98-L201
craffel/mir_eval
mir_eval/transcription_velocity.py
evaluate
def evaluate(ref_intervals, ref_pitches, ref_velocities, est_intervals, est_pitches, est_velocities, **kwargs): """Compute all metrics for the given reference and estimated annotations. Parameters ---------- ref_intervals : np.ndarray, shape=(n,2) Array of reference notes time inte...
python
def evaluate(ref_intervals, ref_pitches, ref_velocities, est_intervals, est_pitches, est_velocities, **kwargs): """Compute all metrics for the given reference and estimated annotations. Parameters ---------- ref_intervals : np.ndarray, shape=(n,2) Array of reference notes time inte...
Compute all metrics for the given reference and estimated annotations. Parameters ---------- ref_intervals : np.ndarray, shape=(n,2) Array of reference notes time intervals (onset and offset times) ref_pitches : np.ndarray, shape=(n,) Array of reference pitch values in Hertz ref_vel...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/transcription_velocity.py#L306-L357
craffel/mir_eval
mir_eval/beat.py
validate
def validate(reference_beats, estimated_beats): """Checks that the input annotations to a metric look like valid beat time arrays, and throws helpful errors if not. Parameters ---------- reference_beats : np.ndarray reference beat times, in seconds estimated_beats : np.ndarray e...
python
def validate(reference_beats, estimated_beats): """Checks that the input annotations to a metric look like valid beat time arrays, and throws helpful errors if not. Parameters ---------- reference_beats : np.ndarray reference beat times, in seconds estimated_beats : np.ndarray e...
Checks that the input annotations to a metric look like valid beat time arrays, and throws helpful errors if not. Parameters ---------- reference_beats : np.ndarray reference beat times, in seconds estimated_beats : np.ndarray estimated beat times, in seconds
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L77-L95
craffel/mir_eval
mir_eval/beat.py
_get_reference_beat_variations
def _get_reference_beat_variations(reference_beats): """Return metric variations of the reference beats Parameters ---------- reference_beats : np.ndarray beat locations in seconds Returns ------- reference_beats : np.ndarray Original beat locations off_beat : np.ndarra...
python
def _get_reference_beat_variations(reference_beats): """Return metric variations of the reference beats Parameters ---------- reference_beats : np.ndarray beat locations in seconds Returns ------- reference_beats : np.ndarray Original beat locations off_beat : np.ndarra...
Return metric variations of the reference beats Parameters ---------- reference_beats : np.ndarray beat locations in seconds Returns ------- reference_beats : np.ndarray Original beat locations off_beat : np.ndarray 180 degrees out of phase from the original beat lo...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L98-L133
craffel/mir_eval
mir_eval/beat.py
f_measure
def f_measure(reference_beats, estimated_beats, f_measure_threshold=0.07): """Compute the F-measure of correct vs incorrectly predicted beats. "Correctness" is determined over a small window. Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt'...
python
def f_measure(reference_beats, estimated_beats, f_measure_threshold=0.07): """Compute the F-measure of correct vs incorrectly predicted beats. "Correctness" is determined over a small window. Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt'...
Compute the F-measure of correct vs incorrectly predicted beats. "Correctness" is determined over a small window. Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> reference_beats = mir_eval.beat.trim_beats(reference_beats) >>> estimated_beats = mir_eval.io.lo...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L136-L178
craffel/mir_eval
mir_eval/beat.py
cemgil
def cemgil(reference_beats, estimated_beats, cemgil_sigma=0.04): """Cemgil's score, computes a gaussian error of each estimated beat. Compares against the original beat times and all metrical variations. Examples -------- >>> reference_beats = mir_eval.io.load_events('referenc...
python
def cemgil(reference_beats, estimated_beats, cemgil_sigma=0.04): """Cemgil's score, computes a gaussian error of each estimated beat. Compares against the original beat times and all metrical variations. Examples -------- >>> reference_beats = mir_eval.io.load_events('referenc...
Cemgil's score, computes a gaussian error of each estimated beat. Compares against the original beat times and all metrical variations. Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> reference_beats = mir_eval.beat.trim_beats(reference_beats) >>> estimated_...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L181-L233
craffel/mir_eval
mir_eval/beat.py
goto
def goto(reference_beats, estimated_beats, goto_threshold=0.35, goto_mu=0.2, goto_sigma=0.2): """Calculate Goto's score, a binary 1 or 0 depending on some specific heuristic criteria Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt')...
python
def goto(reference_beats, estimated_beats, goto_threshold=0.35, goto_mu=0.2, goto_sigma=0.2): """Calculate Goto's score, a binary 1 or 0 depending on some specific heuristic criteria Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt')...
Calculate Goto's score, a binary 1 or 0 depending on some specific heuristic criteria Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> reference_beats = mir_eval.beat.trim_beats(reference_beats) >>> estimated_beats = mir_eval.io.load_events('estimated.txt') ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L236-L335
craffel/mir_eval
mir_eval/beat.py
p_score
def p_score(reference_beats, estimated_beats, p_score_threshold=0.2): """Get McKinney's P-score. Based on the autocorrelation of the reference and estimated beats Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> reference_beats = mir_e...
python
def p_score(reference_beats, estimated_beats, p_score_threshold=0.2): """Get McKinney's P-score. Based on the autocorrelation of the reference and estimated beats Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> reference_beats = mir_e...
Get McKinney's P-score. Based on the autocorrelation of the reference and estimated beats Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> reference_beats = mir_eval.beat.trim_beats(reference_beats) >>> estimated_beats = mir_eval.io.load_events('estimated.txt...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L338-L412
craffel/mir_eval
mir_eval/beat.py
continuity
def continuity(reference_beats, estimated_beats, continuity_phase_threshold=0.175, continuity_period_threshold=0.175): """Get metrics based on how much of the estimated beat sequence is continually correct. Examples -------- >>> reference_beats = mir_eva...
python
def continuity(reference_beats, estimated_beats, continuity_phase_threshold=0.175, continuity_period_threshold=0.175): """Get metrics based on how much of the estimated beat sequence is continually correct. Examples -------- >>> reference_beats = mir_eva...
Get metrics based on how much of the estimated beat sequence is continually correct. Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> reference_beats = mir_eval.beat.trim_beats(reference_beats) >>> estimated_beats = mir_eval.io.load_events('estimated.txt') ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L415-L577
craffel/mir_eval
mir_eval/beat.py
information_gain
def information_gain(reference_beats, estimated_beats, bins=41): """Get the information gain - K-L divergence of the beat error histogram to a uniform histogram Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> referen...
python
def information_gain(reference_beats, estimated_beats, bins=41): """Get the information gain - K-L divergence of the beat error histogram to a uniform histogram Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> referen...
Get the information gain - K-L divergence of the beat error histogram to a uniform histogram Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> reference_beats = mir_eval.beat.trim_beats(reference_beats) >>> estimated_beats = mir_eval.io.load_events('estimated....
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L580-L639
craffel/mir_eval
mir_eval/beat.py
_get_entropy
def _get_entropy(reference_beats, estimated_beats, bins): """Helper function for information gain (needs to be run twice - once backwards, once forwards) Parameters ---------- reference_beats : np.ndarray reference beat times, in seconds estimated_beats : np.ndarray query beat t...
python
def _get_entropy(reference_beats, estimated_beats, bins): """Helper function for information gain (needs to be run twice - once backwards, once forwards) Parameters ---------- reference_beats : np.ndarray reference beat times, in seconds estimated_beats : np.ndarray query beat t...
Helper function for information gain (needs to be run twice - once backwards, once forwards) Parameters ---------- reference_beats : np.ndarray reference beat times, in seconds estimated_beats : np.ndarray query beat times, in seconds bins : int Number of bins in the bea...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L642-L701
craffel/mir_eval
mir_eval/beat.py
evaluate
def evaluate(reference_beats, estimated_beats, **kwargs): """Compute all metrics for the given reference and estimated annotations. Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> estimated_beats = mir_eval.io.load_events('estimated.txt') >>> scores = mir_ev...
python
def evaluate(reference_beats, estimated_beats, **kwargs): """Compute all metrics for the given reference and estimated annotations. Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> estimated_beats = mir_eval.io.load_events('estimated.txt') >>> scores = mir_ev...
Compute all metrics for the given reference and estimated annotations. Examples -------- >>> reference_beats = mir_eval.io.load_events('reference.txt') >>> estimated_beats = mir_eval.io.load_events('estimated.txt') >>> scores = mir_eval.beat.evaluate(reference_beats, estimated_beats) Parameter...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/beat.py#L704-L770
craffel/mir_eval
mir_eval/util.py
index_labels
def index_labels(labels, case_sensitive=False): """Convert a list of string identifiers into numerical indices. Parameters ---------- labels : list of strings, shape=(n,) A list of annotations, e.g., segment or chord labels from an annotation file. case_sensitive : bool Set...
python
def index_labels(labels, case_sensitive=False): """Convert a list of string identifiers into numerical indices. Parameters ---------- labels : list of strings, shape=(n,) A list of annotations, e.g., segment or chord labels from an annotation file. case_sensitive : bool Set...
Convert a list of string identifiers into numerical indices. Parameters ---------- labels : list of strings, shape=(n,) A list of annotations, e.g., segment or chord labels from an annotation file. case_sensitive : bool Set to True to enable case-sensitive label indexing ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L13-L52
craffel/mir_eval
mir_eval/util.py
generate_labels
def generate_labels(items, prefix='__'): """Given an array of items (e.g. events, intervals), create a synthetic label for each event of the form '(label prefix)(item number)' Parameters ---------- items : list-like A list or array of events or intervals prefix : str This prefix...
python
def generate_labels(items, prefix='__'): """Given an array of items (e.g. events, intervals), create a synthetic label for each event of the form '(label prefix)(item number)' Parameters ---------- items : list-like A list or array of events or intervals prefix : str This prefix...
Given an array of items (e.g. events, intervals), create a synthetic label for each event of the form '(label prefix)(item number)' Parameters ---------- items : list-like A list or array of events or intervals prefix : str This prefix will be prepended to all synthetically generate...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L55-L73
craffel/mir_eval
mir_eval/util.py
intervals_to_samples
def intervals_to_samples(intervals, labels, offset=0, sample_size=0.1, fill_value=None): """Convert an array of labeled time intervals to annotated samples. Parameters ---------- intervals : np.ndarray, shape=(n, d) An array of time intervals, as returned by :fu...
python
def intervals_to_samples(intervals, labels, offset=0, sample_size=0.1, fill_value=None): """Convert an array of labeled time intervals to annotated samples. Parameters ---------- intervals : np.ndarray, shape=(n, d) An array of time intervals, as returned by :fu...
Convert an array of labeled time intervals to annotated samples. Parameters ---------- intervals : np.ndarray, shape=(n, d) An array of time intervals, as returned by :func:`mir_eval.io.load_intervals()` or :func:`mir_eval.io.load_labeled_intervals()`. The ``i`` th interval ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L76-L126
craffel/mir_eval
mir_eval/util.py
interpolate_intervals
def interpolate_intervals(intervals, labels, time_points, fill_value=None): """Assign labels to a set of points in time given a set of intervals. Time points that do not lie within an interval are mapped to `fill_value`. Parameters ---------- intervals : np.ndarray, shape=(n, 2) An array o...
python
def interpolate_intervals(intervals, labels, time_points, fill_value=None): """Assign labels to a set of points in time given a set of intervals. Time points that do not lie within an interval are mapped to `fill_value`. Parameters ---------- intervals : np.ndarray, shape=(n, 2) An array o...
Assign labels to a set of points in time given a set of intervals. Time points that do not lie within an interval are mapped to `fill_value`. Parameters ---------- intervals : np.ndarray, shape=(n, 2) An array of time intervals, as returned by :func:`mir_eval.io.load_intervals()`. ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L129-L180
craffel/mir_eval
mir_eval/util.py
sort_labeled_intervals
def sort_labeled_intervals(intervals, labels=None): '''Sort intervals, and optionally, their corresponding labels according to start time. Parameters ---------- intervals : np.ndarray, shape=(n, 2) The input intervals labels : list, optional Labels for each interval Return...
python
def sort_labeled_intervals(intervals, labels=None): '''Sort intervals, and optionally, their corresponding labels according to start time. Parameters ---------- intervals : np.ndarray, shape=(n, 2) The input intervals labels : list, optional Labels for each interval Return...
Sort intervals, and optionally, their corresponding labels according to start time. Parameters ---------- intervals : np.ndarray, shape=(n, 2) The input intervals labels : list, optional Labels for each interval Returns ------- intervals_sorted or (intervals_sorted, la...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L183-L208
craffel/mir_eval
mir_eval/util.py
f_measure
def f_measure(precision, recall, beta=1.0): """Compute the f-measure from precision and recall scores. Parameters ---------- precision : float in (0, 1] Precision recall : float in (0, 1] Recall beta : float > 0 Weighting factor for f-measure (Default value = 1.0...
python
def f_measure(precision, recall, beta=1.0): """Compute the f-measure from precision and recall scores. Parameters ---------- precision : float in (0, 1] Precision recall : float in (0, 1] Recall beta : float > 0 Weighting factor for f-measure (Default value = 1.0...
Compute the f-measure from precision and recall scores. Parameters ---------- precision : float in (0, 1] Precision recall : float in (0, 1] Recall beta : float > 0 Weighting factor for f-measure (Default value = 1.0) Returns ------- f_measure : float ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L211-L234
craffel/mir_eval
mir_eval/util.py
intervals_to_boundaries
def intervals_to_boundaries(intervals, q=5): """Convert interval times into boundaries. Parameters ---------- intervals : np.ndarray, shape=(n_events, 2) Array of interval start and end-times q : int Number of decimals to round to. (Default value = 5) Returns ------- bo...
python
def intervals_to_boundaries(intervals, q=5): """Convert interval times into boundaries. Parameters ---------- intervals : np.ndarray, shape=(n_events, 2) Array of interval start and end-times q : int Number of decimals to round to. (Default value = 5) Returns ------- bo...
Convert interval times into boundaries. Parameters ---------- intervals : np.ndarray, shape=(n_events, 2) Array of interval start and end-times q : int Number of decimals to round to. (Default value = 5) Returns ------- boundaries : np.ndarray Interval boundary time...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L237-L254
craffel/mir_eval
mir_eval/util.py
boundaries_to_intervals
def boundaries_to_intervals(boundaries): """Convert an array of event times into intervals Parameters ---------- boundaries : list-like List-like of event times. These are assumed to be unique timestamps in ascending order. Returns ------- intervals : np.ndarray, shape=(n_...
python
def boundaries_to_intervals(boundaries): """Convert an array of event times into intervals Parameters ---------- boundaries : list-like List-like of event times. These are assumed to be unique timestamps in ascending order. Returns ------- intervals : np.ndarray, shape=(n_...
Convert an array of event times into intervals Parameters ---------- boundaries : list-like List-like of event times. These are assumed to be unique timestamps in ascending order. Returns ------- intervals : np.ndarray, shape=(n_intervals, 2) Start and end time for eac...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L257-L277
craffel/mir_eval
mir_eval/util.py
adjust_intervals
def adjust_intervals(intervals, labels=None, t_min=0.0, t_max=None, start_label='__T_MIN', end_label='__T_MAX'): """Adjust a list of time intervals to span the range ``[t_min, t_max]``. Any intervals lying ...
python
def adjust_intervals(intervals, labels=None, t_min=0.0, t_max=None, start_label='__T_MIN', end_label='__T_MAX'): """Adjust a list of time intervals to span the range ``[t_min, t_max]``. Any intervals lying ...
Adjust a list of time intervals to span the range ``[t_min, t_max]``. Any intervals lying completely outside the specified range will be removed. Any intervals lying partially outside the specified range will be cropped. If the specified range exceeds the span of the provided data in either direction...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L280-L376
craffel/mir_eval
mir_eval/util.py
adjust_events
def adjust_events(events, labels=None, t_min=0.0, t_max=None, label_prefix='__'): """Adjust the given list of event times to span the range ``[t_min, t_max]``. Any event times outside of the specified range will be removed. If the times do not span ``[t_min, t_max]``, additional even...
python
def adjust_events(events, labels=None, t_min=0.0, t_max=None, label_prefix='__'): """Adjust the given list of event times to span the range ``[t_min, t_max]``. Any event times outside of the specified range will be removed. If the times do not span ``[t_min, t_max]``, additional even...
Adjust the given list of event times to span the range ``[t_min, t_max]``. Any event times outside of the specified range will be removed. If the times do not span ``[t_min, t_max]``, additional events will be added with the prefix ``label_prefix``. Parameters ---------- events : np.ndarr...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L379-L445
craffel/mir_eval
mir_eval/util.py
intersect_files
def intersect_files(flist1, flist2): """Return the intersection of two sets of filepaths, based on the file name (after the final '/') and ignoring the file extension. Examples -------- >>> flist1 = ['/a/b/abc.lab', '/c/d/123.lab', '/e/f/xyz.lab'] >>> flist2 = ['/g/h/xyz.npy', '/i/j/123.txt',...
python
def intersect_files(flist1, flist2): """Return the intersection of two sets of filepaths, based on the file name (after the final '/') and ignoring the file extension. Examples -------- >>> flist1 = ['/a/b/abc.lab', '/c/d/123.lab', '/e/f/xyz.lab'] >>> flist2 = ['/g/h/xyz.npy', '/i/j/123.txt',...
Return the intersection of two sets of filepaths, based on the file name (after the final '/') and ignoring the file extension. Examples -------- >>> flist1 = ['/a/b/abc.lab', '/c/d/123.lab', '/e/f/xyz.lab'] >>> flist2 = ['/g/h/xyz.npy', '/i/j/123.txt', '/k/l/456.lab'] >>> sublist1, sublist2...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L448-L498
craffel/mir_eval
mir_eval/util.py
merge_labeled_intervals
def merge_labeled_intervals(x_intervals, x_labels, y_intervals, y_labels): r"""Merge the time intervals of two sequences. Parameters ---------- x_intervals : np.ndarray Array of interval times (seconds) x_labels : list or None List of labels y_intervals : np.ndarray Arra...
python
def merge_labeled_intervals(x_intervals, x_labels, y_intervals, y_labels): r"""Merge the time intervals of two sequences. Parameters ---------- x_intervals : np.ndarray Array of interval times (seconds) x_labels : list or None List of labels y_intervals : np.ndarray Arra...
r"""Merge the time intervals of two sequences. Parameters ---------- x_intervals : np.ndarray Array of interval times (seconds) x_labels : list or None List of labels y_intervals : np.ndarray Array of interval times (seconds) y_labels : list or None List of label...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L501-L544
craffel/mir_eval
mir_eval/util.py
_bipartite_match
def _bipartite_match(graph): """Find maximum cardinality matching of a bipartite graph (U,V,E). The input format is a dictionary mapping members of U to a list of their neighbors in V. The output is a dict M mapping members of V to their matches in U. Parameters ---------- graph : dictiona...
python
def _bipartite_match(graph): """Find maximum cardinality matching of a bipartite graph (U,V,E). The input format is a dictionary mapping members of U to a list of their neighbors in V. The output is a dict M mapping members of V to their matches in U. Parameters ---------- graph : dictiona...
Find maximum cardinality matching of a bipartite graph (U,V,E). The input format is a dictionary mapping members of U to a list of their neighbors in V. The output is a dict M mapping members of V to their matches in U. Parameters ---------- graph : dictionary : left-vertex -> list of right ve...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L547-L634
craffel/mir_eval
mir_eval/util.py
_outer_distance_mod_n
def _outer_distance_mod_n(ref, est, modulus=12): """Compute the absolute outer distance modulo n. Using this distance, d(11, 0) = 1 (modulo 12) Parameters ---------- ref : np.ndarray, shape=(n,) Array of reference values. est : np.ndarray, shape=(m,) Array of estimated values. ...
python
def _outer_distance_mod_n(ref, est, modulus=12): """Compute the absolute outer distance modulo n. Using this distance, d(11, 0) = 1 (modulo 12) Parameters ---------- ref : np.ndarray, shape=(n,) Array of reference values. est : np.ndarray, shape=(m,) Array of estimated values. ...
Compute the absolute outer distance modulo n. Using this distance, d(11, 0) = 1 (modulo 12) Parameters ---------- ref : np.ndarray, shape=(n,) Array of reference values. est : np.ndarray, shape=(m,) Array of estimated values. modulus : int The modulus. 12 by defa...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L637-L660
craffel/mir_eval
mir_eval/util.py
match_events
def match_events(ref, est, window, distance=None): """Compute a maximum matching between reference and estimated event times, subject to a window constraint. Given two lists of event times ``ref`` and ``est``, we seek the largest set of correspondences ``(ref[i], est[j])`` such that ``distance(ref[...
python
def match_events(ref, est, window, distance=None): """Compute a maximum matching between reference and estimated event times, subject to a window constraint. Given two lists of event times ``ref`` and ``est``, we seek the largest set of correspondences ``(ref[i], est[j])`` such that ``distance(ref[...
Compute a maximum matching between reference and estimated event times, subject to a window constraint. Given two lists of event times ``ref`` and ``est``, we seek the largest set of correspondences ``(ref[i], est[j])`` such that ``distance(ref[i], est[j]) <= window``, and each ``ref[i]`` and ``est...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L663-L710
craffel/mir_eval
mir_eval/util.py
_fast_hit_windows
def _fast_hit_windows(ref, est, window): '''Fast calculation of windowed hits for time events. Given two lists of event times ``ref`` and ``est``, and a tolerance window, computes a list of pairings ``(i, j)`` where ``|ref[i] - est[j]| <= window``. This is equivalent to, but more efficient than th...
python
def _fast_hit_windows(ref, est, window): '''Fast calculation of windowed hits for time events. Given two lists of event times ``ref`` and ``est``, and a tolerance window, computes a list of pairings ``(i, j)`` where ``|ref[i] - est[j]| <= window``. This is equivalent to, but more efficient than th...
Fast calculation of windowed hits for time events. Given two lists of event times ``ref`` and ``est``, and a tolerance window, computes a list of pairings ``(i, j)`` where ``|ref[i] - est[j]| <= window``. This is equivalent to, but more efficient than the following: >>> hit_ref, hit_est = np.wher...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L713-L755
craffel/mir_eval
mir_eval/util.py
validate_intervals
def validate_intervals(intervals): """Checks that an (n, 2) interval ndarray is well-formed, and raises errors if not. Parameters ---------- intervals : np.ndarray, shape=(n, 2) Array of interval start/end locations. """ # Validate interval shape if intervals.ndim != 2 or inte...
python
def validate_intervals(intervals): """Checks that an (n, 2) interval ndarray is well-formed, and raises errors if not. Parameters ---------- intervals : np.ndarray, shape=(n, 2) Array of interval start/end locations. """ # Validate interval shape if intervals.ndim != 2 or inte...
Checks that an (n, 2) interval ndarray is well-formed, and raises errors if not. Parameters ---------- intervals : np.ndarray, shape=(n, 2) Array of interval start/end locations.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L758-L780
craffel/mir_eval
mir_eval/util.py
validate_events
def validate_events(events, max_time=30000.): """Checks that a 1-d event location ndarray is well-formed, and raises errors if not. Parameters ---------- events : np.ndarray, shape=(n,) Array of event times max_time : float If an event is found above this time, a ValueError will...
python
def validate_events(events, max_time=30000.): """Checks that a 1-d event location ndarray is well-formed, and raises errors if not. Parameters ---------- events : np.ndarray, shape=(n,) Array of event times max_time : float If an event is found above this time, a ValueError will...
Checks that a 1-d event location ndarray is well-formed, and raises errors if not. Parameters ---------- events : np.ndarray, shape=(n,) Array of event times max_time : float If an event is found above this time, a ValueError will be raised. (Default value = 30000.)
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L783-L808
craffel/mir_eval
mir_eval/util.py
validate_frequencies
def validate_frequencies(frequencies, max_freq, min_freq, allow_negatives=False): """Checks that a 1-d frequency ndarray is well-formed, and raises errors if not. Parameters ---------- frequencies : np.ndarray, shape=(n,) Array of frequency values max_freq : flo...
python
def validate_frequencies(frequencies, max_freq, min_freq, allow_negatives=False): """Checks that a 1-d frequency ndarray is well-formed, and raises errors if not. Parameters ---------- frequencies : np.ndarray, shape=(n,) Array of frequency values max_freq : flo...
Checks that a 1-d frequency ndarray is well-formed, and raises errors if not. Parameters ---------- frequencies : np.ndarray, shape=(n,) Array of frequency values max_freq : float If a frequency is found above this pitch, a ValueError will be raised. (Default value = 5000.) ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L811-L847
craffel/mir_eval
mir_eval/util.py
has_kwargs
def has_kwargs(function): r'''Determine whether a function has \*\*kwargs. Parameters ---------- function : callable The function to test Returns ------- True if function accepts arbitrary keyword arguments. False otherwise. ''' if six.PY2: return inspect.getar...
python
def has_kwargs(function): r'''Determine whether a function has \*\*kwargs. Parameters ---------- function : callable The function to test Returns ------- True if function accepts arbitrary keyword arguments. False otherwise. ''' if six.PY2: return inspect.getar...
r'''Determine whether a function has \*\*kwargs. Parameters ---------- function : callable The function to test Returns ------- True if function accepts arbitrary keyword arguments. False otherwise.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L850-L873
craffel/mir_eval
mir_eval/util.py
filter_kwargs
def filter_kwargs(_function, *args, **kwargs): """Given a function and args and keyword args to pass to it, call the function but using only the keyword arguments which it accepts. This is equivalent to redefining the function with an additional \*\*kwargs to accept slop keyword args. If the targe...
python
def filter_kwargs(_function, *args, **kwargs): """Given a function and args and keyword args to pass to it, call the function but using only the keyword arguments which it accepts. This is equivalent to redefining the function with an additional \*\*kwargs to accept slop keyword args. If the targe...
Given a function and args and keyword args to pass to it, call the function but using only the keyword arguments which it accepts. This is equivalent to redefining the function with an additional \*\*kwargs to accept slop keyword args. If the target function already accepts \*\*kwargs parameters, no f...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L876-L904
craffel/mir_eval
mir_eval/util.py
intervals_to_durations
def intervals_to_durations(intervals): """Converts an array of n intervals to their n durations. Parameters ---------- intervals : np.ndarray, shape=(n, 2) An array of time intervals, as returned by :func:`mir_eval.io.load_intervals()`. The ``i`` th interval spans time ``interva...
python
def intervals_to_durations(intervals): """Converts an array of n intervals to their n durations. Parameters ---------- intervals : np.ndarray, shape=(n, 2) An array of time intervals, as returned by :func:`mir_eval.io.load_intervals()`. The ``i`` th interval spans time ``interva...
Converts an array of n intervals to their n durations. Parameters ---------- intervals : np.ndarray, shape=(n, 2) An array of time intervals, as returned by :func:`mir_eval.io.load_intervals()`. The ``i`` th interval spans time ``intervals[i, 0]`` to ``intervals[i, 1]``. ...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/util.py#L907-L925
craffel/mir_eval
mir_eval/separation.py
validate
def validate(reference_sources, estimated_sources): """Checks that the input data to a metric are valid, and throws helpful errors if not. Parameters ---------- reference_sources : np.ndarray, shape=(nsrc, nsampl) matrix containing true sources estimated_sources : np.ndarray, shape=(nsr...
python
def validate(reference_sources, estimated_sources): """Checks that the input data to a metric are valid, and throws helpful errors if not. Parameters ---------- reference_sources : np.ndarray, shape=(nsrc, nsampl) matrix containing true sources estimated_sources : np.ndarray, shape=(nsr...
Checks that the input data to a metric are valid, and throws helpful errors if not. Parameters ---------- reference_sources : np.ndarray, shape=(nsrc, nsampl) matrix containing true sources estimated_sources : np.ndarray, shape=(nsrc, nsampl) matrix containing estimated sources
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L62-L121
craffel/mir_eval
mir_eval/separation.py
_any_source_silent
def _any_source_silent(sources): """Returns true if the parameter sources has any silent first dimensions""" return np.any(np.all(np.sum( sources, axis=tuple(range(2, sources.ndim))) == 0, axis=1))
python
def _any_source_silent(sources): """Returns true if the parameter sources has any silent first dimensions""" return np.any(np.all(np.sum( sources, axis=tuple(range(2, sources.ndim))) == 0, axis=1))
Returns true if the parameter sources has any silent first dimensions
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L124-L127
craffel/mir_eval
mir_eval/separation.py
bss_eval_sources
def bss_eval_sources(reference_sources, estimated_sources, compute_permutation=True): """ Ordering and measurement of the separation quality for estimated source signals in terms of filtered true source, interference and artifacts. The decomposition allows a time-invariant filter d...
python
def bss_eval_sources(reference_sources, estimated_sources, compute_permutation=True): """ Ordering and measurement of the separation quality for estimated source signals in terms of filtered true source, interference and artifacts. The decomposition allows a time-invariant filter d...
Ordering and measurement of the separation quality for estimated source signals in terms of filtered true source, interference and artifacts. The decomposition allows a time-invariant filter distortion of length 512, as described in Section III.B of [#vincent2006performance]_. Passing ``False`` for ``...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L130-L241
craffel/mir_eval
mir_eval/separation.py
bss_eval_sources_framewise
def bss_eval_sources_framewise(reference_sources, estimated_sources, window=30*44100, hop=15*44100, compute_permutation=False): """Framewise computation of bss_eval_sources Please be aware that this function does not compute permutations (by def...
python
def bss_eval_sources_framewise(reference_sources, estimated_sources, window=30*44100, hop=15*44100, compute_permutation=False): """Framewise computation of bss_eval_sources Please be aware that this function does not compute permutations (by def...
Framewise computation of bss_eval_sources Please be aware that this function does not compute permutations (by default) on the possible relations between reference_sources and estimated_sources due to the dangers of a changing permutation. Therefore (by default), it assumes that ``reference_sources[i]`...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L244-L353
craffel/mir_eval
mir_eval/separation.py
bss_eval_images
def bss_eval_images(reference_sources, estimated_sources, compute_permutation=True): """Implementation of the bss_eval_images function from the BSS_EVAL Matlab toolbox. Ordering and measurement of the separation quality for estimated source signals in terms of filtered true source, ...
python
def bss_eval_images(reference_sources, estimated_sources, compute_permutation=True): """Implementation of the bss_eval_images function from the BSS_EVAL Matlab toolbox. Ordering and measurement of the separation quality for estimated source signals in terms of filtered true source, ...
Implementation of the bss_eval_images function from the BSS_EVAL Matlab toolbox. Ordering and measurement of the separation quality for estimated source signals in terms of filtered true source, interference and artifacts. This method also provides the ISR measure. The decomposition allows a time-...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L356-L490
craffel/mir_eval
mir_eval/separation.py
bss_eval_images_framewise
def bss_eval_images_framewise(reference_sources, estimated_sources, window=30*44100, hop=15*44100, compute_permutation=False): """Framewise computation of bss_eval_images Please be aware that this function does not compute permutations (by default...
python
def bss_eval_images_framewise(reference_sources, estimated_sources, window=30*44100, hop=15*44100, compute_permutation=False): """Framewise computation of bss_eval_images Please be aware that this function does not compute permutations (by default...
Framewise computation of bss_eval_images Please be aware that this function does not compute permutations (by default) on the possible relations between ``reference_sources`` and ``estimated_sources`` due to the dangers of a changing permutation. Therefore (by default), it assumes that ``reference_sour...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L493-L606
craffel/mir_eval
mir_eval/separation.py
_bss_decomp_mtifilt
def _bss_decomp_mtifilt(reference_sources, estimated_source, j, flen): """Decomposition of an estimated source image into four components representing respectively the true source image, spatial (or filtering) distortion, interference and artifacts, derived from the true source images using multichannel...
python
def _bss_decomp_mtifilt(reference_sources, estimated_source, j, flen): """Decomposition of an estimated source image into four components representing respectively the true source image, spatial (or filtering) distortion, interference and artifacts, derived from the true source images using multichannel...
Decomposition of an estimated source image into four components representing respectively the true source image, spatial (or filtering) distortion, interference and artifacts, derived from the true source images using multichannel time-invariant filters.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L609-L628
craffel/mir_eval
mir_eval/separation.py
_bss_decomp_mtifilt_images
def _bss_decomp_mtifilt_images(reference_sources, estimated_source, j, flen, Gj=None, G=None): """Decomposition of an estimated source image into four components representing respectively the true source image, spatial (or filtering) distortion, interference and artifacts, der...
python
def _bss_decomp_mtifilt_images(reference_sources, estimated_source, j, flen, Gj=None, G=None): """Decomposition of an estimated source image into four components representing respectively the true source image, spatial (or filtering) distortion, interference and artifacts, der...
Decomposition of an estimated source image into four components representing respectively the true source image, spatial (or filtering) distortion, interference and artifacts, derived from the true source images using multichannel time-invariant filters. Adapted version to work with multichannel sources...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L631-L676
craffel/mir_eval
mir_eval/separation.py
_project
def _project(reference_sources, estimated_source, flen): """Least-squares projection of estimated source on the subspace spanned by delayed versions of reference sources, with delays between 0 and flen-1 """ nsrc = reference_sources.shape[0] nsampl = reference_sources.shape[1] # computing coeff...
python
def _project(reference_sources, estimated_source, flen): """Least-squares projection of estimated source on the subspace spanned by delayed versions of reference sources, with delays between 0 and flen-1 """ nsrc = reference_sources.shape[0] nsampl = reference_sources.shape[1] # computing coeff...
Least-squares projection of estimated source on the subspace spanned by delayed versions of reference sources, with delays between 0 and flen-1
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L679-L722
craffel/mir_eval
mir_eval/separation.py
_project_images
def _project_images(reference_sources, estimated_source, flen, G=None): """Least-squares projection of estimated source on the subspace spanned by delayed versions of reference sources, with delays between 0 and flen-1. Passing G as all zeros will populate the G matrix and return it so it can be passed ...
python
def _project_images(reference_sources, estimated_source, flen, G=None): """Least-squares projection of estimated source on the subspace spanned by delayed versions of reference sources, with delays between 0 and flen-1. Passing G as all zeros will populate the G matrix and return it so it can be passed ...
Least-squares projection of estimated source on the subspace spanned by delayed versions of reference sources, with delays between 0 and flen-1. Passing G as all zeros will populate the G matrix and return it so it can be passed into the next call to avoid recomputing G (this will only works if not comp...
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L725-L800
craffel/mir_eval
mir_eval/separation.py
_bss_source_crit
def _bss_source_crit(s_true, e_spat, e_interf, e_artif): """Measurement of the separation quality for a given source in terms of filtered true source, interference and artifacts. """ # energy ratios s_filt = s_true + e_spat sdr = _safe_db(np.sum(s_filt**2), np.sum((e_interf + e_artif)**2)) s...
python
def _bss_source_crit(s_true, e_spat, e_interf, e_artif): """Measurement of the separation quality for a given source in terms of filtered true source, interference and artifacts. """ # energy ratios s_filt = s_true + e_spat sdr = _safe_db(np.sum(s_filt**2), np.sum((e_interf + e_artif)**2)) s...
Measurement of the separation quality for a given source in terms of filtered true source, interference and artifacts.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L803-L812
craffel/mir_eval
mir_eval/separation.py
_bss_image_crit
def _bss_image_crit(s_true, e_spat, e_interf, e_artif): """Measurement of the separation quality for a given image in terms of filtered true source, spatial error, interference and artifacts. """ # energy ratios sdr = _safe_db(np.sum(s_true**2), np.sum((e_spat+e_interf+e_artif)**2)) isr = _safe_...
python
def _bss_image_crit(s_true, e_spat, e_interf, e_artif): """Measurement of the separation quality for a given image in terms of filtered true source, spatial error, interference and artifacts. """ # energy ratios sdr = _safe_db(np.sum(s_true**2), np.sum((e_spat+e_interf+e_artif)**2)) isr = _safe_...
Measurement of the separation quality for a given image in terms of filtered true source, spatial error, interference and artifacts.
https://github.com/craffel/mir_eval/blob/f41c8dafaea04b411252a516d1965af43c7d531b/mir_eval/separation.py#L815-L824