Hi André

Just a remark:
On Fri, Nov 19, 2010 at 07:24:01AM +0100, André Wobst wrote:
> Furthermore, as far as I remember it is not that trivial to check a
> float for NaN (and +/-Inf).  
Checking for NaN and +/-Inf is trivial
 - NaN is not equal to itself
 - inf's are equal to themselves

if x != x:
  print "x is nan"
if x== float('inf')
  print "x is inf"
if x==float('-inf')
  print "x is -inf"

This works also with older python. In >=2.6, there exist "math.isinf(x)"
and "math.isnan(x)"

Axel
> 
> Am 19.11.2010 um 06:53 schrieb Brendon Higgins:
> 
> > Hi André,
> > 
> > Yep, the problem isn't difficult to work around. I forgot to mention that 
> > the 
> > way I got around it was by having separate data files. In my case that 
> > required 
> > only two files.
> > 
> > But to address the issue itself, are you saying that this arises *because* 
> > NaN 
> > can be (and is) parsed as a float? Do you mean that PyX actually is 
> > attempting 
> > to draw data points at NaN positions?
> > 
> > If yes, is it wise of PyX to try to do that? As you might've guessed, my 
> > intuition is that if a value is not a number, NaN, it should not even 
> > attempt 
> > to be drawn.
> > 
> > Peace,
> > Brendon
> > 
> > André Wobst wrote (2010-11-19 15:21):
> >> Hi Brendon,
> >> 
> >> Well, NaN can be stored in a float and is even "created" by float('NaN').
> >> It should be fine if you use something else to mark nonexistent data
> >> points. I prefer to use "*".
> >> 
> >> 
> >> André
> >> 
> >> Am 19.11.2010 um 04:06 schrieb Brendon Higgins:
> >>> Hi,
> >>> 
> >>> For one plot I had a set of data defined in a text file, but not all of
> >>> them were sensible for particular x positions. So I set some data points
> >>> to NaN so that they wouldn't be drawn in the plot (I'm using a line
> >>> style). Things seemed to work fine like this when viewing the resulting
> >>> PDF in Okular, but I later found out that acroread and foxit come up
> >>> with errors, and do not show the complete plot, when they try to render
> >>> the PDF.
> >>> 
> >>> I've been too busy to test it thoroughly, unfortunately. Is anyone else
> >>> aware of this? Perhaps my assumption that "NaN" would be parsed to
> >>> something sensible was unjustified. (If so, should PyX be allowing such
> >>> things to pass without error or warning?)
> >>> 
> >>> Peace,
> >>> Brendon
> >>> 

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to