- Bitmask Primer
- Bitmasks in CAS
- Bitmasks in SEGUE
- Bitmasks in IDL
- PHOTO FLAGS1
- PHOTO FLAGS2
- RESOLVE_STATUS
- CALIB_STATUS
- IMAGE_STATUS
- LEGACY_TARGET1
- LEGACY_TARGET2
- SEGUE1_TARGET1
- SEGUE1_TARGET2
- SEGUE2_TARGET1
- SEGUE2_TARGET2
- SPECIAL_TARGET1
- BOSS_TARGET1
- ANCILLARY_TARGET1
- ANCILLARY_TARGET2
- BOSSTILE_STATUS
- FLUXMATCH_STATUS
- SPECTRUM PIXMASK
- ZWARNING
- APOGEE_TARGET1
- APOGEE_TARGET2
SDSS-III Bitmasks in IDL
The flat files contain all of the bit masks. Using them is particularly convenient for IDL users who use the idlutils product.
Inside of idlutils, there is a file:
$IDLUTILS_DIR/data/sdss/sdssMaskbits.par
which contains a listing of all mask bits defined for SDSS.
To access these from within IDL, one uses either "sdss_flagval()" or "sdss_flagname()". The first tells you the integer value corresponding to each bit mask name. The second returns the names of the bits set, given an integer.
For example, you can ask what the integer corresponding to NEGATIVE_EMISSION is as follows:
IDL> PRINT, sdss_flagval('ZWARNING', 'NEGATIVE_EMISSION') 64
Or, if ZWARNING for a spectrum is set to "246", then you can check what that means as follows:
IDL> PRINT, sdss_flagname('ZWARNING', 246) LITTLE_COVERAGE SMALL_DELTA_CHI2 MANY_OUTLIERS Z_FITLIMIT NEGATIVE_EMISSION UNPLUGGED
Uh oh! That spectrum must be Very Bad!
The most common usage is within a program. For example, let's say you want to find all spectrum for which MANY_OUTLIERS is set. In IDL you can do this as follows (assuming that "spobj" is a structure which has "zwarning" as a tag):
imany= WHERE((spobj.zwarning AND sdss_flagval('ZWARNING', 'MANY_OUTLIERS')) NE 0, nmany)
which returns "imany" as an array of those elements with ZWARNING set. You should be careful in calls such as those above to always ask for the AND to return a non-zero output (do not check for "less than" zero, which can get you in trouble if zwarning happens to be cast as a signed integer).
A useful tool in IDL is the ability to write out an integer in hex format. E.g. the command below outputs "80000000":
PRINT, STRING(2L^31, FORMAT='(Z)')