Code and Software

OSIRIS Data Reduction Pipeline

I'm leading the OSIRIS Data Pipeline Working Group, which seeks to characterize and improve the data reduction pipeline for the OSIRIS integral-field spectrograph on the Keck 1 telescope. The development and release for the pipeline is on github.

Fitting Stellar Parameters

Starkit is a generalized stellar spectral fitting routine using a grid of spectra to fit physical parameters such as effective temperature, surface gravity, metallicity, and alpha abundance. The routine uses a synthetic spectral grid (such as MARCS or PHOENIX) to compute the likelihood of matching an observed spectrum given a set of stellar parameters. It includes a number of methods for sampling the posteriors for these stellar parameters, including MultiNest. I am developing this code with Wolfgang Kerzendorf. This software is open source.

View on GitHub »

IRIS Data Simulator

I have been leading the development of the data simulator for IRIS, one of the first light instruments for the Thirty Meter Telescope. We are working on making this data simulator publicly available.

Fourier Optics GUI

An IDL program that computes and displays the effect of adding phase aberrations for apertures of different shapes. The phase aberration can either be Kolmogorov turbulence or decomposed into zernike modes. The program will display the PSF, MTF, and phase map. It can also convolve the aberrated PSF with grayscale TIFF images. The wavefront measurements of the eyes measured at CfAO Summer School can also be loaded using this program.

Details and Download »

MOSFIRE pipeline

I'm helping to develop and improve the pipeline for the multi-object near-infrared spectrograph on Keck I: MOSFIRE. The project page is on github

View on GitHub »


IDL Notes

Set NaN values:

	a = !values.F_NaN
	b = !values.D_NaN

Calls an external UNIX command:
SPAWN, 'command'

Execute one or more IDL statements contained in a string and returns true (1) if sucessful:
example: ret = EXECUTE('plot, indgen(100)')

Plot postscript files. The following makes a color eps file with postscript hardware fonts (useful for changing text in Latex later)
ps_open, outfile, /color, /encapsulated, /ps_fonts
ps_close (when done plotting)

Saving plot window into a PNG image file:
Use keyword true=1 to save in color
write_png, img_file, tvrd(true = 1)

Declaring functions
When functions have not been compiled, calling them with keywords will result in a syntax error. Use FORWARD_FUNCTION to declare those variables are functions:
FORWARD_FUNCTION, name1, name2, ....

Compile routines
To force IDL to compile user-written procedures even if they are already defined (use the keyword /compile_full_file to compile the whole file, not just the function given):

RESOLVE_ROUTINE, name, /compile_full_file

Find the same elements in two idl arrays.
match, a, b, suba, subb
suba contains the indices in vector 'a' with a match in 'b'.

Tab string in IDL: string(9B)

File Operations in IDL

Test for the existence of a file or directory:
test = FILE_TEST(filename) (returns 0 if file does not exist)

Return an array of files in a directory:
files = file_search('/home/blah/*.fits')

Return an array of files recursively through all subdirectories:
files = file_search('/home/blah/','*.fits')

Opening files to write into:

	OPENW, unit, filename
	PRINTF, unit, stuff
	CLOSE, unit

Open files for reading (/get_lun option will assign the unit):

	OPENR, unit, filename, /get_lun
	while not(EOF(unit)) do begin
		    READF, unit, var  ;(type of 'var' must be defined first)
	CLOSE, unit

Astronomy Related IDL

Many of these procedures require the IDL Astronomy Library available from GSFC.

Get a FITS header value:
val = SXPAR(header, 'value')

Add/modify FITS header files:
SXADDPAR, header, name, value

Find the pixel value corresponding to an ra and dec in a FITS file:
ADXY, header, ra_d, dec_d, x, y (ra_d and dec_d should be in decimal degrees)

Returns the string for the sun symbol that is used often in astronomy:

IRAF/PyRAF notes

To output help file on a topic into postscript:
help topic device=ps >