From barrett at stsci.edu Fri Apr 2 15:03:09 1999 From: barrett at stsci.edu (Paul Barrett) Date: Fri, 2 Apr 1999 15:03:09 -0500 (EST) Subject: AstroPy: Announcing PyFITS v0.1 Message-ID: This is to announce Version 0.1 of PyFITS. You can download a gzipped tarfile of these modules from ftp://cossc.gsfc.nasa.gov/pub/outgoing/barrett/PyFITS/PyFITS_19990402.tgz Note that this is alpha software, so it is by no means complete or bug-free, but should be such a state to be useful to those Pythoneers interested in perusing and possibly reading and writing FITS files. The 'fitsio.py' module imports a C-extension module named 'record', which enables one to access binary data structures using array syntax, like the NumPy module. It differs from NumPy in that it converts from big- or little-endian format to native machine format on the fly. To import into NumPy, use the record.tostring() and Numeric.fromstring methods. The source file for the record module is located in ./PyFITS/src. You will need to make a shared object file from the C source file to use it (unless you are on Solaris, in which case you can use the one that already exists). To run a simple test of fitsio.py: > cd ./PyFITS/pythoncodes > cp ../src/recordmodule.so . > python fitsio.py This will read and display about a half-dozen FITS file located in the current directory. Take a look at fitsio.py to see how to read your own files. Currently, fitsio.py can only read and write Primary and Binary Table HDUs. To learn more about the design of PyFITS, read the ADASS 8 paper by Barrett and Bridgman at http://www.dpt.stsci.edu/dpt_papers/opus_bib.html The record and fitsio modules will continue to be improved and updates will hopefully be posted to the above URL on a weekly basis. Your comments, suggestions, and patchs are always welcome. Enjoy, Paul __________________________________________________ AstroPy mailing list - astropy at athena.gsfc.nasa.gov http://lheawww.gsfc.nasa.gov/~bridgman/AstroPy/ From wtbridgman at radix.net Mon Apr 5 22:46:51 1999 From: wtbridgman at radix.net (W.T. Bridgman) Date: Mon, 5 Apr 1999 22:46:51 -0400 Subject: AstroPy: PySpec - a simple PyFITS application Message-ID: #!/usr/bin/env python1.5 # # Program: PySpec v0.001? # Author: W.T. Bridgman # Date: April 5, 1999 # Language: Python v1.5.1 # Platform/OS: Macintosh, MacOS 8.5.1 # # Should be reasonably platform independent # Let me know! # Not the most elegant Python, but it does work! # Basic sample of doing a simple task with PyFITS # # # Need the mytest.fits file, Konrad Hinson's TkPlotCanvas.py, # fitsio.py & the recordmodule # Click the 'DRAW' button when the window appears # # FYI: The mytest.fits file contains a simulated x-ray # spectrum of an accretion disk. The reflected component # reveals an iron flourescence line. # ################################################### # quick sample using PyFITS with TkPlotCanvas # import TkPlotCanvas import Numeric from fitsio import * from Tkinter import * # extract some FITS information first fin = Ffile('mytest.fits') fhdu=[] fhdu.append(fin.read()) # now examine SPECTRA extension fhdu.append(fin.read()) nbytes=fhdu[1].head['NAXIS1'] nrows=fhdu[1].head['NAXIS2'] print "Rows: ",nrows," & bytes/row: ",nbytes clip=40 # chop off some problem points at the end of the arrays energy=Numeric.zeros([nrows],Numeric.Float64) incident=Numeric.zeros([nrows],Numeric.Float64) transmitted=Numeric.zeros([nrows],Numeric.Float64) reflected=Numeric.zeros([nrows],Numeric.Float64) # load the data buffer into numeric arrays # is there a better way to load the columns into Numeric arrays? for i in range(nrows): energy[i] = fhdu[1].data[i,0] incident[i] = fhdu[1].data[i,2] transmitted[i] = fhdu[1].data[i,3] reflected[i] = fhdu[1].data[i,4] # convert to format suitable for PolyLine # also convert for logarithmic scaling data1=Numeric.zeros([clip,2],Numeric.Float64) data1[:,0]=Numeric.log10(energy[0:clip]) data1[:,1]=Numeric.log10(incident[0:clip]) line1=TkPlotCanvas.PolyLine(data1,color='green') # convert to format suitable for PolyLine # also convert for logarithmic scaling data2=Numeric.zeros([clip,2],Numeric.Float64) data2[:,0]=Numeric.log10(energy[0:clip]) data2[:,1]=Numeric.log10(transmitted[0:clip]) line2=TkPlotCanvas.PolyLine(data2,color='red') # convert to format suitable for PolyLine # also convert for logarithmic scaling data3=Numeric.zeros([clip,2],Numeric.Float64) data3[:,0]=Numeric.log10(energy[0:clip]) data3[:,1]=Numeric.log10(reflected[0:clip]) line3=TkPlotCanvas.PolyLine(data3,color='blue') window=Frame() window.pack(fill=BOTH, expand=YES) # Make the graph object object=TkPlotCanvas.PlotGraphics([line1,line2,line3]) # now prep the window for plotting c = TkPlotCanvas.PlotCanvas(window, "200m", "140m", relief=SUNKEN, border=2) c.pack(side=TOP, fill=BOTH, expand=YES) # allocate buttons for window Button(window, text='Draw', command=lambda o=object: c.draw(o, 'automatic', 'automatic')).pack(side=LEFT) Button(window, text='Clear', command=c.clear).pack(side=LEFT) Button(window, text='Redraw', command=c.redraw).pack(side=LEFT) Button(window, text='Quit', command=window.quit).pack(side=RIGHT) # and now enter the command loop window.mainloop() fin.close() __________________________________________________ AstroPy mailing list - astropy at athena.gsfc.nasa.gov http://lheawww.gsfc.nasa.gov/~bridgman/AstroPy/ From bridgman at lheapop.gsfc.nasa.gov Fri Apr 9 17:56:49 1999 From: bridgman at lheapop.gsfc.nasa.gov (Dr. William T. Bridgman) Date: Fri, 9 Apr 1999 17:56:49 -0400 Subject: AstroPy: AstroPy news - April 9, 1999 Message-ID: I've made some updates to the AstroPy web page. There is now a link to Paul Barrett's PyFITS module (note that this is basically an alpha-release so please report bugs you encounter). It has been tested on Solaris, Linux x86, and MacOS. I wanted to add a report to Pavlos' page but the AddModule option seems to be offline. I'm working on a couple of simple demo applications for PyFITS (I sent PySpec to the list a few days ago) and the documentation. Comments, suggestions, other reports are welcome. Tom -- Dr. William T."Tom" Bridgman Raytheon ITSS NASA/Goddard Space Flight Center Code 664 bridgman at lheapop.gsfc.nasa.gov Greenbelt, MD 20771 (301) 286-1346 __________________________________________________ AstroPy mailing list - astropy at athena.gsfc.nasa.gov http://lheawww.gsfc.nasa.gov/~bridgman/AstroPy/ From pavlos at gaaros.msrc.sunysb.edu Fri Apr 9 18:10:15 1999 From: pavlos at gaaros.msrc.sunysb.edu (Pavlos Christoforou) Date: Fri, 9 Apr 1999 18:10:15 -0400 (EDT) Subject: AstroPy: AstroPy news - April 9, 1999 In-Reply-To: Message-ID: Tom - I just tested the AddModule URL and it works fine for me: http://www.gaaros.com:8080/Gaaros/AstroPy Regards Pavlos __________________________________________________ AstroPy mailing list - astropy at athena.gsfc.nasa.gov http://lheawww.gsfc.nasa.gov/~bridgman/AstroPy/