a clue as to why: functional ft2font.so: $ otool -L /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so: /usr/local/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.22.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/local/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.14.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) nonfunctional ft2font.so: $ otool -L /Users/adam/repos/yt/yt-i386/lib/python2.7/site-packages/matplotlib/ft2font.so/Users/adam/repos/yt/yt-i386/lib/python2.7/site-packages/matplotlib/ft2font.so: /Users/adam/repos/yt/yt-i386/lib/libfreetype.6.dylib (compatibility version 13.0.0, current version 13.2.0) /Users/adam/repos/yt/yt-i386//lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/local/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.14.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) /usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) The culprit is the difference between those two (maybe?): $ file /usr/local/lib/libgcc_s.1.dylib/usr/local/lib/libgcc_s.1.dylib: Mach-O universal binary with 4 architectures/usr/local/lib/libgcc_s.1.dylib (for architecture i386): Mach-O dynamically linked shared library i386/usr/local/lib/libgcc_s.1.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64/usr/local/lib/libgcc_s.1.dylib (for architecture ppc): Mach-O dynamically linked shared library ppc/usr/local/lib/libgcc_s.1.dylib (for architecture ppc64): Mach-O 64-bit dynamically linked shared library ppc64$ otool -L /usr/local/lib/libgcc_s.1.dylib/usr/local/lib/libgcc_s.1.dylib: /usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.9)
Merging postscripts
This is essential and really difficult to find answers to, but this guy gave it: http://ludo.qix.it/archive/2005/08/merge-postscript-files.html The keywords I would have liked to see: "merge postscripts into multi-page document" or "combine postscript multiple page" e.g. gs -sDEVICE=pswrite -sOutputFile=output.ps -dNOPAUSE -dBATCH file1.ps file2.ps file3.psorgs -sDEVICE=pswrite -sOutputFile=05358spectra.ps -dNOPAUSE -dEPSFitPage -dBATCH `ls 05358_*.eps`(the added option is to make sure the .eps isn't cropped)
MOVIES!
Making movies is surprisingly difficult. No matter what language you use, apparently true movie files can only be made by stringing together images, i.e. there is no native movie-producing feature. Gnuplot can do some simple animations but to do anything sophisticated you need to start delving into variables, and for that I switch to a real language. So, I returned to python. As usual, it took no more than a few hours of coding and learning to come up with something. But it bothers me that it took that long: I still think python is most deficient in its failure to create a default column-text reader like 'readcol' in IDL. I can't complain that much, though: I wrote my own in about 5 minutes. Anyway, the key is to use the .set_xdata and .set_ydata functions of a plot to update a canvas. I still don't have nearly as high a plotting speed as I'd like, but it works alright if I don't display to screen. Probably a different backend would be more effective but I don't like to mess with backends. I use `` savefig(filename,dpi=50) `` to reduce the image quality so that it's easier for the animator to handle. ImageMagick's convert can be used to stitch any kind of image into a movie given that you've installed an mpeg2 encoder (fink gave me mpeg2vidcodec).
The command is very simple: convert -size 300x300 *.png movie.mpg
I had to use a smaller image size because a series of 1000x12kb files somehow chomped ~6-8 GB of RAM and swap space.
Neat new things....
1. sptool is a quick way to compare standards to stellar spectra. Nice, I'd been looking for a tool like that. 2. GNU screen captions are useful especially when working in a screen-within-a-screen environment (who does that, really?) 3. finally got SPLAT to work... turns out I just hadn't reduced my damned data 4. kill -STOP and kill -CONT are really useful ways to pause programs that are sucking up resources if you want to resume them later. Haven't tried this on "real" code yet.
New python software
PHP and CGI working in the same directory
While it's not possible to get CGI and PHP to work within the same file, you can get .html and .htm files to use cgi/php scripts alternately in the same directory with the following .htaccess file:
RemoveHandler .htmlAddType text/html .htmAddHandler application/x-httpd-php .php .html AddHandler server-parsed .htm .html
If anyone can prove the previous statement false, please do! I spent hours googling and hacking to try to get php and cgi to work within the same file. Also, the way the above file is parsed makes no sense to me. It is inverted from how I would have thought it should work.
Port vs Fink
Port failed to install: adam-macbook ~$ sudo port install py25-matplotlib---> Building py25-hashlib with target build---> Staging py25-hashlib into destroot---> Installing py25-hashlib 2.5.2_0---> Activating py25-hashlib 2.5.2_0---> Cleaning py25-hashlib---> Fetching py25-zlib---> Verifying checksum(s) for py25-zlib---> Extracting py25-zlib---> Configuring py25-zlib---> Building py25-zlib with target build---> Staging py25-zlib into destroot---> Installing py25-zlib 2.5.2_0---> Activating py25-zlib 2.5.2_0---> Cleaning py25-zlib---> Fetching py25-setuptools---> Attempting to fetch setuptools-0.6c8.tar.gz from http://cheeseshop.python.org/packages/source/s/setuptools/---> Verifying checksum(s) for py25-setuptools---> Extracting py25-setuptools---> Applying patches to py25-setuptools---> Configuring py25-setuptools---> Building py25-setuptools with target build---> Staging py25-setuptools into destroot---> Installing py25-setuptools 0.6c8_2---> Activating py25-setuptools 0.6c8_2---> Cleaning py25-setuptools---> Fetching py25-tz---> Attempting to fetch pytz-2007k.tar.bz2 from http://cheeseshop.python.org/packages/source/p/pytz/---> Verifying checksum(s) for py25-tz---> Extracting py25-tz---> Configuring py25-tz---> Building py25-tz with target build---> Staging py25-tz into destroot---> Installing py25-tz 2007k_0---> Activating py25-tz 2007k_0---> Cleaning py25-tz---> Fetching py25-dateutil---> Attempting to fetch python-dateutil-1.4.1.tar.gz from http://labix.org/download/python-dateutil---> Verifying checksum(s) for py25-dateutil---> Extracting py25-dateutil---> Configuring py25-dateutil---> Building py25-dateutil with target build---> Staging py25-dateutil into destroot---> Installing py25-dateutil 1.4.1_0---> Activating py25-dateutil 1.4.1_0---> Cleaning py25-dateutil---> Fetching fftw-3---> Attempting to fetch fftw-3.1.3.tar.gz from http://www.fftw.org/---> Verifying checksum(s) for fftw-3---> Extracting fftw-3---> Configuring fftw-3---> Building fftw-3 with target all---> Staging fftw-3 into destroot---> Installing fftw-3 3.1.3_0---> Activating fftw-3 3.1.3_0---> Cleaning fftw-3---> Fetching py25-nose---> Attempting to fetch nose-0.10.4.tar.gz from http://somethingaboutorange.com/mrl/projects/nose/---> Verifying checksum(s) for py25-nose---> Extracting py25-nose---> Configuring py25-nose---> Building py25-nose with target build---> Staging py25-nose into destroot---> Installing py25-nose 0.10.4_0---> Activating py25-nose 0.10.4_0---> Cleaning py25-nose---> Fetching py25-numpy---> Attempting to fetch numpy-1.2.0.tar.gz from http://downloads.sourceforge.net/numpy---> Verifying checksum(s) for py25-numpy---> Extracting py25-numpy---> Applying patches to py25-numpy---> Configuring py25-numpy---> Building py25-numpy with target buildError: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-numpy/work/numpy-1.2.0" && /opt/local/bin/python2.5 setup.py build " returned error 1Command output: setup_package() File "setup.py", line 89, in setup_package configuration=configuration ) File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-numpy/work/numpy-1.2.0/numpy/distutils/core.py", line 184, in setup return old_setup(**new_attr) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py", line 151, in setup dist.run_commands() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py", line 974, in run_commands self.run_command(cmd) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py", line 994, in run_command cmd_obj.run() File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-numpy/work/numpy-1.2.0/numpy/distutils/command/build.py", line 37, in run old_build.run(self) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/command/build.py", line 112, in run self.run_command(cmd_name) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/cmd.py", line 333, in run_command self.distribution.run_command(command) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py", line 994, in run_command cmd_obj.run() File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-numpy/work/numpy-1.2.0/numpy/distutils/command/build_src.py", line 130, in run self.build_sources() File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-numpy/work/numpy-1.2.0/numpy/distutils/command/build_src.py", line 147, in build_sources self.build_extension_sources(ext) File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-numpy/work/numpy-1.2.0/numpy/distutils/command/build_src.py", line 250, in build_extension_sources sources = self.generate_sources(sources, ext) File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-numpy/work/numpy-1.2.0/numpy/distutils/command/build_src.py", line 307, in generate_sources source = func(extension, build_dir) File "numpy/core/setup.py", line 87, in generate_config_h raise SystemError,"Failed to test configuration. "\SystemError: Failed to test configuration. See previous error messages for more information.Error: The following dependencies failed to build: py25-numpy py25-tkinter tcl tkError: Status 1 encountered during processing. I don't want to deal with it so I'm just using Fink.
Postscript to PDF conversion
ls *.ps | sed 's/\(.*\).ps/ps2pdf \1.ps \1.pdf/' | bash because it's impossible to view multiple postscripts in a single window.... how annoying. Corollary: ls *.pdf | sed 's/\(.*\).pdf/pdf2jpeg \1.pdf \1.jpg/' | bash
Python 64 bit!
I got python 64 bit to compile, but it required a number of tricky steps. First, this guy has the instructions I followed: captnswing However, it didn't work entirely as advertised. I ran the configure as advertised: ./configure --enable-framework=/Library/Frameworks \--enable-universalsdk=/ \MACOSX_DEPLOYMENT_TARGET=10.5 \--with-universal-archs=all \--with-readline-dir=/usr/local then the make install, but /usr/local/bin/python pointed to the wrong place, so I replaced the symbolic link in my python path with the correct one: sudo rm /Library/Frameworks/Python.framework/Versions/2.6/bin/python sudo ln -s /Library/Frameworks/Python.framework/Versions/2.6/bin/python-64 /Library/Frameworks/Python.framework/Versions/2.6/bin/python Now python is 64 bit: eta ~$ python -c "import sys; print sys.maxint"9223372036854775807 I haven't checked whether it works yet though... Update: Had to reinstall with gnu readline installed. Also have to install PyQt4 and might have to recompile numpy... numpy won't compile with python 2.6.2: C compiler: gcc -arch i386 -arch ppc -arch ppc64 -arch x86_64 -isysroot / -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypescompile options: '-Inumpy/core/include -Ibuild/src.macosx-10.5-universal-2.6/numpy/core/include/numpy -Inumpy/core/src -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'gcc: build/src.macosx-10.5-universal-2.6/numpy/core/src/_sortmodule.cIn file included from numpy/core/include/numpy/ndarrayobject.h:26, from numpy/core/include/numpy/noprefix.h:7, from numpy/core/src/_sortmodule.c.src:29:numpy/core/include/numpy/npy_endian.h:33:10: error: #error Unknown CPU: can not set endiannesslipo: can't figure out the architecture type of: /var/folders/ni/ni+DtdqFGMeSMH13AvkNkU+++TI/-Tmp-//cceaWIvZ.outIn file included from numpy/core/include/numpy/ndarrayobject.h:26, from numpy/core/include/numpy/noprefix.h:7, from numpy/core/src/_sortmodule.c.src:29:numpy/core/include/numpy/npy_endian.h:33:10: error: #error Unknown CPU: can not set endiannesslipo: can't figure out the architecture type of: /var/folders/ni/ni+DtdqFGMeSMH13AvkNkU+++TI/-Tmp-//cceaWIvZ.outerror: Command "gcc -arch i386 -arch ppc -arch ppc64 -arch x86_64 -isysroot / -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Inumpy/core/include -Ibuild/src.macosx-10.5-universal-2.6/numpy/core/include/numpy -Inumpy/core/src -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c build/src.macosx-10.5-universal-2.6/numpy/core/src/_sortmodule.c -o build/temp.macosx-10.5-universal-2.6/build/src.macosx-10.5-universal-2.6/numpy/core/src/_sortmodule.o" failed with exit status 1 That sucks.
Python: setting matplotlib defaults
Setting matplotlib defaults is a lot more difficult than it should be. matplotlib.defaultParams['image.origin']='lower'matplotlib.defaultParams['image.interpolation']='nearest'