Tuesday, December 15, 2009

Detexify!

for when you can't remember how to draw an angstrom:
detexify

Thursday, November 19, 2009

wget

wget is very useful for acquiring data from, e.g., IRSA, the NASA Infrared Science Archive.

wget -nd -r -l1 -A*g09*_b4_20.fits http://irsa.ipac.caltech.edu/data/IGA/images/

The important elements:
-nd: don't reproduce the host directory structure
-r: recursive. Grab the files referred to by the page, not just the page itself
-l#: number of recursion levels
-A: "accept" wildcard

Wednesday, October 21, 2009

New python software

IDLsave was released on my birthday. It does what you'd expect - read IDL save files into Python.
APLpy has a make_RGB_cube function now that takes care of all the internals of making an RGB image.... haven't tried it yet but I need to because it is awesome.

astro-better post

I contributed to a post on Astro Better asking about mosaicing software.

Sunday, October 18, 2009

#6 on Astro-ph today

IRAS 05358 on astro-ph. Check out my page on the region too.

This week at the Sun

Wednesday, Thursday, Saturday, Sunday @ The Southern Sun: Delicious. The Holler's Haze Smoked Porter is new on tap, and it's delicious. Very smooth, the smoke is pretty subtle (i.e. not overpowering the way most porters are), and it's 6.4%.

Cleveland Brown is back on tap too. It's not as good as I remember, but it will probably be better on nitro.

Still no word on whether the Carne Asada burrito will return.

Friday, October 16, 2009

First paper accepted

My Comps II paper on IRAS 05358+3543 was accepted by ApJ on Wednesday. It will show up on arxiv in a few days and I'll post the link then. Unfortunately, there were significant problems rendering the paper, so I recommend downloading my version.

Also, working on the HISA KDA... I have a nice section of cutouts

Wednesday, October 14, 2009

Galaxy Map

If you're ever interested in seeing a face-on view of the Milky Way, check out the Spitzer press release. This link is very surprisingly hard to find on google.

Wednesday, August 26, 2009

cython vs f2py

I had a go at optimizing some code this past week, and ended up learning to use both cython and f2py.

f2py is much easier to use. If you want to write a function in fortran and use it in python, all you do is write the code and add specifications using comments in the fortran code.

cython is more natural to code. The code style is C/fortran-like: think in terms of loops instead of arrays. The syntax is python-like, which makes coding somewhat clearer and simpler.

For my code, I found that cython was ~10% slower than fortran.

Check out the plfits in:
http://code.google.com/p/agpy/source/browse/#svn/trunk/

Monday, August 17, 2009

How to make a pretty image

The most difficult requirement to satisfy is WCS matching. Each image has to be in exactly the same pixel space in order to overlay them successfully in an image program. The process is generally to use Montage's mProject to project the images into the same plane, then mAdd with a blank map of a given size so that the dimensions in pixels are identical.

Once that's done, I load the images into GIMP. However, GIMP reads .fits files as 256 bit data - which is essentially useless because most (interesting) images have a dynamical range >~1000. So I usually make images emphasizing the faint emission in log scale with the high and low ends cut off (I use DS9 to determine high/low). I make a second copy showing the details of the very bright regions, again in logscale but it ends up being a different log scale - essentially, my transfer function becomes a broken power law.

The tricks in GIMP are numerous, but primarily two:
1. Rotate the color table ~60 degrees
2. Use images as "Layer Masks" (aka alpha layers) on a solid color background

There's also the nice trick when using radio data of using optical or some other wavelength to provide the high-resolution details, while the radio emission provides the intensity.

Saturday, August 15, 2009

FITS manipuation with imagemagick, gimp, etc.

It is possible to convert .fits files to .png, .jpg, etc:
convert -normalize a.fits a.png

To get things to come out nicely, you have to do the scaling essentially by hand in python/idl/iraf. DS9 is only useful for finding out what scaling you want to use; past that it's pretty much not useable.

