A Guide to SEGUE Bitmasks
SDSS uses bitmasks to report what category a target is from. These patterns represent different types of stars and calibration targets. The bitmask algorithms page describes bitmasks in general. Here we give some details about the SEGUE-2 bitmasks.
For SEGUE, there are 4 32-bit bitmasks: segue1_target1, segue2_target1, segue1_target2, and segue2_target2. The first two provide information about which target criteria the star fulfills. The last two identify calibration or other non-science targets.
The parameters with the prefix segue1 are different than those labeled segue2. The two surveys focused on different types of targets. Thus, the parameters in segue1 present information for each target with respect to SEGUE-1 target selection. Those with segue2 use bitmasks for the SEGUE-2 target selection. This applies to both the stellar type target selection (target1) and the calibration identification (target2). We list the different bitmasks for the 4 parameters on the SEGUE Target Selection page.
Three CAS tables contain these four parameters: specObjAll, sppParams, and segueTargetAll. There is some variation to what the values mean between the tables. specObjAll and sppParams, which for each spectrum list identical values for these target flags, report why each fiber was assigned to that target. For example, if it was observed spectroscopically as part of the overall sample of G dwarfs, it will be labeled in segue1_target1 as a G dwarf. The targets for SEGUE were always selected from DR7 reductions or previous, so the target flags reflect the results of those reductions.
In contrast, in segueTargetAll, the bitmask segue1_target1 indicates every single SEGUE-1 or SEGUE-2 target type for which the star meets the criteria, i.e., if it meets the parameter cuts for both G dwarfs and low-metallicity stars, the bitmask will indicate both of these target types. Furthermore, the target flags in this table were generated by running SEGUE target selection on the final DR8 imaging reductions. Thus, for the same set of objects, there will be some variation in what target flags are set between specObjAll and segueTargetAll.
Thus, if you want every star assigned a fiber for a specific type in SEGUE-1, you would use segue1_target1 from specObjAll or sppParams. If you want every star that meets the criteria of a specific type in SEGUE-1, you should use segue1_target1 from segueTargetAll. The same rules apply to the target selection criteria from SEGUE-2 using segue2_target1.
Every target in SEGUE 1 and 2 is given a spectroscopic fiber because it fulfills the selection criteria for one particular category. In specObjAll and SppParams, segue1_target1 and segue2_target1 designate only one category, that which a star was given a fiber for. However, stars frequently pass the criteria for multiple categories. This information is contained in segue1_target1 and segue2_target1 in the segueTargetAll table. For these targets, the bitmasks are set for both stellar categories. For instance, a low metallicity G dwarf will have the bits set for both the G dwarf and low metallicity categories. The segue1_target1 bitmask for a star that meets the criteria of multiple categories is a combination of the different bits:
- binary: 10000000000001010000000000000000
- hex: 0x80050000 = 0x80040000 + 0x00010000
- integer: -2147155968 = (-2147483648 + 262144 + 65536)
From the provided example, one can see that for targets that fulfill criteria for multiple categories, it can be much easier to think in terms of hex, rather than binary or integer!
Similarly, for a target that fulfills the criteria for both a low metallicity star and a main sequence turnoff star, segue2_target1 in segueTargetAll will be a combination of the two bitmasks:
- binary: 10000000000000000000000000010001
- hex: 0x80000011 = 0x80000010 + 0x00000001
- integer: -2147483631 = (-2147483648 + 16 + 1)
Targets that belong in multiple categories require some adjustment of SQL queries as well. In a query, specifying
segue1_target1 = 0x80040000
is quite different than
(segue1_target1 & 0x40000) != 0
In the first example, the query specifies that the bitmask must be that of a G dwarf, and only a G dwarf. The second query specifies that the bit mask must be that of a G dwarf, but can also fulfill the criteria of other target categories. The first query would not have any targets with segue1_target1 = -2147155968, but the second would.