Changeset 4045ba4 for python/aubio
- Timestamp:
- Feb 17, 2006, 2:14:34 PM (19 years ago)
- 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:
- 0cd995a
- Parents:
- 8b0595e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/tasks.py
r8b0595e r4045ba4 378 378 return now, val 379 379 380 def gettruth(self): 381 from os.path import isfile 382 ftru = '.'.join(self.input.split('.')[:-1]) 383 ftru = '.'.join((ftru,'txt')) 384 if isfile(ftru): return ftru 385 else: return 386 387 def eval(self,lres): 380 381 def eval(self,inputdata,ftru,mode='roc',vmode=''): 388 382 from txtfile import read_datafile 389 from onsetcompare import onset_roc 390 amode = 'roc' 391 vmode = 'verbose' 392 vmode = '' 393 ftru = self.gettruth() 394 if not ftru: 395 print "ERR: no truth file found" 396 return 383 from onsetcompare import onset_roc, onset_diffs, onset_rocloc 397 384 ltru = read_datafile(ftru,depth=0) 398 for i in range(len(lres)): lres[i] = lres[i][0]*self.params.step 385 lres = [] 386 for i in range(len(inputdata)): lres.append(inputdata[i][0]*self.params.step) 399 387 if vmode=='verbose': 400 print "Running with mode %s" % self.params. mode,388 print "Running with mode %s" % self.params.onsetmode, 401 389 print " and threshold %f" % self.params.threshold, 402 print " on file", input390 print " on file", self.input 403 391 #print ltru; print lres 404 if amode == 'localisation':392 if mode == 'local': 405 393 l = onset_diffs(ltru,lres,self.params.tol) 406 394 mean = 0 407 395 for i in l: mean += i 408 if len(l): print "%.3f" % (mean/len(l)) 409 else: print "?0" 410 elif amode == 'roc': 396 if len(l): mean = "%.3f" % (mean/len(l)) 397 else: mean = "?0" 398 return l, mean 399 elif mode == 'roc': 411 400 self.orig, self.missed, self.merged, \ 412 401 self.expc, self.bad, self.doubled = \ 413 402 onset_roc(ltru,lres,self.params.tol) 403 elif mode == 'rocloc': 404 self.orig, self.missed, self.merged, \ 405 self.expc, self.bad, self.doubled, \ 406 self.l, self.mean = \ 407 onset_rocloc(ltru,lres,self.params.tol) 414 408 415 409 def plot(self,onsets,ofunc):
Note: See TracChangeset
for help on using the changeset viewer.