From astropython at gmail.com Tue Oct 6 20:02:58 2009 From: astropython at gmail.com (Astronomical Python) Date: Tue, 6 Oct 2009 20:02:58 -0400 Subject: [AstroPy] ATpy 0.9.1 Release Message-ID: We are pleased to announce the release of ATpy 0.9.1! ATpy is a high-level python package to manipulate tables of astronomical data, and can be used to seamlessly read and write table data to a number of table formats (FITS, VO, and IPAC tables, and SQLite, MySQL, and PostgreSQL databases), building on existing python modules. More information and links to download the latest version of ATpy can be found at http://atpy.sourceforge.net/ The main changes with this update are the removal of the pkg_resources module dependency (which caused problems for a number of users) and a number of bug fixes and minor improvements. Please do not hesitate to let us know if you encounter any problems with this release, Cheers, Eli Bressert and Thomas Robitaille From astropython at gmail.com Mon Oct 12 09:38:02 2009 From: astropython at gmail.com (Astronomical Python) Date: Mon, 12 Oct 2009 09:38:02 -0400 Subject: [AstroPy] IDLSave - Read IDL save files into python Message-ID: I am happy to announce the availability of IDLSave, which is a pure python module to import variables from IDL 'save' files (e.g. .sav) into python. This does _not_ require IDL to work. It has a very simple command-line interface, and converts all IDL variables to python types, including Numpy arrays whenever possible. More information and a download link are available at http://idlsave.sourceforge.net/ Please let me know if you encounter any problems, or have any suggestions, Best regards, Thomas Robitaille From lee.j.joon at gmail.com Mon Oct 19 06:23:58 2009 From: lee.j.joon at gmail.com (Jae-Joon Lee) Date: Mon, 19 Oct 2009 06:23:58 -0400 Subject: [AstroPy] pyregion : python parser for ds9 region files Message-ID: <6e8d907b0910190323p3c897834g4a16c90d7299368@mail.gmail.com> Hi, pyregion is a python module to parse ds9 (and ciao) region files. The parser is based on the pyparsing module. My personal motivation with this module is to draw ds9 regions with matplotlib, and to create mask images. Homepage : http://leejjoon.github.com/pyregion/ examples w/ matplotlib : http://leejjoon.github.com/pyregion/examples.html GitHub repository : http://github.com/leejjoon/pyregion The parser seems to be rather slow (likely due to my lack of parser design skill), but I currently don't have any further plan to improve its performance. So, any contribution will be welcomed. For questions, comments, or feature requests, you may use the github issue tracker or email me. Regards, -JJ FEATURES -------- * ds9 and ciao region files. * (physical, wcs) coordinate conversion to the image coordinate. * convert regions to matplotlib patches. * convert regions to spatial filters (i.e., generate mask images) LICENSE ------- MIT License. See LICENSE.txt From jturner at gemini.edu Mon Oct 19 11:45:39 2009 From: jturner at gemini.edu (James Turner) Date: Mon, 19 Oct 2009 12:45:39 -0300 Subject: [AstroPy] pyregion : python parser for ds9 region files In-Reply-To: <6e8d907b0910190323p3c897834g4a16c90d7299368@mail.gmail.com> References: <6e8d907b0910190323p3c897834g4a16c90d7299368@mail.gmail.com> Message-ID: <4ADC89A3.2060403@gemini.edu> Hi Jae-Joon, That looks interesting! It sounds like these region files are specific do DS9. I wonder whether there is a way to make it work with ximtool as well? Presumably it would require extending numdisplay or wrapping the IRAF "Client Display Library" and making it work like a back end? I'm guessing that's not a small amount of work though. Cheers, James. > Hi, > > pyregion is a python module to parse ds9 (and ciao) region files. The > parser is based on the pyparsing module. > My personal motivation with this module is to draw ds9 regions with > matplotlib, and to create mask images. > > Homepage : http://leejjoon.github.com/pyregion/ > examples w/ matplotlib : http://leejjoon.github.com/pyregion/examples.html > > GitHub repository : http://github.com/leejjoon/pyregion > > The parser seems to be rather slow (likely due to my lack of parser > design skill), but I currently don't have any further plan to improve > its performance. So, any contribution will be welcomed. > > For questions, comments, or feature requests, you may use the github > issue tracker or email me. > > Regards, > > -JJ > > > FEATURES > -------- > > * ds9 and ciao region files. > * (physical, wcs) coordinate conversion to the image coordinate. > * convert regions to matplotlib patches. > * convert regions to spatial filters (i.e., generate mask images) > > LICENSE > ------- > > MIT License. See LICENSE.txt > _______________________________________________ > AstroPy mailing list > AstroPy at scipy.org > http://mail.scipy.org/mailman/listinfo/astropy From lee.j.joon at gmail.com Mon Oct 19 13:41:09 2009 From: lee.j.joon at gmail.com (Jae-Joon Lee) Date: Mon, 19 Oct 2009 13:41:09 -0400 Subject: [AstroPy] pyregion : python parser for ds9 region files In-Reply-To: <4ADC89A3.2060403@gemini.edu> References: <6e8d907b0910190323p3c897834g4a16c90d7299368@mail.gmail.com> <4ADC89A3.2060403@gemini.edu> Message-ID: <6e8d907b0910191041s7f88c30alb8e27da19477873c@mail.gmail.com> On Mon, Oct 19, 2009 at 11:45 AM, James Turner wrote: > Hi Jae-Joon, > > That looks interesting! It sounds like these region files are specific > do DS9. I wonder whether there is a way to make it work with ximtool > as well? Presumably it would require extending numdisplay or wrapping > the IRAF "Client Display Library" and making it work like a back end? > I'm guessing that's not a small amount of work though. > Yes. what I wanted is to create regions files using ds9 and display them with matplotlib. For the ximtool part, I'm not sure what you're trying to do. I wonder if ximtool itself can handle ds9 region files. However, if you're talking about manipulating ds9 with something like numdisplay, you can simply use ds9's xpa protocol. Regards, -JJ > Cheers, > > James. > > >> Hi, >> >> pyregion is a python module to parse ds9 (and ciao) region files. The >> parser is based on the pyparsing module. >> My personal motivation with this module is to draw ds9 regions with >> matplotlib, and to create mask images. >> >> Homepage : http://leejjoon.github.com/pyregion/ >> ?examples w/ matplotlib : >> http://leejjoon.github.com/pyregion/examples.html >> >> GitHub repository : http://github.com/leejjoon/pyregion >> >> The parser seems to be rather slow (likely due to my lack of parser >> design skill), but I currently don't have any further plan to improve >> its performance. So, any contribution will be welcomed. >> >> For questions, comments, or feature requests, you may use the github >> issue tracker or email me. >> >> Regards, >> >> -JJ >> >> >> FEATURES >> -------- >> >> * ds9 and ciao region files. >> * (physical, wcs) coordinate conversion to the image coordinate. >> * convert regions to matplotlib patches. >> * convert regions to spatial filters (i.e., generate mask images) >> >> LICENSE >> ------- >> >> MIT License. See LICENSE.txt >> _______________________________________________ >> AstroPy mailing list >> AstroPy at scipy.org >> http://mail.scipy.org/mailman/listinfo/astropy > > From jturner at gemini.edu Tue Oct 20 11:25:55 2009 From: jturner at gemini.edu (James Turner) Date: Tue, 20 Oct 2009 12:25:55 -0300 Subject: [AstroPy] pyregion : python parser for ds9 region files In-Reply-To: <6e8d907b0910191041s7f88c30alb8e27da19477873c@mail.gmail.com> References: <6e8d907b0910190323p3c897834g4a16c90d7299368@mail.gmail.com> <4ADC89A3.2060403@gemini.edu> <6e8d907b0910191041s7f88c30alb8e27da19477873c@mail.gmail.com> Message-ID: <4ADDD683.6030201@gemini.edu> Hi JJ, > Yes. what I wanted is to create regions files using ds9 and display > them with matplotlib. > For the ximtool part, I'm not sure what you're trying to do. I wonder > if ximtool itself can handle ds9 region files. However, if you're > talking about manipulating ds9 with something like numdisplay, you can > simply use ds9's xpa protocol. I think ximtool only understands the IIS protocol spoken by both it and DS9; XPA is a DS9-specific thing. I was just thinking out loud that it would be nice to have a way to display overlays in either program using Matplotlib commands (but even if you'd be interested in that, it's hard to predict right now whether we'd need it enough to work on it). Cheers, James. From mdroe at stsci.edu Tue Oct 20 11:31:45 2009 From: mdroe at stsci.edu (Michael Droettboom) Date: Tue, 20 Oct 2009 11:31:45 -0400 Subject: [AstroPy] pyregion : python parser for ds9 region files In-Reply-To: <6e8d907b0910190323p3c897834g4a16c90d7299368@mail.gmail.com> References: <6e8d907b0910190323p3c897834g4a16c90d7299368@mail.gmail.com> Message-ID: <4ADDD7E1.3060401@stsci.edu> Jae-Joon Lee wrote: > The parser seems to be rather slow (likely due to my lack of parser > design skill), but I currently don't have any further plan to improve > its performance. So, any contribution will be welcomed. > The pyparsing-based TeX parser in matplotlib's mathtext is also rather suboptimal. But I found adding from pyparsing import * ParserElement.enablePackrat() made a considerable difference. I believe this caches sub-results as it goes. Have you played with that? Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA From lee.j.joon at gmail.com Tue Oct 20 12:38:27 2009 From: lee.j.joon at gmail.com (Jae-Joon Lee) Date: Tue, 20 Oct 2009 12:38:27 -0400 Subject: [AstroPy] pyregion : python parser for ds9 region files In-Reply-To: <4ADDD7E1.3060401@stsci.edu> References: <6e8d907b0910190323p3c897834g4a16c90d7299368@mail.gmail.com> <4ADDD7E1.3060401@stsci.edu> Message-ID: <6e8d907b0910200938kf668c5fx68f08f7573737962@mail.gmail.com> On Tue, Oct 20, 2009 at 11:31 AM, Michael Droettboom wrote: > made a considerable difference. ?I believe this caches sub-results as it > goes. ?Have you played with that? No, I haven't and I'll try it! Thanks for the tip. Regards, -JJ From erin.sheldon at gmail.com Tue Oct 20 16:27:44 2009 From: erin.sheldon at gmail.com (Erin Sheldon) Date: Tue, 20 Oct 2009 16:27:44 -0400 Subject: [AstroPy] patched pyfits 2.2.2 Message-ID: <331116dc0910201327r2262ddb5i2602b39791d6008@mail.gmail.com> Hi All - I've been maintaining a patched version of pyfits with some extended functionality for dealing with structured arrays (aka recarrays, arrays with fields). These patches are primarily related to the writing and reading of binary tables in a straightforward way using writeto/getdata. In my work I regularly create massive amounts of data and write it to FITS binary tables, so this is of particular importance to me. Here is a simple example of the new functionality. e.g # write an array with field directly to a fits file st = numpy.zeros(3, [('f1','f4'),('f2','S10'),('f3','2f8')]) st['f1'] = [1,3,5] st['f2'] = ['hello','world','byebye'] st['f3'] = numpy.random.random(st['f3'].shape) pyfits.writeto('testnew.fits', st) # read FITS data and write it back out to a different file data = pyfits.getdata('testnew.fits', ext=2, lower=True) pyfits.writeto('tmpfile.fits', data) A full description of the changes is at the bottom of this message, and labeled in the code with E.S.S. I've submitted patches to the pyfits maintainers but they are quite busy and won't be able to test or incorporate these patches any time soon. So I'm asking for some help testing these. My colleagues and I have been using these patches for a year or so but we need more eyes. The patches pass all the unit tests under /test. I've also added my own test testESS.py there. If you are interested, please download this tar ball and help us test. http://www.cosmo.bnl.gov/www/esheldon/code/python/pyfits-2.2.2espatch-v1.tar.gz Erin Sheldon Brookhaven National Laboratory Description of changes: NP_pyfits.pro: Patched FITS_rec class to allow views from ordinary numpy arrays/recarray writeto: Can now write arrays with fields (recarray, structured arrays) directly to a file. Calls _array_with_fields_writeto when appropriate. Also added check for an append= keyword for appending. append: Call _array_with_fields_writeto when appropriate. getdata: lower= and upper= keywords to change case of field names. _extract_format: A new method to get types. Deals properly with multi-dimensional arrays. This still needs to use TDIM to reshape into a NxM but at least the data is now characterized. TODO: implement shape info from TDIM _convert_format: Fixed error dealing with multi-dimensional arrays. TODO: implement shape info from TDIM _array_with_fields_writeto: New function to deal with writing an input ndarray,recarray, or fits.rec.recarray directly to a file, possibly appending. TODO: Deal with updating a header _stat_filename_or_fileobj(filename): utility function to get info about the input file name or object. rec.py: fromfile(): Use a view instead of recarray() which was giving errors for large arrays. Don't fully understand this. Examples: st = numpy.zeros(3, [('f1','f4'),('f2','S10'),('f3','2f8')]) numpy.random.seed(35) st['f1'] = [1,3,5] st['f2'] = ['hello','world','byebye'] st['f3'] = numpy.random.random(st['f3'].shape) print(st) pyfits.writeto('testnew.fits', st) st['f1'] = [8,12,55] st['f2'] = ['stuff','things','blah'] st['f3'] = numpy.random.random(st['f3'].shape) print(st) pyfits.writeto('testnew.fits', st, append=True) data = pyfits.getdata('testnew.fits', ext=2, lower=True) print(data) pyfits.writeto('tmpfile.fits', data)