Quick Notes on SDSS Data


Table of Contents
Introduction
Using the tsField file instead of fpC header keywords

Introduction

This document is a collection of short notes on using SDSS data. In most cases, you are better off looking at the data release web site for the data release of interest. This page only includes notes that some might find useful, but for one or another reason are not really appropriate for the official web site (to which I also contribute).


Using the tsField file instead of fpC header keywords

Some (but not all) corrected frames include keywords, FLUX20 and SKY, that provide preliminary photometric calibration and sky levels. These values are only preliminary, and cannot be relied upon to be there at all. They are, however, presented in a useful form.

The proper place to look for the sky is the tsField file, which is always present and more accurate. Getting values corresponding to the corrected frame header keywords requires understanding the photometric flux calibration algorithms page. This python script is an example of how to use the tsField file to generate values that can be used in place of the keyword values from the fpC file:


#!/usr/bin/env python
""" Determine the FLUX20 and sky level (in counts) from a tsObj file
:Authors: Eric H. Neilsen, Jr.
:Contact: <neilsen@fnal.gov>
:Date: $Date: 2007/08/28 18:42:23 $
:Version: $Name:  $, $Revision: 1.1 $
:Status: $State: Exp $
:Organization: Fermi National Accelerator Laboratory
"""
import sys
import pyfits
from math import *

tsField_name=sys.argv[1]
filter=sys.argv[2]
filter_dictionary={'u': 0, 'g':1, 'r':2, 'i':3, 'z':4}
b_dictionary={'u': 0.4e-10, 'g':0.9e-10, 'r':1.2e-10, 'i':1.8e-10, 'z':7.4e-10}
filter_index=filter_dictionary[filter]

hdulist=pyfits.open(tsField_name)
data=hdulist[1].data

exptime=53.907456
b=b_dictionary[filter]
aa=data.field('aa')[0,filter_index]
kk=data.field('kk')[0,filter_index]
airmass=data.field('airmass')[0,filter_index]

m20=20
ff0=2.0*b*sinh( (-1.0*log(10)*m20/2.5)-log(b) )
counts20 = exptime*ff0/(10**(0.4*(aa+kk*airmass)))
print "FLUX20=",counts20

# Get conversion from maggies to counts
m0=0
ff0=2.0*b*sinh( (-1.0*log(10)*m0/2.5)-log(b) )
refCounts = exptime*ff0/(10**(0.4*(aa+kk*airmass)))

pwidth=0.396
sky=data.field('sky_frames_sub')[0,filter_index]
counts=pwidth*pwidth*refCounts*sky
print "SKY=",counts


The FITS library on which this script relies can be found at the STScI pyFits website.

Note that you can also do this using the Field table in CAS. An SQL query to get the FLUX20 counts would look something like this:


SELECT  53.907456*POWER(10.0,(20.0/-2.5)-0.4*(aa_r+kk_r*airmass_r)) AS flux20
FROM Field
WHERE run=3836 AND rerun=41 AND camcol=3 AND field=273