To make colors look nice in the GIMP, use solid background layers with your image as the alpha mask. Then put your image in with itself as an alpha mask so you can easily control the whiteness (saturation) of the color you've selected.

I'll be blogging about this more as I prep my next entry for the NRAO photo contest.

Friday, August 14, 2009

Acquiring DSS images

This is the way to get DSS images:
ESO's batch downloader

Thursday, August 13, 2009

login shell

to change your default login shell, use chsh

Wednesday, August 12, 2009

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:

  1. Go to trigger pane, make new hotkey trigger
  2. press "." to allow you to type a command
  3. make sure the action is "Run"
  4. hook up a hotkey
  5. 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'

Saturday, July 25, 2009

Sunday, July 12, 2009

Year in review

It's been just over a year since I started this blog. I posted a LOT more than I thought I would. Also, I apparently dropped the tradition of reviewing beers. So I'll start by reviewing some beers!

Mountain Sun Hummingbird - a strong honey-ale (meade-beer?) brewed with orange blossom honey. Slightly darker than a typical Belgian Golden but similar in style. The beer is mildly sweet but very drinkable. Hmm... there are flavors I should mention but they escape me.

Mountain Sun/Avery Van Diemens - brewed with Tasmanian Pepper Berry, this is a very curious, semi-dark beer. When I first sampled it, I tasted a little bit of pepper kick at the end, but couldn't really identify any other flavors. Yesterday I sampled it next to a burrito with some somewhat spicy salsa. Somehow, since my mouth was already sensitized to spiciness, the flavor I got was root beer (sassafras?). It was... odd. Pretty good, but I didn't end up purchasing a glass.

Moving on to code. I don't know why I haven't mentioned this, but with my discovery of svn, I started uploading my code to the webternets: agpy is my Google Code page and includes a number of useful python codes, especially readcol and gaussfitter, which I have tested and used extensively since writing them. Python is still a long way from a cohesive astrolib code base, but with individual contributions, the STSCI development group, and APLpy underway, we're getting closer.

Wednesday, July 8, 2009

SUCCESS! 64 bit python with 64 bit tcl/tk!!!

After a long, tedious process (see previous posts), I got 64 bit python, 64 bit tcl/tk, and 64 bit tkinter all to work! I can now use the TkAgg backend in matplotlib!

Python 64 bit on Mac OS X: Sam Skillman's post

Tcl/Tk 64 bit: a post on the tcl/tk forums

tkinter 64 bit: python bug report 4017 (last two posts give the solution) and my posted solution

Sunday, July 5, 2009

Failure to compile 64 bit gtk on mac os

Attempted to install gtk+-2.17.2 on my mac. Had to install:
glib-2.21.2
which would not let me compile with multiple architectures, and
pkgconfig-0.9.0,
which won't configure because:

configure: configuring in glib-1.2.8
configure: running /bin/sh './configure' --prefix=/usr/local CC= CFLAGS= LDFLAGS= --cache-file=/dev/null --srcdir=.
configure: warning: CC=: invalid host type
configure: warning: CFLAGS=: invalid host type
configure: error: can only configure for one host and one target at a time
configure: error: /bin/sh './configure' failed for glib-1.2.8


which is bs because I don't have any compiler flags set.

So, gtk+ seems hopeless.

UPDATE: 0.9.0 is not the latest version, 0.23.0 is. Dumb version numbering.


GTK is absurd to install. You need:
pkg-config
glib
cairo
pixman
pango (MUST be installed AFTER cairo)
atk
libtiff
libjpg
jpeg2000 - but I just passed a flag to not do this because it didn't install right. --without-libjasper
fontconfig I mean, really? at this point it's just ridiculous....

and finally, it died with this:
checking Pango flags... configure: error:
*** Pango not found. Pango built with Cairo support is required
*** to build GTK+. See http://www.pango.org for Pango information.

which meant that I had to reinstall Pango because I had installed it before Cairo.

