- Timestamp:
- Aug 2, 2006, 5:25:09 PM (18 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:
- 33cf541
- Parents:
- 32fa8e8
- Location:
- python
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/gnuplot.py
r32fa8e8 r0ab19df 163 163 return Gnuplot.Data(x,y,with='lines') 164 164 165 def gnuplot_create(outplot='',extension='',debug=0,persist=1, xsize=1., ysize=1.): 166 import Gnuplot 167 g = Gnuplot.Gnuplot(debug=debug, persist=persist) 168 if not extension or not outplot: return g 169 if extension == 'ps': ext, extension = '.ps' , 'postscript' 170 elif extension == 'eps': ext, extension = '.eps' , 'postscript enhanced' 171 elif extension == 'epsc': ext, extension = '.eps' , 'postscript enhanced color' 172 elif extension == 'png': ext, extension = '.png', 'png' 173 elif extension == 'svg': ext, extension = '.svg', 'svg' 174 else: exit("ERR: unknown plot extension") 175 g('set terminal %s' % extension) 176 if outplot != "stdout": 177 g('set output \'%s%s\'' % (outplot,ext)) 178 g('set size %f,%f' % (xsize, ysize)) 179 return g 165 def gnuplot_addargs(parser): 166 """ add common gnuplot argument to OptParser object """ 167 parser.add_option("-x","--xsize", 168 action="store", dest="xsize", default=1., 169 type='float',help="define xsize for plot") 170 parser.add_option("-y","--ysize", 171 action="store", dest="ysize", default=1., 172 type='float',help="define ysize for plot") 173 parser.add_option("-d","--debug", 174 action="store_true", dest="debug", default=False, 175 help="use gnuplot debug mode") 176 parser.add_option("-p","--persist", 177 action="store_false", dest="persist", default=True, 178 help="do not use gnuplot persistant mode") 179 parser.add_option("-O","--outplot", 180 action="store", dest="outplot", default=None, 181 help="save plot to output.{ps,png}") 182 183 def gnuplot_create(outplot='',extension='', options=None): 184 import Gnuplot 185 g = Gnuplot.Gnuplot(debug=options.debug, persist=options.persist) 186 if not extension or not outplot: return g 187 if extension == 'ps': ext, extension = '.ps' , 'postscript' 188 elif extension == 'eps': ext, extension = '.eps' , 'postscript enhanced' 189 elif extension == 'epsc': ext, extension = '.eps' , 'postscript enhanced color' 190 elif extension == 'png': ext, extension = '.png', 'png' 191 elif extension == 'svg': ext, extension = '.svg', 'svg' 192 else: exit("ERR: unknown plot extension") 193 g('set terminal %s' % extension) 194 if outplot != "stdout": 195 g('set output \'%s%s\'' % (outplot,ext)) 196 g('set size %f,%f' % (options.xsize, options.ysize)) 197 return g -
python/aubioplot-audio
r32fa8e8 r0ab19df 1 1 #!/usr/bin/python 2 2 3 import aubio.gnuplot, sys 3 import sys 4 from aubio.gnuplot import gnuplot_create,gnuplot_addargs,plot_audio 4 5 5 6 usage = "usage: %s [options] -i soundfile" % sys.argv[0] … … 11 12 action="store", dest="filename", 12 13 help="input sound file") 13 parser.add_option("-x","--xsize", 14 action="store", dest="xsize", default=1., 15 type='float',help="define xsize for plot") 16 parser.add_option("-y","--ysize", 17 action="store", dest="ysize", default=1., 18 type='float',help="define ysize for plot") 19 parser.add_option("-O","--outplot", 20 action="store", dest="outplot", default=None, 21 help="save plot to output.{ps,png}") 14 gnuplot_addargs(parser) 22 15 (options, args) = parser.parse_args() 23 16 if not options.filename: … … 35 28 outplot = None 36 29 37 g = aubio.gnuplot.gnuplot_create(outplot,extension,xsize=options.xsize, ysize=options.xsize)38 aubio.gnuplot.plot_audio(options.filename.split(','), g,30 g = gnuplot_create(outplot,extension,options) 31 plot_audio(options.filename.split(','), g, 39 32 xsize=options.xsize, 40 33 ysize=options.ysize) -
python/aubioplot-spec
r32fa8e8 r0ab19df 6 6 7 7 import sys 8 from aubio.gnuplot import *8 from aubio.gnuplot import gnuplot_create,gnuplot_addargs,plot_spec 9 9 10 10 usage = "usage: %s [options] -i soundfile" % sys.argv[0] … … 22 22 action="store", dest="minf", default=0., 23 23 type='float',help="lower frequency limit") 24 parser.add_option("-x","--xsize",25 action="store", dest="xsize", default=1.,26 type='float',help="define xsize for plot")27 parser.add_option("-y","--ysize",28 action="store", dest="ysize", default=1.,29 type='float',help="define ysize for plot")30 24 parser.add_option("-l","--log", 31 25 action="store_true", dest="log", default=False, 32 26 help="plot on a logarithmic scale") 33 parser.add_option("-O","--outplot",34 action="store", dest="outplot", default=None,35 help="save plot to output.{ps,png}")36 27 parser.add_option("-B","--bufsize", type='int', 37 28 action="store", dest="bufsize", default=8192, … … 40 31 action="store", dest="hopsize", default=1024, 41 32 help="overlap size [default=1024]") 33 gnuplot_addargs(parser) 42 34 (options, args) = parser.parse_args() 43 35 if not options.filename: … … 56 48 outplot = None 57 49 58 g = gnuplot_create(outplot,extension, xsize=options.xsize, ysize=options.ysize)50 g = gnuplot_create(outplot,extension,options) 59 51 plot_spec(filename, g, log=options.log, 60 52 maxf = options.maxf, minf = options.minf,
Note: See TracChangeset
for help on using the changeset viewer.