Danger! Do not look into laser

This page is for distributing software I've written that might be of use to other people. And a couple of manifestoes.

Currently there are a few possibly useful utilities here:

New: I'm releasing publicly available code through my github account 'bjweiner'. Visit there to find repositories of some of the code described below.

New: I've put up a large base of old Fortran code that was used for the first-semester "unofficial" DEEP2 redshift fitting and quality inspection code, on github at https://github.com/bjweiner/DEEP2-redshift. While this is extremely old technology, the techniques used may be of interest to people interested in redshift measurement on spectra from large surveys. Also, the repository includes a number of useful utilities and programs for working with the DEEP2 1-d spectrum data format. Please read the README and note the issues with libraries required and citation if you use the code.

Are you having trouble getting the PGPLOT plotting library installed on Mac OS X 10.6 or a 64 bit Mac? So are a lot of other people! I've made a small change to the configuration files that will solve the problem, get your PGPLOT compiled, brighten your day, butter your toast and make you a good cup of coffee. Here are PGPLOT for Mac configuration files and installation instructions.

LBT/LBC (Large Binocular Camera) data reduction script pipeline package. This contains scripts to reduce imaging data from the Large Binocular Camera at the Large Binocular Telescope. There is not a manual as such, but a readme file that shows the commands to walk through reduction of a dataset. The scripts use IRAF + mscred to reduce the LBC data up to flatfielded, de-fringed, and cosmic-ray cleaned images, and then use IDL, SExtractor, scamp and swarp to produce astrometric calibrations and stack your data into a distortion-corrected combined image. The procedure takes you from raw data all the way to combined mosaics with astrometry and a good WCS (world coordinate system). These are built on previous work generously donated by Dave Sand and Jason Harris.

The LBC reduction scripts have not been tested on every possible kind of data, so it's very likely that some datasets will make them fail. They are not complicated in principle, so if there are small problems (like missing header fields) you should be able to figure out what's going on. They assume you have some working knowledge of CCD data and reduction. If they break, you get to keep both pieces. However, if you find bugs with them, please report the bugs and I'll attempt to fix them.

Near Future: I have written some scripts for implementing the Teplitz et al cookbook for Spitzer/IRS spectroscopy on faint sources. You will still need Spitzer Science Center tools including irsclean_mask and SPICE to do the actual extraction - my scripts should let you do better sky subtraction and rogue pixel masking. These are not released yet while my office mates try to break them and I test them on some more data sets. If you have a pressing IRS need, contact me.

LSTSQ and MLSFIT - two programs for least-squares fitting of linear relations y = A + Bx to x,y data. Many (too many) algorithms exist for fitting lines to data. These programs are somewhat novel because they allow fitting a relation with intrinsic scatter, that is a relation where the scatter in the data is larger than can be explained by the observational errors on x and y. Further details are in the discussion and Appendix of my paper on the evolution of the Tully-Fisher relation, Weiner et al 2006b, ApJ, 653, 1049, arXiv version: astro-ph/0609091.

DAO_MAKEPSF - a short Fortran program that reads ASCII .psf files created by Peter Stetson's DAOPHOT II program and writes a .fits image of the PSF. This is useful if you run daophot from the command line (not from inside IRAF) and want to check that the point spread function that daophot has constructed looks good, since the ASCII file is not easy to read. I use this when using daophot to do PSF-fitting photometry on Spitzer/MIPS far-infrared imaging. DAOPHOT constructs a PSF based on an analytic function (e.g. Gaussian) and empirical corrections, and currently this program only works if you use the Gaussian, not some other analytic function. You will need to edit the makefile to tell it where to find the FITSIO library.

DISTCALC - a simple Fortran program to calculate tables of cosmological distances -- comoving, angular diameter, luminosity distance and so on -- for your choice of Hubble constant, Omega_matter, Omega_lambda. Sorry, no time-varying dark energy. These are just implementations of the formulae in Hogg's Distance Measures in Cosmology essay with a really dumb numerical integrator that is accurate enough for practical purposes.

FITSIOWRAP - an abstraction layer between IMFORT and FITSIO. It's a package of subroutines that masquerade as IRAF IMFORT subroutines, but call FITSIO routines, so that programs written to call IMFORT routines can be linked with FITSIOWRAP and FITSIO, calling FITSIO to work on FITS files without any changes to the original program code. Of use to astronomers who have old code lying around that uses the IMFORT library to access IRAF images or data.

convert_spec1d for DEEP2 - convert_spec1d will convert a DEEP2 1-d spectrum in FITS binary table format (a spec1d file), with arrays of wavelength, flux, inverse variance, into a format that IRAF can read. It makes a 2xN image that is linearized in wavelength: flux is in the first row of pixels, and error (rms) is in the second row of pixels. This can then be read by IRAF tasks such as splot. This program can be adapted to read other binary table spectra (eg from SDSS or BOSS) by editing some of the DEEP2-specific stuff, like the names of the FITS extensions. To compile it you should just need to edit the makefile to point at your copy of the cfitsio library.

gasdev.sm - a Supermongo macro that generates a vector of random numbers with a gaussian distribution with mean 0 and sigma 1.

docontour.sm - a Supermongo macro that takes point locations in vectors X and Y and makes a contour plot of the point density in the X-Y plane. This is very useful when you have a lot of points and plotting them all will just make a sea of black. Stellar astronomers call this a ``Hess diagram'' when it is used to plot the density of stars in a color-magnitude diagram.

dobackup.sh - a simple Unix shell script that uses rsync to back up a directory, e.g. onto an external disk. The useful thing about this script is that it excludes large files. It uses "find" to find all the files bigger than some size - about 16 megabytes as coded - and excludes those from the rsync. This lets you back up your home or data directory, excluding all the enormous data files that don't change often, but backing up all the teeny weeny text files that include your irreplaceable thesis. It's really a trivial script and the only issue is that I figured out the rsync exclude syntax so you don't have to.

Usage: dobackup.sh /home/bjw /media/usbdisk/backups

This will create the directory /media/usbdisk/backups/bjw. You can get fancy and make time-stamped backup directories and so on.

If you find any of these programs useful or want to suggest changes drop me an email at bjw -at- as.arizona.edu.

Boycott Numerical Recipes.

Fight the Powerpoint.

Back to my home page.

Benjamin Weiner
Steward Observatory
Department of Astronomy
University of Arizona
Tucson, AZ  85721

email: bjw -at- as.arizona.edu

hit counter