[SciPy-user] AstroAsciiData: first release!

Martin Kuemmel mkuemmel at eso.org
Fri Dec 2 01:03:40 CST 2005


Dear all,

this email is the announcement of
the first release of the Python module

AstroAsciiData.

With this module it is possible to:
* read ASCII tables;
* access its elements for reading and writing;
* save the ASCII table back to a file;
* delete/add rows and columns;
* convert columns to numarrays.

To get a first impression on what this module does
and how it works, please check the example below.
More information, and of course the software
itself and the manual, is available on the
project webpages at:
http://www.stecf.org/software/astroasciidata/

The software was developed as a contribution to the
AstroLib project. Any kind of feedback can be
posted on the AstroAsciiData wiki at

http://www.scipy.org/wikis/topical_software/AstroAsciiData

or sent by email to AstroAsciiData at stecf.org

Please check on the webpage if the module could be
useful for your work and give it a try!

Cheers,
Martin Kuemmel
Jonas Haase

-----------------------------------------------------------------------------

Example
=======

What follows is an  example of how the AstroAsciiData module might
be used. With this example also some of the basic functionality of
the module is explained. More example can be found in Section 3 of the
User Manual.

* Imagine you would like to work with the file "webexa.txt":

  #
  # Some objects on the sky
  #
  J02994.34+62.4844 189.2207323 62.2357983 231.9 521.8 26.87 0.1
  J09234.54+62.9485 189.1408929 62.2376331 720.4 962.1 24.97 0.1
  J09267.65+62.8293 189.1409453 62.1696844 927.1 327.9 25.30 0.1
  J09738.55+62.4327 188.9014716 62.2037839 223.7 192.5 25.95 0.1

* To load this ASCII table, go into Python, load the AstroAsciiData
  module and read in the table with:

  >>> import asciidata
  >>> demo = asciidata.open('webexa.txt')
  >>> print demo
  #
  # Some objects on the sky
  #
  J02994.34+62.4844 189.2207323 62.2357983 231.9 521.8 26.87 0.1
  J09234.54+62.9485 189.1408929 62.2376331 720.4 962.1 24.97 0.1
  J09267.65+62.8293 189.1409453 62.1696844 927.1 327.9 25.30 0.1
  J09738.55+62.4327 188.9014716 62.2037839 223.7 192.5 25.95 0.1

  The print command at the end was just to confirm the correct
  reading of the file.

* Let's assume that column4 and 5 contain object coordinates. You would
  like to compute and store the distance to the distances to the image
  center at (x,y)=(500.0,500.0):

  >>> import math
  >>> xcen=500.0
  >>> ycen=500.0
  >>> for index in range(demo.nrows):
  ... demo['distance'][index] = 
math.sqrt((demo[3][index]-xcen)**2+(demo[4][inde
x]-ycen)**2)
  ...
  >>> print demo
  #
  # Some objects on the sky
  #
  J02994.34+62.4844 189.2207323 62.2357983 231.9 521.8 26.87 0.1 2.689849e+02
  J09234.54+62.9485 189.1408929 62.2376331 720.4 962.1 24.97 0.1 5.119693e+02
  J09267.65+62.8293 189.1409453 62.1696844 927.1 327.9 25.30 0.1 4.604702e+02
  J09738.55+62.4327 188.9014716 62.2037839 223.7 192.5 25.95 0.1 4.133980e+02

  As the print command reveals, there is now a new column with the
  computed values.

* Now you would like to save the result:

  >>> demo.flush()
  >>>
  work>more webexa.txt
  #
  # Some objects on the sky
  #
  J02994.34+62.4844 189.2207323 62.2357983 231.9 521.8 26.87 0.1 2.689849e+02
  J09234.54+62.9485 189.1408929 62.2376331 720.4 962.1 24.97 0.1 5.119693e+02
  J09267.65+62.8293 189.1409453 62.1696844 927.1 327.9 25.30 0.1 4.604702e+02
  J09738.55+62.4327 188.9014716 62.2037839 223.7 192.5 25.95 0.1 4.133980e+02

  The new column was saved back to the file!



More information about the SciPy-user mailing list