Monday, November 24, 2008

.inputrc

New unix stuff!

This is, again, stuff I'd searched for forever but never found the right collection of terms. This is what bash readline is REALLY all about.

if you make an inputrc file, you can get awesome readline capabilities (similar to ipython). This post at lifehacker showed me how to do it. This site has a more complete description of how to use readline/inputrc.

Even better: VI command line editing .

There's also something called magic space but I don't know what purpose it serves all the time... it will replace 'magic' characters like !* and !& and !! with whatever command they represent if you hit space immediately after typing them (explained better here).

Wow. Awesome.

Thursday, November 20, 2008

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.

Monday, November 17, 2008

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]

Sunday, November 16, 2008

Ultimate today

We went 2-1 in the tournament, losing the final in a windy game on universe point, 15-14. We won the first game 13-5 or 13-6, and the second by a similarly wide margin. I think I scored 15-20 points on the day and threw an additional few. 2-3 drops and 3-4 throwaways to balance that out. Pretty good on the whole for what was probably my last ultimate of the season.

Of course, that made me very exhausted for the review session this evening. Oh well, I think it worked out. I need to remember to come up with (and post!) a clear explanation of why you can use that silly little triangle to come up with the translation between angle on the sky and image size.

Thursday, November 13, 2008

BASH discoveries, readline questions

1. shopt -p
Maybe my hostname completion worked and then stopped working because the bash option hostcomplete was not set. Duh! Why? I don't know. Anyway, shopt -s hostcomplete solves the problem.

nocaseglob is also pretty cool (case insensitive tab completion)

2. it's really hard to search for readline stuff on google. Can anyone explain to me how BASH readline works? I would REALLY like to make bash readline work like ipython, in which you can start typing a command and hit the 'up' key to search through the history for anything beginning with the stuff you've typed up to that point. But I can't even find documentation for the ipython readline! Any hints, anyone?

3. my desktop at work blocks ssh connections. I can ssh into some computers and then into it, but not directly into it.

...as usual, I made a list where not-a-list would have sufficed, and I had to add the last thing because a 2-item list is dumb.

Wednesday, November 12, 2008

Why do astronomers have such a strong presence on the web?

I'm not making this a complete post, just a few examples of blogs and websites I'm aware of. But we do have a strong presence on the web - astronomers have an unusually high google ranking etc. Is it just because 'we' were here first ('we' excludes me, I'm just jumping on the bandwagon and getting a free ride)?

Examples:
Pamela Gay
Dr Lisa

Science writers who write on astronomy:
Dave Mosher