Accessing PRIMUS spectra

From NYU CCPP Wiki

Contents

Setting things up

In order to set things up properly, you look at setup instructions.

How do I read in the targeting data, 2D redux, and 1D redux?

Enlarge

The piece of code "primus_read_1dinputs" is the workhorse routine for reading in mask information and matching the targeting information with the redux. It is called like so:

primus_read_1dinputs, 'd23a0044', '0920', $
  slits=slits, extr=extr, oned=oned

It returns the targeting information in the "slits" structure, the 2D extraction information in the "extr" structure, and the redshift fitting results in the "oned" structure. It matches the targeting and extraction information, returning aligned arrays (note this means it throws out some of the "slits" elements, which might have fallen into chip gaps and such).

You can plot these spectra interactively with the command:

primus_plotspec, extr, slit=slits

which will bring up two windows (as at right), one for each slit. The top window shows the sky counts and the bottom window shows the object counts, with error bars shown. (The counts are scaled so that the plots are usually roughly flat with wavelength). You can navigate the spectra with a simple text interface:

IDL> primus_plotspec, extr, slit=slit
action (b= back, m= mark, f= forward, q= quit)
: 

("marking" the spectrum means you can set some flags that get stored in $PRIMUS_DIR/data/primus_problem_slits.par).

How do I access redshifts known from external sources?

For testing, a number of our targets have redshifts from external sources. Because of the heterogeneity of the source files, the "slits" files don't have a uniform way of recording these. However, there is a routine (primus_ztype()) which figures out all of the possibilities. The "primus_read_1dinputs" routine automatically runs this and returns the following tags in the output "slits" structure:

CURRZ - best estimate of redshift from external source
ZTYPE - provenance of the redshift:
               0 - SDSS
               1,6 - DEEP2
               2 - VVDS
               3 - COMBO-17 photo-z
               4 - USNO (assumes it is a star)
               5 - is an SDSS star
               8 - QSO photo-z


These redshifts just reflect what is in the targeting and slits file (i.e. they have not been updated since the time of targeting).

What data are completed and reduced?

The PRIMUS masks are divided into various "surveys", which define ways of targeting, and "runs" which are mask design runs for specific observing times. The information about how each of these were designed is stored in the file:

$PRIMUS_DIR/data/primus_masks.par

Our list of observed masks is maintained in the file:

$PRIMUS_DIR/data/primus_observed_masks.par

This contains the mask names, date of observations, exposure times, etc.

Given just a mask name, you can get more information about it using the "primus_mask_info" command, for example:

primus_mask_info, names='d23a0044', survey=survey, run=run, info=info, night=night

This will return which "survey" and "run" the mask was designed for, what "night" the longest exposure was taken on (e.g. "ut060523"), and an "info" structure describing the targeting properties.

Where are these files in the directory structure?

The targeting information for each mask is at:

$PRIMUS_DATA/design/[survey]/masks/[run]/[survey]_slits_[number].fits.gz

I don't believe we yet have a piece of code which tells you if the mask has been reduced and what the latest rerun is, but the 2D reductions if they exist will be at:

$PRIMUS_REDUX/[rerun]/[night]/[maskname].extract.fits.gz

and the 1D reduction if they exist will be at:

$PRIMUS_REDUX/1d/[rerun]/[night]/[maskname]-zAll.fits.gz

How do I make sure I have the best set of spectra possible?

There are a number of data quality flags that are set during reductions and which are generated on-the-fly during the course of reading the data in with primus_read_1dinputs. To get the best set of spectra possible, I would recommend cutting on:

extr.badextract == 0 oned.zwarning == 0

The Badextract is set for a number of reasons during extraction. The zwarning flag includes several empirical tests to determine if the galaxy redshift determined is reasonable. Currently, these cuts include (with maskbit and bitname)

3 - LOW_SIGNAL -  The total signal to noise of the spectrum was less than 12
4 - TOO_MANY_MASKED_PIXELS - More than 20% of the pixels in one of the two apertures was masked out
5 - GAL_DCHI2_TOO_SMALL - The Difference between the first and second Chi-2 minimum was less than 10 
6 - GAL_BADFIT - The Chi-2 for the best fit model was > 3000
7 - 2DFLAGSET -  This flag is set if *any* bit was set in extr.badextract for this object
8 - POWERLAW_CHI2 - This flags possible objects which have good powerlaw fits.  Requires Chi2_powerlaw - Chi2_gal < 30
9 - STAR_CHI2 - This flags possible object which have good star fits.  This is set at Chi2_star - Chi2_gal < 30

Of course, choosing zwarning==0 will cut several objects that may be of interest (low signal-to-noise objects for example). The bit names above can be used in primus_flagname or primus_flagval in order to set a more limited threshold.

If you are working with the actual spectra, you might want to make sure you remove any pixels with extr.mask1 or extr.mask2 set. There are a number of reasons these can be flagged (cosmic ray, bad column, large mismatch between the A and B apertures). by default, the inverse variance of these pixels is *not* necissarily set to zero, so you should make sure of that before working with the spectra directly.