Sloan Digital Sky Survey at the CFA Data Release 6

GETSPECID - get spectra from archive

The getspecid program, located in /data/oiropt/bin, expects a starbase table as its standard input and decodes the specObjID column to determine the plate number, date (as MJD) and fiber ID. If the specObjID is zero for a given row, that row is ignored. Getspecid then locates the appropriate multi-spectrum FITS file in the Spectro directory hierarchy and writes that fiber's spectrum to a FITS file in the user's area. There are a number of options that may alter this default behavior, including using the command line arguments instead of standard input.
  Usage: getspecid [options] [specID_1 specID_2 ...]

     If non-option args are present, they are taken as specObjIDs
     to be decoded. The -t, -l, -c, and -a flags are then ignored.

  Options:
        -t      - Take specObjID's from STDIN as starbase table (default)
        -l      - Take specObjID's as simple list from STDIN, one per line
        -d .    - set output directory path
        -f <id> - use fiberID=<id>
        -m <mj> - use mjd=<mj>
        -n      - Print source file path+name, fiberid only
        -s      - Print source file name, fiberid only
        -p <pl> - use plate=<pl>
        -c specObjID    - Column name to use from starbase table
        -o <name>       - Output file name instead of default.
        -a /data/astrocat/SDSS-dr6/Spectro      - Path to SDSS data
        -v      - verbose output
        -x      - Print this message and exit.

   Output is file in directory "dirpath", which is "." by default.
   File name is of form: spPlate-<plate>-<mjd>-<fiberID>.fits

Example:

To gather candidate Hypervelocity Stars for his project, Warren Brown (see Brown et al.) searched the SDSS catalog for late B-type objects. An approximate replication of the search would be the following script ( see explanatory notes):

#! /data/oiropt/bin/ksh
echo 18.25 |
fldtotable psfMag_g |
search  /data/astrocat/SDSS-dr6/PhotoPrim.db -C1 psfMag_g 1.25 |
row 'type == 6 &&
     and(flags, 0x03000810U) == 0x10U && and(flags2,0x80441044U) == 0' |
row 'psfMag_g_r > -0.38 && psfMag_g_r < -0.28'    | 
row ' (2.67 * psfMag_g_r) + 1.30 < psfMag_u_g && 
      psfMag_u_g < (2.67 * psfMag_g_r) + 2.0'     |
row ' -0.5 < psfMag_r_i && psfMag_r_i < 0.0   &&
      17.0 < psfMag_g   && psfMag_g < 19.5'       |
column -a l b                                     |
compute '[ l, b ] = eqgal(ra/15.,dec); if(b > 180.) b = (b % 180)-180' |
row 'abs(b) > -l/5. + 50 || abs(b) < l/5. - 50.' 
Note that the multiple row statements are really for clarity and could be combined into a single command. Running this script (call it hvsearch) as:
hvsearch >hvstars.db
generates hvstars.db with 563 rows. That table can be piped straight into getspecid to pull out all the objects with observed spectra:
getspecid -v <hvstars.db
 Extract fiber 304 to ./spPlate-0339-51692-304.fits
 Extract fiber 261 to ./spPlate-0332-52367-261.fits
 Extract fiber 175 to ./spPlate-0372-52173-175.fits
   ...
 Extract fiber 373 to ./spPlate-0543-52017-373.fits
 Extract fiber 358 to ./spPlate-0439-51877-358.fits
 Extract fiber 533 to ./spPlate-0497-51989-533.fits
for a total of 39 spectra, of which only 2 do not appear to be late B-type stars.

A test run of this script took about 3 hours 52 minutes on the tdc computer, of which all but 7 minutes was the initial search with the condition   17.0 < psfMag_g > 19.5, which passed 6.8 million rows on to the pipeline of row statements.

Some notes on the hvsearch script:
 
  1. The search command is passed a trivial key table with psfMag_f = 18.25, and told (via "C1 1.25") to do a one-dimensional search  ±1.25, in other words   17.0 < psfMag_g < 19.5.

  2. Note that the appended "U" is a recent extension that forces unsigned comparisons in the bitwise operators.
    The bit fields being tested:
      flags & 0x03000810U == 0x10U  (i.e. stationary only)
        0x00000010 STATIONARY
        0x00000800 SATUR_CENTER
        0x01000000 MAYBE_CR
        0x02000000 MAYBE_EGHOST
    
      flags2 & 0x80441044U == 0
        0x00000004 EDGE
        0x00000040 NODEBLEND
        0x00001000 COSMIC_RAY
        0x00040000 SATURATED
        0x00400000 BADSKY
        0x80000000 MOVED
    
  3. The compute command calls the eqgal subroutine to convert equatorial to galactic coordinates, with the input ra in hours and dec in degrees, then makes the b value   -180 ≤ b < +180 instead of the normal range of  0 ≤ b < 360.

[getobjid] [getspecid] [footserver] [sdssquery]