[Numpy-discussion] genloadtxt: second serving

Manuel Metz mmetz@astro.uni-bonn...
Fri Dec 5 05:25:33 CST 2008

Pierre GM wrote:
> On Dec 4, 2008, at 7:22 AM, Manuel Metz wrote:
>> Will loadtxt in that case remain as is? Or will the _faulttolerantconv
>> class be used?
> No idea, we need to discuss it. There's a problem with  
> _faulttolerantconv: using np.nan as default value will not work in  
> Python2.6 if the output is to be int, as an exception will be raised.  

Okay, that's something I did not check. If numpy.nan is converted to 0, 
it's basically useless -- 0 might be a valid number in the data and can 
not be distinguished from nan in that case. Here masked arrays is the 
only sensible approach. So the faulttolerantconv (ftc) class is 
applicable to floats and complex numbers only.
   It might nevertheless be useful to use the ftc class since (i) it 
results in almost no performance loss and (ii) at the same time you get 
at least a minimum fault tolerance, which can be very useful for many 

   I personally will switch to AstroAsciiData (thanks Jarrod for 
pointing this out), because that seems to be exactly what I need!


> Therefore, we'd need to change the default to something else when  
> defining _faulttolerantconv. The easiest would be to define a class  
> and set the argument at instantiation, but then we're going back  
> dangerously close to StringConverter...

More information about the Numpy-discussion mailing list