[AstroPy] Practical Python for Astronomers web tutorial

Dr. Juan E Cabanela Ph.D. cabanela at mnstate.edu
Thu May 26 09:40:29 EDT 2011

On May 26, 2011, at 2:20 AM, Frederic Grollier wrote:
> On Wed, May 25, 2011 at 02:29:09PM -0500, Dr. Juan E Cabanela Ph.D. wrote:
>> t5 = atpy.Table(raw,type='ascii', fill_values=fill_values)
>> fails for me.  In fact, there appears to be no way to get atpy.Table to fill 
>> values automatically as it triggers an error 
>> TypeError: read() got an unexpected keyword argument 'fill_values'
>> I hope this can be fixed and if someone can tell me how to use fill_values 
>> within ATpy that would be appreciated. 
> This code snippet works for me here, using ATpy. and 
> asciitable.0.5.2. In the case of type='asciitable', the read() method 
> delegates most of its work to asciitable, and so 'fill_values' should 
> be a feature of this module. As far as I can tell, the 'fill_values' 
> parameter was introduced in version 0.4.0 of asciitable, can you check 
> your version info for this ?

I am running ATpy and asciitable 0.5.2 as well, running on Python 2.7.1 -- EPD 7.0-2 (64-bit) on MacOS 10.6.7.

In my script test.py I do the following:
import numpy
import pylab
import atpy

filler = [('null',numpy.nan),('null',-999,'cntr_u','nb','na','ext_flg','w1nm','w1m','w2nm','w2m','w3nm','w3m','w4nm','w4m','tmass_key')]
data = atpy.Table('wise_matches.tbl',fill_values=filler)

and that last line triggers the following error (with traceback):

Traceback (most recent call last):
 File "test.py", line 14, in <module>
   data = atpy.Table('wise_matches.tbl',fill_values=filler)
 File "/Users/juan/Library/Python/2.7/lib/python/site-packages/ATpy-", line 167, in __init__
   self.read(*args, **kwargs)
 File "/Users/juan/Library/Python/2.7/lib/python/site-packages/ATpy-", line 213, in read
   atpy._readers[table_type](self, *args, **kwargs)
TypeError: read() got an unexpected keyword argument 'fill_values'

And so I have the same modules, but a different result.

Dr. Juan Cabanela                    218-477-2453 (V)  218-477-2290 (F)
Minnesota State University Moorhead     WWW: http://www.cabanela.com/     
Dept. of Physics and Astronomy      Twitter: Juan_Kinda_Guy 
1104 Seventh Ave South, Hagen 307B       IM: AstroJuanCab (AIM)   
Moorhead, MN 56563                           cabanela at mnstate.edu (MSN)
                                            juancab at gmail.com (GTalk)
  Public PGP Key available at: http://www.cabanela.com/juan_public.asc

More information about the AstroPy mailing list