Changeset 50791b3 for python


Ignore:
Timestamp:
Dec 16, 2005, 8:34:03 AM (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:
0029638
Parents:
336cf77
Message:

optional resdir
optional resdir

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/aubio/bench/node.py

    r336cf77 r50791b3  
    4242        return runcommand(cmd)
    4343
    44 def act_on_data (action,datapath,respath,suffix='.txt',filter='f',sub='\.wav$',**keywords):
     44def act_on_data (action,datapath,respath=None,suffix='.txt',filter='f',sub='\.wav$',**keywords):
    4545        """ execute action(datafile,resfile) on all files in datapath """
    4646        dirlist = list_files(datapath,filter=filter)
    4747        if dirlist == ['']: dirlist = []
    48         respath_in_datapath = re.split(datapath, respath,maxsplit=1)[1:]
    49         if(respath_in_datapath and suffix == ''):
    50                 print 'error: respath in datapath and no suffix used'
    51                 #sys.exit(1)
     48        if respath:
     49                respath_in_datapath = re.split(datapath, respath,maxsplit=1)[1:]
     50                if(respath_in_datapath and suffix == ''):
     51                        print 'error: respath in datapath and no suffix used'
    5252        for i in dirlist:
    5353                j = re.split(datapath, i,maxsplit=1)[1]
    5454                j = re.sub(sub,'',j)
    5555                #j = "%s%s%s"%(respath,j,suffix)
    56                 j = "%s%s"%(respath,j)
    57                 if sub != '':
    58                         j = re.sub(sub,suffix,j)
    59                 else:
    60                         j = "%s%s" % (j,suffix)
     56                if respath:
     57                        j = "%s%s"%(respath,j)
     58                        if sub != '':
     59                                j = re.sub(sub,suffix,j)
     60                        else:
     61                                j = "%s%s" % (j,suffix)
    6162                action(i,j,**keywords)
    6263
     
    7374class bench:
    7475
    75         def __init__(self,datadir,resdir,checkres=False,checkanno=False):
     76        def __init__(self,datadir,resdir=None,checkres=False,checkanno=False):
    7677                self.datadir = datadir
    7778                self.resdir = resdir
     79                self.results = []
    7880                print "Checking data directory", self.datadir
    7981                self.checkdata()
Note: See TracChangeset for help on using the changeset viewer.