to get imshow defaults to be nearest neighbor, need to edit ~/.matplotlib/matplotlibrc. Still don't know how to change default command-line output format.
Quicksilver and Awesome
Set up f17-19 today to play amusing sounds. Also, recalled that I use ScreenSaverEngine to lock my screen with a shortcut key. Quicksilver triggers are the way to do it. Mac is stupid w/o quicksilver.
Quicksilver sounds
To switch sound source from the command line: switchaudio Use this to make scripts such as: #!/bin/bash/Users/adam/humor/SwitchAudioSource -s "Built-in Line Output"afplay /Users/adam/humor/losinghorn.wav/Users/adam/humor/SwitchAudioSource -s "Built-in Output" Then make triggers in Quicksilver by:
- Go to trigger pane, make new hotkey trigger
- press "." to allow you to type a command
- make sure the action is "Run"
- hook up a hotkey
- if it doesn't work, just try again. Persist through crashes, they happen often.
Follow-up: You can also control the volume! http://discussions.apple.com/thread.jspa?threadID=585781 `` osascript -e 'set volume output volume 100'``
RATRAN on Mac OS X
Mac OS X doesn't like the defaults built in to RATRAN. It died unhappily with errors like: ld_classic: can't locate file for: -lcrt0.o and ld: warning: in /usr/local/lib//libcfitsio.a, file is not of required architecture In order to get it to run, I had to do the following:
- Install CFITSIO with CFLAGS="-arch x86_64 -arch i386 -g -O2" to /usr/local/lib
- Edit the sky/Makefile OPT variable (line 23) to read: OPT = -I. -O2 -fno-automatic -arch x86_64
Also, you need to set up system variables:
export RATRAN=/path/to/Ratran export RATRANRUN=/path/to/Ratran/run
Reinstalling a system
Python died tonight when I foolishly tried to update numpy or matplotlib. One was not compatible with the other in upgraded form, and the update for matplotlib wouldn't install because of GTK issues that were totally opaque. So, I reinstalled EVERYTHING - fink AND macports - from scratch. If I don't get things running by morning I'm going to have to do a restore, which is ugly as death. Things I need to do post-install: `` sudo port install python_select sudo python_select python25`` test ipython test matplotlib test numpy
SAVE / RESTORE in Python
Save/Restore is probably the single best feature of IDL that, sadly, is very poorly replicated in Python. For 1 or 2 dimensional variables, you can use Pylab's save/load, but I never use such piddling tiny arrays. For higher dimensional objects, either using FITS files (a pain because of header definitions) or pickling ought to work. e.g.: import numpyimport picklex=ones([10,10,10,10],dtype='float64')pickle.dump(x,open('x.pysav','w'))X = pickle.load(open('x.pysav','r'))
Screen cont'd
Guide to screen Particularly useful features: Scrollback: ctrl-a [[scroll keys] Switch to a numbered screen (doesn't work for me so far): ctrl-a [number]
Screen, nohup, ssh, scp
I learned a lot about the above in the past day, but I didn't keep track of the links. First, screen is very useful: it allows you to run any task, detach the screen, and let it run in the background. You can resume it later. Example: screenipython run_fitter.py<ctrl-a> dscreen -r Second, it's a huge pain to type a password every time I use scp and ssh. The solution is to make a key on your computer and put it in the authorized_keys file. ssh-keygen -t rsascp ~/.ssh/id_rsa ginsbura@milkyway.colorado.edu:.ssh ginsbura@milkyway.colorado.educat id_rsa >> ~/.ssh/authorized_keysssh -v ginsbura@milkyway.colorado.edu Use ssh -v to figure out why it fails if it still asks you for a password. In one case, this happened because the computer I was using expected the id to be in ~/.ssh/identity instead of ~/.ssh/id_rsa. There may also be permissions issues (i.e. you want restrictive permissions on your ssh keys). With the latter, you can still use nohup, which is helpful if you want to pipe your output to a log file.
SSH
Learned something knew about ssh... keys are stored in ~/.ssh/known_hosts. If a remote key changes, you may be denied access if your saved key is wrong.
Using AWK to fixed-format print in VIM
24,42!awk '{printf("\%30s\%20f\%15g\%15g\%15g\%15g\%15g\%15g\%15g\%5i\n" , $1,$2,$3,$4,$5,$6,$7,$8,$9,$10)}'
It's important that the %'s must be escaped, otherwise they print the current filename.