Changeset 8b0595e


Ignore:
Timestamp:
Feb 17, 2006, 1:59:21 PM (19 years ago)
Author:
Paul Brossier <piem@altern.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
4045ba4
Parents:
a3254df
Message:

added onset_rocloc simultaneous comparison and diffs
added onset_rocloc simultaneous comparison and diffs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/aubio/onsetcompare.py

    ra3254df r8b0595e  
    7272    return l
    7373
     74def onset_rocloc(ltru, lexp, eps):
     75    """ compute differences between two lists
     76          orig = hits + missed + merged
     77          expc = hits + bad + doubled
     78        returns orig, missed, merged, expc, bad, doubled
     79    """
     80    orig, expc = len(ltru), len(lexp)
     81    l = []
     82    mean = 0
     83    # if lexp is empty
     84    if expc == 0 : return orig,orig,0,0,0,0,l,mean
     85    missed, bad, doubled, merged = 0, 0, 0, 0
     86    # find missed and doubled ones first
     87    for x in ltru:
     88        correspond = 0
     89        for y in lexp:
     90            if abs(x-y) <= eps:    correspond += 1
     91        if correspond == 0:        missed += 1
     92        elif correspond > 1:       doubled += correspond - 1
     93    # then look for bad and merged ones
     94    for y in lexp:
     95        correspond = 0
     96        for x in ltru:
     97            if abs(x-y) <= eps:   
     98                correspond += 1
     99                l.append(y-x)
     100        if correspond == 0:        bad += 1
     101        elif correspond > 1:       merged += correspond - 1
     102    # check consistancy of the results
     103    assert ( orig - missed - merged == expc - bad - doubled)
     104    return orig, missed, merged, expc, bad, doubled, l, sum(l)/float(max(len(l),1))
     105
    74106def notes_roc (la, lb, eps):
    75107    from numarray import transpose, add, resize
Note: See TracChangeset for help on using the changeset viewer.