Shapely is a Python package developed for GIS and geosciences that contains geometric utilities that could be useful for astronomy.
Requires libgeos_c , which is available from MacPorts as
geos, though it needs to be compiled by hand with gcc-4.0 to work with Python v2.5 as provided by STScI-Python. Download and compile with:
cd /tmp wget http://download.osgeo.org/geos/geos-3.2.2.tar.bz2 tar xzvf geos-3.2.2.tar.bz2 cd geos-3.2.2 CC=gcc-4.0 CXX=g++-4.0 ./configure --prefix=/opt/local/ make sudo make install
pip install Shapely
Note: Shapely doesn’t appear to work with PyRAF due to an ImportError. Importing shapely in PyRAF dies with the following error:
ImportError: No module named gestalt
This package is available to the native versions of Python installed in OSX, so it will be available to python2.5 outside of PyRAF.
The “gestalt” call is probably coming from a call to “import ctypes”. It appears to be testing if you’re running an old version of OSX, so if you’re running anything newer than 10.4.0, you can probably just comment out the “gestalt” sections in ctypes/__init__.py:
... if _os.name == "posix" and _sys.platform == "darwin": pass #import gestalt # gestalt.gestalt("sysv") returns the version number of the # currently active system file as BCD. # On OS X 10.4.6 -> 0x1046 # On OS X 10.2.8 -> 0x1028 # See also http://www.rgaros.nl/gestalt/ # # On OS X 10.3, we use RTLD_GLOBAL as default mode # because RTLD_LOCAL does not work at least on some # libraries. #if gestalt.gestalt("sysv") < 0x1040: # DEFAULT_MODE = RTLD_GLOBAL ...
(For my installation of STSCI_PYTHON 2.10, this file is /usr/stsci/pyssg/Python-2.5.4/lib/python2.5/ctypes/__init__.py).