Blob Blame History Raw
--- aubio-0.3.2.orig/python/aubio/aubioclass.py	2006-07-27 01:27:22.000000000 +0200
+++ aubio-0.3.2/python/aubio/aubioclass.py	2009-09-27 21:53:46.000000000 +0200
@@ -42,8 +42,10 @@
             self.file = new_aubio_sndfile_wo(model.file,filename)
         else:
             self.file = new_aubio_sndfile_ro(filename)
+        if self.file == None:
+            raise(ValueError, "failed opening file %s" % filename)
     def __del__(self):
-        del_aubio_sndfile(self.file)
+        if self.file != None: del_aubio_sndfile(self.file)
     def info(self):
         aubio_sndfile_info(self.file)
     def samplerate(self):
@@ -126,7 +128,7 @@
         channels=1,samplerate=44100.,omode=aubio_pitchm_freq,yinthresh=0.1):
         self.pitchp = new_aubio_pitchdetection(bufsize,hopsize,channels,
                 samplerate,mode,omode)
-	aubio_pitchdetection_set_yinthresh(self.pitchp,yinthresh)
+        aubio_pitchdetection_set_yinthresh(self.pitchp,yinthresh)
         #self.filt     = filter(srate,"adsgn")
     def __del__(self):
         del_aubio_pitchdetection(self.pitchp)
--- aubio-0.3.2.orig/python/aubio/bench/onset.py	2006-07-27 01:27:19.000000000 +0200
+++ aubio-0.3.2/python/aubio/bench/onset.py	2009-09-27 21:53:46.000000000 +0200
@@ -111,7 +111,7 @@
 		for i in self.vlist:
 			gd.append(i['GD']) 
 			fp.append(i['FP']) 