I believe this is where the term dependency hell comes from.

Also, I don't think any of these are x86-64 compatible.


Then I'm STILL not done.

PyGTK dies with an import error on dsextras, which a painful google search traces to pygobject. pygobject makes and installs fine.... but then I find out it installed to /usr/local/lib/python2.6/site-packages/gtk-2.0/, which is obviously not on my python path since I installed a framework.

So:
./configure --prefix=/Library/Frameworks/Python.framework/Versions/2.6/
in both pygobject and pygtk.

Oh, guess what? Need pycairo too. What happens there? What you'd guess:
ld warning: in /Developer/SDKs/MacOSX10.5.sdk/usr/local/lib/libcairo.dylib, file is not of required architecture

so when I configure pygtk:

The following modules will be built:

atk
pango

The following modules will NOT be built:

pangocairo
gtk
gtk.glade
gtk.unixprint

Damn. That blows.

python-64 -c "import gtk"
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gtk-2.0/glib/_glib.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gtk-2.0/glib/_glib.so: mach-o, but wrong architecture

FAIL.

Thursday, July 2, 2009

Installing 64 bit tcl/tk on Mac OS X

Everything is described in this post:
http://www.nabble.com/Error-compiling-tk-8.5.7-on-Mac-OS-X-10.5-td23790967.html


But here's a script too:

curl -O 'http://osdn.dl.sourceforge.net/sourceforge/tcl/t{cl,k}8.5.7-src.tar.gz'
for f in t*8.5.7*.gz; do tar zxf $f; done
cd tcl8.5.7/unix/
./configure --enable-framework --enable-64-bit
cd tk8.5.7/unix/
./configure --enable-framework --enable-64-bit
make -j 4 -C tcl8.5.7/unix
make -j 4 -C tk8.5.7/unix
sudo make install -C tcl8.5.7/unix
sudo make install -C tk8.5.7/unix


Concerns:
-might be necessary to do this in the macosx directory for some reason, though Aqua doesn't support 64 bits
-have to recompile python to get _tkinter to work (see a later post)

Monday, June 29, 2009

Make PDFs open with the thumbnails window open

Neat trick I picked up from here:
http://www.ghostscript.com/~ghostgum/pdftips.htm

Add this code:

