Re: [Matplotlib-users] matplotlib/__init__.py : gs version parsing problem
On Sunday 02 December 2007 06:55:01 am hjc520070 wrote: > Xavier Gnata wrote: > > Hi, > > > > Quoting matplotlib/__init__.py : > > > > def checkdep_ghostscript(): > > try: > > if sys.platform == 'win32': > > command = 'gswin32c -v' > > else: > > command = 'gs -v' > > stdin, stdout = os.popen4(command) > > line = stdout.readlines()[0] > > v = line.split()[2] > > vtest = '.'.join(v.split('.')[:2]) # deal with version numbers > > like '7.07.1' > > float(vtest) > > return vtest > > except (IndexError, ValueError): > > return None > > > > It fails on debian sid because 'gs -v' returns "GPL Ghostscript SVN > > PRE-RELEASE 8.61 (2007-08-02)\n" > > > > Anyway, the parser will be ugly because it has to deal with version > > numbers like '7.07.1'. > > Should I propose a trivial patch to get thinks working on debian sid ? > > > > Xavier > > ps :Why is there no standard way (like -v or --version) on *unix to get > > the version *number*?? Only the version number. Why :( > > > > -- > > > > Xavier Gnata > > CRAL - Observatoire de Lyon > > 9, avenue Charles André > > 69561 Saint Genis Laval cedex > > Phone: +33 4 78 86 85 28 > > Fax: +33 4 78 86 83 86 > > E-mail: [EMAIL PROTECTED] > > > > > > > > - > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2005. > > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > > ___ > > Matplotlib-users mailing list > > Matplotlib-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > Yeah , I did face the same problem . My code is following: > There seems to be something wrong in "ax.imshow(im)", I can't get the > answer , Can sb help me . The imshow documentation says "X may be a float array, a uint8 array or a PIL image", but you are passing it an AxesImage instance, which wont work. > The error message"ValueError: need more than 0 values to unpack" > Thank you . > > # -*- coding:gb2312 -*- > import wx > from pylab import * > from matplotlib.backends.backend_wx import FigureCanvasWx > from matplotlib.figure import Figure > from matplotlib.axes import * > from numpy import * > > #- > x=array(range(0,100)) > y=array(range(0,100)) > z=rand(100,100) > figure(1) > im=imshow(z, interpolation='bilinear', origin='lower',cmap=cm.gray, > extent=(0,100,0,100)) > levels = arange(0.3, 0.4, 0.9) > contour(x,y,z,levels,origin='lower',linewidths=2,extent=(0,100,0,100)) > > > fig=figure(2) > ax = fig.add_subplot(111) > ax.imshow(im) > ax.set_xlim(0,3) > ax.set_ylim(0,2) > show() - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib/__init__.py : gs version parsing problem
Xavier Gnata wrote: > > Hi, > > Quoting matplotlib/__init__.py : > > def checkdep_ghostscript(): > try: > if sys.platform == 'win32': > command = 'gswin32c -v' > else: > command = 'gs -v' > stdin, stdout = os.popen4(command) > line = stdout.readlines()[0] > v = line.split()[2] > vtest = '.'.join(v.split('.')[:2]) # deal with version numbers > like '7.07.1' > float(vtest) > return vtest > except (IndexError, ValueError): > return None > > It fails on debian sid because 'gs -v' returns "GPL Ghostscript SVN > PRE-RELEASE 8.61 (2007-08-02)\n" > > Anyway, the parser will be ugly because it has to deal with version > numbers like '7.07.1'. > Should I propose a trivial patch to get thinks working on debian sid ? > > Xavier > ps :Why is there no standard way (like -v or --version) on *unix to get > the version *number*?? Only the version number. Why :( > > -- > > Xavier Gnata > CRAL - Observatoire de Lyon > 9, avenue Charles André > 69561 Saint Genis Laval cedex > Phone: +33 4 78 86 85 28 > Fax: +33 4 78 86 83 86 > E-mail: [EMAIL PROTECTED] > > > > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > Yeah , I did face the same problem . My code is following: There seems to be something wrong in "ax.imshow(im)", I can't get the answer , Can sb help me . The error message"ValueError: need more than 0 values to unpack" Thank you . # -*- coding:gb2312 -*- import wx from pylab import * from matplotlib.backends.backend_wx import FigureCanvasWx from matplotlib.figure import Figure from matplotlib.axes import * from numpy import * #- x=array(range(0,100)) y=array(range(0,100)) z=rand(100,100) figure(1) im=imshow(z, interpolation='bilinear', origin='lower',cmap=cm.gray, extent=(0,100,0,100)) levels = arange(0.3, 0.4, 0.9) contour(x,y,z,levels,origin='lower',linewidths=2,extent=(0,100,0,100)) fig=figure(2) ax = fig.add_subplot(111) ax.imshow(im) ax.set_xlim(0,3) ax.set_ylim(0,2) show() -- View this message in context: http://www.nabble.com/matplotlib-__init__.py-%3A-gs-version-parsing-problem-tf4821980.html#a14114656 Sent from the matplotlib - users mailing list archive at Nabble.com. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib/__init__.py : gs version parsing problem
Hi, Quoting matplotlib/__init__.py : def checkdep_ghostscript(): try: if sys.platform == 'win32': command = 'gswin32c -v' else: command = 'gs -v' stdin, stdout = os.popen4(command) line = stdout.readlines()[0] v = line.split()[2] vtest = '.'.join(v.split('.')[:2]) # deal with version numbers like '7.07.1' float(vtest) return vtest except (IndexError, ValueError): return None It fails on debian sid because 'gs -v' returns "GPL Ghostscript SVN PRE-RELEASE 8.61 (2007-08-02)\n" Anyway, the parser will be ugly because it has to deal with version numbers like '7.07.1'. Should I propose a trivial patch to get thinks working on debian sid ? Xavier ps :Why is there no standard way (like -v or --version) on *unix to get the version *number*?? Only the version number. Why :( -- Xavier Gnata CRAL - Observatoire de Lyon 9, avenue Charles André 69561 Saint Genis Laval cedex Phone: +33 4 78 86 85 28 Fax: +33 4 78 86 83 86 E-mail: [EMAIL PROTECTED] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib/__init__.py : gs version parsing problem
On Nov 16, 2007 10:03 AM, Xavier Gnata <[EMAIL PROTECTED]> wrote: > /usr/lib/python2.4/site-packages/matplotlib/image.py in get_extent(self) > 286 sz = self.get_size() > 287 #print 'sz', sz > --> 288 numrows, numcols = sz > 289 if self.origin == 'upper': > 290 return (-0.5, numcols-0.5, numrows-0.5, -0.5) > > ValueError: need more than 1 value to unpack > > but it is another topic. It looks like you may be passing in a 1D array to imshow or to im.set_array. Could you post a code sample? JDH - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib/__init__.py : gs version parsing problem
On Friday 16 November 2007 10:28:25 am Xavier Gnata wrote: > Hi, > > Quoting matplotlib/__init__.py : > > def checkdep_ghostscript(): > try: > if sys.platform == 'win32': > command = 'gswin32c -v' > else: > command = 'gs -v' > stdin, stdout = os.popen4(command) > line = stdout.readlines()[0] > v = line.split()[2] > vtest = '.'.join(v.split('.')[:2]) # deal with version numbers > like '7.07.1' > float(vtest) > return vtest > except (IndexError, ValueError): > return None > > It fails on debian sid because 'gs -v' returns "GPL Ghostscript SVN > PRE-RELEASE 8.61 (2007-08-02)\n" > > Anyway, the parser will be ugly because it has to deal with version > numbers like '7.07.1'. > Should I propose a trivial patch to get thinks working on debian sid ? > > Xavier > ps :Why is there no standard way (like -v or --version) on *unix to get > the version *number*?? Only the version number. Why :( This was fixed a while back in svn, but thanks for the report. It turns out that --version does return only the version number. Darren - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib/__init__.py : gs version parsing problem
Darren Dale wrote: > On Friday 16 November 2007 10:28:25 am Xavier Gnata wrote: > >> Hi, >> >> Quoting matplotlib/__init__.py : >> >> def checkdep_ghostscript(): >> try: >> if sys.platform == 'win32': >> command = 'gswin32c -v' >> else: >> command = 'gs -v' >> stdin, stdout = os.popen4(command) >> line = stdout.readlines()[0] >> v = line.split()[2] >> vtest = '.'.join(v.split('.')[:2]) # deal with version numbers >> like '7.07.1' >> float(vtest) >> return vtest >> except (IndexError, ValueError): >> return None >> >> It fails on debian sid because 'gs -v' returns "GPL Ghostscript SVN >> PRE-RELEASE 8.61 (2007-08-02)\n" >> >> Anyway, the parser will be ugly because it has to deal with version >> numbers like '7.07.1'. >> Should I propose a trivial patch to get thinks working on debian sid ? >> >> Xavier >> ps :Why is there no standard way (like -v or --version) on *unix to get >> the version *number*?? Only the version number. Why :( >> > > > This was fixed a while back in svn, but thanks for the report. It turns out > that --version does return only the version number. > > Darren > > Unfortunately, I'm not able to get the svn version working : imshow always fails : /usr/lib/python2.4/site-packages/matplotlib/pyplot.py in imshow(*args, **kwargs) 1673 hold(h) 1674 try: -> 1675 ret = gca().imshow(*args, **kwargs) 1676 draw_if_interactive() 1677 except: /usr/lib/python2.4/site-packages/matplotlib/axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, **kwargs) 4435 im.autoscale_None() 4436 -> 4437 xmin, xmax, ymin, ymax = im.get_extent() 4438 4439 corners = (xmin, ymin), (xmax, ymax) /usr/lib/python2.4/site-packages/matplotlib/image.py in get_extent(self) 286 sz = self.get_size() 287 #print 'sz', sz --> 288 numrows, numcols = sz 289 if self.origin == 'upper': 290 return (-0.5, numcols-0.5, numrows-0.5, -0.5) ValueError: need more than 1 value to unpack but it is another topic. Xavier. > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Xavier Gnata CRAL - Observatoire de Lyon 9, avenue Charles André 69561 Saint Genis Laval cedex Phone: +33 4 78 86 85 28 Fax: +33 4 78 86 83 86 E-mail: [EMAIL PROTECTED] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users