-		d.append(Gnuplot.Data(fp, gd, with='linespoints', 
+		d.append(Gnuplot.Data(fp, gd, with_='linespoints', 
 			title="%s %s" % (plottitle,i['mode']) ))
 
 	def plotplotroc(self,d,outplot=0,extension='ps'):
@@ -147,7 +147,7 @@
 		for i in self.vlist:
 			x.append(i['prec']) 
 			y.append(i['recl']) 
-		d.append(Gnuplot.Data(x, y, with='linespoints', 
+		d.append(Gnuplot.Data(x, y, with_='linespoints', 
 			title="%s %s" % (plottitle,i['mode']) ))
 
 	def plotplotpr(self,d,outplot=0,extension='ps'):
@@ -172,7 +172,7 @@
 		for i in self.vlist:
 			x.append(i['thres']) 
 			y.append(i['dist']) 
-		d.append(Gnuplot.Data(x, y, with='linespoints', 
+		d.append(Gnuplot.Data(x, y, with_='linespoints', 
 			title="%s %s" % (plottitle,i['mode']) ))
 
 	def plotplotfmeas(self,d,outplot="",extension='ps', title="F-measure"):
@@ -205,7 +205,7 @@
 		for i in self.vlist:
 			x.append(i[var]) 
 			y.append(i['dist']) 
-		d.append(Gnuplot.Data(x, y, with='linespoints', 
+		d.append(Gnuplot.Data(x, y, with_='linespoints', 
 			title="%s %s" % (plottitle,i['mode']) ))
 	
 	def plotplotfmeasvar(self,d,var,outplot="",extension='ps', title="F-measure"):
@@ -244,7 +244,7 @@
 		total = v['Torig']
 		for i in range(len(per)): per[i] /= total/100.
 
-		d.append(Gnuplot.Data(val, per, with='fsteps', 
+		d.append(Gnuplot.Data(val, per, with_='fsteps', 
 			title="%s %s" % (plottitle,v['mode']) ))
 		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean))
 		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean))
@@ -275,7 +275,7 @@
 		total = v['Torig']
 		for i in range(len(per)): per[i] /= total/100.
 
-		d.append(Gnuplot.Data(val, per, with='fsteps', 
+		d.append(Gnuplot.Data(val, per, with_='fsteps', 
 			title="%s %s" % (plottitle,v['mode']) ))
 		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean))
 		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean))
--- aubio-0.3.2.orig/python/aubio/gnuplot.py	2006-08-24 04:13:22.000000000 +0200
+++ aubio-0.3.2/python/aubio/gnuplot.py	2009-09-27 21:53:46.000000000 +0200
@@ -23,7 +23,7 @@
 
 def audio_to_array(filename):
 	import aubio.aubioclass
-        import numarray
+	from numpy import arange
 	hopsize  = 2048
 	filei    = aubio.aubioclass.sndfile(filename)
 	framestep = 1/(filei.samplerate()+0.)
@@ -39,7 +39,7 @@
 		while (curpos < readsize):
 			data.append(myvec.get(curpos,i))
 			curpos+=1
-	time = numarray.arange(len(data))*framestep
+	time = arange(len(data))*framestep
 	return time,data
 
 def plot_audio(filenames, g, options):
@@ -143,29 +143,29 @@
 
 def downsample_audio(time,data,maxpoints=10000):
   """ resample audio data to last only maxpoints """
-  import numarray
+  from numpy import array, resize
   length = len(time)
   downsample = length/maxpoints
   if downsample == 0: downsample = 1
-  x = numarray.array(time).resize(length)[0:-1:downsample]
-  y = numarray.array(data).resize(length)[0:-1:downsample]
+  x = resize(array(time),length)[0:-1:downsample]
+  y = resize(array(data),length)[0:-1:downsample]
   return x,y
 
 def make_audio_plot(time,data,maxpoints=10000):
   """ create gnuplot plot from an audio file """
   import Gnuplot, Gnuplot.funcutils
   x,y = downsample_audio(time,data,maxpoints=maxpoints)
-  return Gnuplot.Data(x,y,with='lines')
+  return Gnuplot.Data(x,y,with_='lines')
 
 def make_audio_envelope(time,data,maxpoints=10000):
   """ create gnuplot plot from an audio file """
-  import numarray
+  from numpy import array
   import Gnuplot, Gnuplot.funcutils
   bufsize = 500
-  x = [i.mean() for i in numarray.array(time).resize(len(time)/bufsize,bufsize)] 
-  y = [i.mean() for i in numarray.array(data).resize(len(time)/bufsize,bufsize)] 
+  x = [i.mean() for i in resize(array(time), (len(time)/bufsize,bufsize))] 
+  y = [i.mean() for i in resize(array(data), (len(time)/bufsize,bufsize))] 
   x,y = downsample_audio(x,y,maxpoints=maxpoints)
-  return Gnuplot.Data(x,y,with='lines')
+  return Gnuplot.Data(x,y,with_='lines')
 
 def gnuplot_addargs(parser):
   """ add common gnuplot argument to OptParser object """
--- aubio-0.3.2.orig/python/aubio/onsetcompare.py	2006-07-27 01:27:40.000000000 +0200
+++ aubio-0.3.2/python/aubio/onsetcompare.py	2009-09-27 21:53:46.000000000 +0200
@@ -106,7 +106,7 @@
     return orig, missed, merged, expc, bad, doubled, l, labs
 
 def notes_roc (la, lb, eps):
-    from numarray import transpose, add, resize 
+    from numpy import transpose, add, resize 
     """ creates a matrix of size len(la)*len(lb) then look for hit and miss
     in it within eps tolerance windows """
     gdn,fpw,fpg,fpa,fdo,fdp = 0,0,0,0,0,0
--- aubio-0.3.2.orig/python/aubio/task/beat.py	2006-09-25 21:26:08.000000000 +0200
+++ aubio-0.3.2/python/aubio/task/beat.py	2009-09-27 21:53:46.000000000 +0200
@@ -247,7 +247,7 @@
 
 	def plot(self,oplots,results):
 		import Gnuplot
-		oplots.append(Gnuplot.Data(results,with='linespoints',title="auto"))
+		oplots.append(Gnuplot.Data(results,with_='linespoints',title="auto"))
 
 	def plotplot(self,wplot,oplots,outplot=None,extension=None,xsize=1.,ysize=1.,spectro=False):
 		import Gnuplot
@@ -258,5 +258,5 @@
 		#f = make_audio_plot(time,data)
 
 		g = gnuplot_create(outplot=outplot, extension=extension)
-		oplots = [Gnuplot.Data(self.gettruth(),with='linespoints',title="orig")] + oplots
+		oplots = [Gnuplot.Data(self.gettruth(),with_='linespoints',title="orig")] + oplots
 		g.plot(*oplots)
--- aubio-0.3.2.orig/python/aubio/task/notes.py	2006-07-27 01:27:19.000000000 +0200
+++ aubio-0.3.2/python/aubio/task/notes.py	2009-09-27 21:53:46.000000000 +0200
@@ -92,18 +92,17 @@
     		return now, onset, freq, ifreq 
 
 	def plot(self,now,onset,freq,ifreq,oplots):
-		import numarray
 		import Gnuplot
 
-		oplots.append(Gnuplot.Data(now,freq,with='lines',
+		oplots.append(Gnuplot.Data(now,freq,with_='lines',
 			title=self.params.pitchmode))
-		oplots.append(Gnuplot.Data(now,ifreq,with='lines',
+		oplots.append(Gnuplot.Data(now,ifreq,with_='lines',
 			title=self.params.pitchmode))
 
 		temponsets = []
 		for i in onset:
 			temponsets.append(i*1000)
-		oplots.append(Gnuplot.Data(now,temponsets,with='impulses',
+		oplots.append(Gnuplot.Data(now,temponsets,with_='impulses',
 			title=self.params.pitchmode))
 
 	def plotplot(self,wplot,oplots,outplot=None,multiplot = 0):
@@ -117,10 +116,10 @@
 		# check if ground truth exists
 		#timet,pitcht = self.gettruth()
 		#if timet and pitcht:
-		#	oplots = [Gnuplot.Data(timet,pitcht,with='lines',
+		#	oplots = [Gnuplot.Data(timet,pitcht,with_='lines',
 		#		title='ground truth')] + oplots
 
-		t = Gnuplot.Data(0,0,with='impulses') 
+		t = Gnuplot.Data(0,0,with_='impulses') 
 
 		g = gnuplot_init(outplot)
 		g('set title \'%s\'' % (re.sub('.*/','',self.input)))
--- aubio-0.3.2.orig/python/aubio/task/onset.py	2006-08-11 14:27:47.000000000 +0200
+++ aubio-0.3.2/python/aubio/task/onset.py	2009-09-27 21:53:46.000000000 +0200
@@ -92,7 +92,7 @@
 		import Gnuplot, Gnuplot.funcutils
 		import aubio.txtfile
 		import os.path
-		import numarray
+		from numpy import arange, array, ones
 		from aubio.onsetcompare import onset_roc
 
 		x1,y1,y1p = [],[],[]
@@ -102,8 +102,8 @@
 		self.lenofunc = len(ofunc) 
 		self.maxofunc = max(ofunc)
 		# onset detection function 
-		downtime = numarray.arange(len(ofunc))*self.params.step
-		oplot.append(Gnuplot.Data(downtime,ofunc,with='lines',title=self.params.onsetmode))
+		downtime = arange(len(ofunc))*self.params.step
+		oplot.append(Gnuplot.Data(downtime,ofunc,with_='lines',title=self.params.onsetmode))
 
 		# detected onsets
 		if not nplot:
@@ -111,11 +111,11 @@
 				x1.append(i[0]*self.params.step)
 				y1.append(self.maxofunc)
 				y1p.append(-self.maxofunc)
-			#x1 = numarray.array(onsets)*self.params.step
-			#y1 = self.maxofunc*numarray.ones(len(onsets))
+			#x1 = array(onsets)*self.params.step
+			#y1 = self.maxofunc*ones(len(onsets))
 			if x1:
-				oplot.append(Gnuplot.Data(x1,y1,with='impulses'))
-				wplot.append(Gnuplot.Data(x1,y1p,with='impulses'))
+				oplot.append(Gnuplot.Data(x1,y1,with_='impulses'))
+				wplot.append(Gnuplot.Data(x1,y1p,with_='impulses'))
 
 		oplots.append((oplot,self.params.onsetmode,self.maxofunc))
 
@@ -126,9 +126,9 @@
 			self.title = "" #"(no ground truth)"
 		else:
 			t_onsets = aubio.txtfile.read_datafile(datafile)
-			x2 = numarray.array(t_onsets).resize(len(t_onsets))
-			y2 = self.maxofunc*numarray.ones(len(t_onsets))
-			wplot.append(Gnuplot.Data(x2,y2,with='impulses'))
+			x2 = array(t_onsets).resize(len(t_onsets))
+			y2 = self.maxofunc*ones(len(t_onsets))
+			wplot.append(Gnuplot.Data(x2,y2,with_='impulses'))
 			
 			tol = 0.050 
 
--- aubio-0.3.2.orig/python/aubio/task/pitch.py	2006-07-27 01:27:19.000000000 +0200
+++ aubio-0.3.2/python/aubio/task/pitch.py	2009-09-27 21:53:46.000000000 +0200
@@ -156,7 +156,7 @@
 
 		time = [ (i+self.params.pitchdelay)*self.params.step for i in range(len(pitch)) ]
 		pitch = [aubio_freqtomidi(i) for i in pitch]
-		oplots.append(Gnuplot.Data(time,pitch,with='lines',
+		oplots.append(Gnuplot.Data(time,pitch,with_='lines',
 			title=self.params.pitchmode))
 		titles.append(self.params.pitchmode)
 
@@ -170,7 +170,7 @@
 		if truth:
 			timet,pitcht = self.gettruth()
 			if timet and pitcht:
-				oplots = [Gnuplot.Data(timet,pitcht,with='lines',
+				oplots = [Gnuplot.Data(timet,pitcht,with_='lines',
 					title='ground truth')] + oplots
 
 		g = gnuplot_create(outplot=outplot, extension=extension)
--- aubio-0.3.2.orig/python/aubiofilter-notes	2006-01-18 06:37:48.000000000 +0100
+++ aubio-0.3.2/python/aubiofilter-notes	2009-09-27 21:53:45.000000000 +0200
@@ -78,7 +78,7 @@
 
         from aubio import notefilter,txtfile,gnuplot
         """ load midi and raw data """
-        from numarray import array
+        from numpy import array
         notelist = array(txtfile.read_datafile(input))
         """ filter it out """
         notelist_filtered = notefilter.segraw_onsets4(notelist,winlength,eps)
--- aubio-0.3.2.orig/python/aubionotes	2006-01-18 06:37:48.000000000 +0100
+++ aubio-0.3.2/python/aubionotes	2009-09-27 21:53:45.000000000 +0200
@@ -4,7 +4,6 @@
 
     import aubio.aubioclass
     import aubio.median
-    #from numarray import around
     from math import floor
     hopsize   = 512
     bufsize   = 4096
--- aubio-0.3.2.orig/python/aubioplot-notes	2006-01-18 06:37:48.000000000 +0100
+++ aubio-0.3.2/python/aubioplot-notes	2009-09-27 21:53:45.000000000 +0200
@@ -18,7 +18,7 @@
 def main (sysargs) :
     from aubio.txtfile import read_datafile
     from aubio.gnuplot import plotnote,plotnote_do 
-    from numarray import array
+    from numpy import array
     filein,fileout = parse_args(sysargs)
     #print 'checking', fileerr, 'against', fileorg
     """ load midi and raw data """
--- aubio-0.3.2.orig/python/aubioweb.py	2006-02-16 12:59:18.000000000 +0100
+++ aubio-0.3.2/python/aubioweb.py	2009-09-27 21:53:45.000000000 +0200
@@ -11,7 +11,7 @@
 sndfile-programs (sndfile-info)
 vorbis-tools (oggenc)
 python-gnuplot
-python-numarray
+python-numpy
 
 Try the command line tools in aubio/python to test your installation.
 
--- aubio-0.3.2.orig/python/aubio/plot/keyboard.py	2009-09-13 23:58:08.000000000 +0200
+++ aubio-0.3.2/python/aubio/plot/keyboard.py	2009-09-27 22:36:48.000000000 +0200
@@ -30,8 +30,8 @@
   yb      = [y0+(y1-y0)*2/3. for i in range(len(xb))]
   ybdelta = [(y1-y0)*1/3. for i in range(len(xb))]
 
-  whites  = Gnuplot.Data(xw,yw,xwdelta,ywdelta,with = 'boxxyerrorbars')
-  blacks  = Gnuplot.Data(xb,yb,xbdelta,ybdelta,with = 'boxxyerrorbars fill solid')
+  whites  = Gnuplot.Data(xw,yw,xwdelta,ywdelta,with_ = 'boxxyerrorbars')
+  blacks  = Gnuplot.Data(xb,yb,xbdelta,ybdelta,with_ = 'boxxyerrorbars fill solid')
 
   return blacks,whites