\special{! /pdfmark
[/View [/XYZ null null 1] % unspecified x and y offset, 100% zoom
/Page 1
/PageMode /UseThumbs % /UseNone /UserOutlines /UseThumbs /FullScreen
/DOCVIEW pdfmark
}

to a LaTeX document (probably near the top) and when you ps2pdf it, it will open the PDF with the thumbnail bar open. This is very useful for proofreading after you latex a file. Of course, xdvi also works well for this, but xdvi is VERY unstable on the Mac. At least adobe, being a native Mac program, doesn't crash as often.

Monday, June 22, 2009

Monday, June 15, 2009

Art mimicing reality

An artist who likes painting astronomical objects:
Marianne Beacham Gallery

Sunday, June 14, 2009

Comps 2 reflections

Comps 2 included some successes and some failures.

The most successful part of my Comps preparation was the Monday talk. The previous talk on Tuesday was somewhat helpful in terms of realizing that I needed larger figure axes, but otherwise provided no useful feedback. The Monday talk allowed me to realize what needed to be done to make my talk accessible to a larger audience.

At the defense, I ended up going only ~40 minutes despite having gone far over time in the Monday version and spending ~5 minutes answering questions from Don and Mike. I think that was a good thing; I didn't need to say anything more even though there was an enormous amount of additional material I could have covered.

The main change I made from Monday to Friday was reorganizing such that I discussed the largest scales first and zoomed in, and I spent much more time discussing the larger context of my work. Unfortunately, I also spent most of the week before the presentation determining the larger context and reading papers. Ideally, I would have done that before handing in the paper.

The closed door Q&A section went OK but not great. There were a few important bits of information related to the IMF that I didn't know off the top of my head - e.g. the ratio of total # of stars to the # of B stars. I got the lowest mass star (.07) confused with the most common star mass (.3). I wasn't particularly able to integrated the IMF on the board either. I didn't remember the Jeans mass-temperature and mass-density relationships but was able to derive them quickly enough.

Probably the biggest problem was dealing with a question about the partition function - specifically how did the partition function come into play in the column density equation. I didn't come up with the right answer at all, and in particular quoted the wrong distribution. However, I think a big part of what they expected to hear was a dependence on temperature AND degeneracy, and I never explicitly mentioned degeneracy. It turned out that the equation I had quoted in both the paper and the talk was correct, but I couldn't come anywhere close to proving that on the spot.

My expected result is therefore a low pass, though it was not made explicit. That's rather unfortunate as it's possible that another month of preparation could have gotten me the high pass, but at the same time, it's well worth having the project done.

Tuesday, June 2, 2009

Most important astronomical publications

I'm interested to hear input on this. Some I know of:
Cardelli, Clayton, Mathis 1989 - determined interstellar extinction law
Kurucz 1993 - possibly a book? Stellar atmosphere calculations

Tuesday, May 26, 2009

public perception of astronomers

Public Perception of Astronomers

While the article has some.... almost-interesting points, I don't agree with the thesis or the suggested methods. I don't really have a problem with the stereotype of astronomers being the old, white, socially inept guy - because for the most part that's a fair assessment. We're scientists, and at least for me and my peers, that's directly correlated with not fitting in to some social circles.

I agree that we should become better communicators in general, but it's silly to think that embracing new technologies (i.e. social networking tools) is going to change the public image of astronomers at all. Personally I hope to see a backlash against social networking and blogs sometime in the next 5 years, but who knows.... after all, I'm writing a blog post.

Monday, May 25, 2009

some comics

http://ableandbaker.net/index.php?comic=198
http://ableandbaker.net/index.php?comic=222
http://ableandbaker.net/index.php?comic=357
http://ableandbaker.net/index.php?comic=396
http://ableandbaker.net/index.php?comic=471
545 "Put on your snuggle trunks and jump in the cuddle pool."
http://ableandbaker.net/index.php?comic=905
http://ableandbaker.net/index.php?comic=922

Thursday, May 7, 2009

Comedic timing has been fixed using quicksilver's command line execution abilities.

Also been playing with dashboard... Safari's new dashboard feature is pretty cool, but also incompetent.  It refreshes every time you reload the dashboard, which is inefficient and makes saving settings impossible.  Also, the gmail compose feature fails miserably.  So, dashboard must die again.

Wednesday, May 6, 2009

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.

Tuesday, April 21, 2009

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-prototypes

compile 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.c
In 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 endianness
lipo: can't figure out the architecture type of: /var/folders/ni/ni+DtdqFGMeSMH13AvkNkU+++TI/-Tmp-//cceaWIvZ.out
In 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 endianness
lipo: can't figure out the architecture type of: /var/folders/ni/ni+DtdqFGMeSMH13AvkNkU+++TI/-Tmp-//cceaWIvZ.out
error: 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.

Monday, April 20, 2009

Hosting on my mac

I'm hosting my website off my mac; it should be accessible to the outside world now: eta.colorado.edu.

A few things went into this....

  1. Don't install the fink version. The two versions clash and depending on how you access your computer you could end up looking at entirely different directories (e.g. localhost and eta.colorado.edu referred to different sites for a while)
  2. The configuration file is /private/etc/apache2/httpd.conf
  3. I needed to change DirectoryIndex to index.htm (from index.html)
  4. uncommmented "LoadModule php5_module libexec/apache2/libphp5.so"
  5. had to allow override so that .htaccess files would work.

Wednesday, April 15, 2009

Mac stuff cont'd

Trying to get Apache server to run, and it's just a pain.

I frequently forget how to update the locate database because it's different on macs. Marcos' Mac Singularity has the instructions .

In short:
sudo /usr/libexec/locate.updatedb

Tuesday, April 14, 2009

Google has failed me

So, either no one on the internet has successfully installed 64-bit python on a mac (which I find nothing short of impossible) or google has totally failed. None of the hits for any combination of 64 bit, python, mac, etc. has shown a useful result. Wow.

Monday, April 6, 2009

Caffeine

Caffeine consumption stopped around mid-October. I think it was when I got back from observing so October 20 give or take. Re-started consumption mid-March. Date is hard to say... I think it was Sunday before Spring Break, but hard to say because I still took it easy until ~last week.

Conclusions? I'm probably more tired in the mornings with caffeine than without. Also, probably perform better @ ulty when I'm not addicted. However.... not really conclusive. Just addictive.

Saturday, April 4, 2009

weekend

What did I do this weekend?
-upgraded PyRAF from 1.6.1 to 1.7
-switched matplotlib backends from TkAgg to Qt4
-put up a new article on molecularclouds


So... totally unproductive, but only in an awesome way?

I tried to switch PyRAF from X11 to Aqua a la Ticket 86 on the PyRAF trac site, but it failed with a can't-load error.

Also, updated readcol documentation so that it makes sense. Sam has used it, Robbie might.

Wednesday, April 1, 2009

April 1st, 2009

No April fools' day would be complete without scientists' contributions:

http://arxiv.org/abs/0903.5308
http://arxiv.org/abs/0903.5321
http://arxiv.org/abs/0903.5377

although it's not obvious whether .5308 is actually intended to be humorous

Wednesday, February 25, 2009

Astronomy gets some recognition

First off, this guy does some amazing work, like measuring the galactic rotation curve. He got recognized by the Colbert Report. Sweet.

Wednesday, February 18, 2009

My works featured...

Curiously, one of my wikimedia commons images has been included in this article: http://www.scienceinschool.org/2008/issue10/tamaradavis, though the image has little to do with the subject in question. Noodle (can't remember her real name... that's sad on my part) is in the picture. Neat!

This might not be something to be proud of:
http://www.denverptc.org/denver.html

GC was featured in:
http://www.strudel.org.uk/blog/astro/000855.shtml

Thursday, January 22, 2009

ps2pdf keep resolution, crop to bounding box

ps2pdf -dEPSCrop -dAutoRotatePages=/None -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dUseFlateCompression=true l007_displaycrop.ps
ref: this post

Making a postscript plot of a gigantic fits image


map = readfits('MOSAIC.fits',hdr)

crpix1 = sxpar(hdr,'CRPIX1')
crpix2 = sxpar(hdr,'CRPIX2')
crval1 = sxpar(hdr,'CRVAL1')
crval2 = sxpar(hdr,'CRVAL2')
cd1_1 = sxpar(hdr,'CD1_1')
cd2_2 = sxpar(hdr,'CD2_2')

x = lindgen(n_e(map[*,0]))
y = lindgen(n_e(map[0,*]))
l = (x-crpix1)*cd1_1+crval1-360
b = (y-crpix2)*cd2_2+crval2

imdisp,map,/axis,xrange=[max(l),min(l)],yrange=[min(b),max(b)],range=[-1,8]


This code makes use of imdisp.pro.

Wednesday, January 14, 2009

MOSAIC data reduction

MOSAIC reduction is very difficult.
http://www.noao.edu/noao/noaodeep/ReductionOpt/frames.html has the official instructions.

Important things:
Have the latest version of MSCRED and MSCDB installed. Both will give cryptic errors or "cannot open file" errors (because the files don't exist) otherwise.



mscred
setinstrument kpno CCDMosaThin1
msccmatch obj09*.fits coords="!mscgetcat $I $C" search=60 rsearch=1 nfit=30 accept=yes interactive=no fit=no

Tuesday, January 13, 2009

Site visits, comps


Amusing - visits to my site increased steadily leading up to Jan 9, then crashed precipitously.