text:
# Spectroscopic Target Selection in the Sloan Digital Sky Survey: The Quasar Sample

## 1 Introduction

The Sloan Digital Sky Survey (SDSS;York et al. 2000) will digitally map 10,000 square degrees of the Northern Galactic Cap (hereafter, the Main Survey), and a smaller area ($`750\mathrm{deg}^2`$) in the Southern Galactic Cap (hereafter, the Southern Survey). The imaging survey is done in five broad bands, $`ugriz`$ (Fukugita et al., 1996; Stoughton et al., 2002), that were specially designed for the survey. In addition to the imaging data produced by a large CCD mosaic camera (Gunn et al., 1998), the SDSS will conduct a spectroscopic survey of objects selected from the catalogs derived from the processed images with the goal of obtaining spectra of approximately one million galaxies and one hundred thousand quasars. A detailed description of the overall target selection algorithm for all classes of spectroscopic targets can be found in Vanden Berk et al. (2002); in this paper we describe the spectroscopic target selection algorithm for the SDSS Quasar Survey.

The primary SDSS quasar science goals are defined by the two “Key Projects” that will be addressed with the final quasar sample. The Key Projects are 1) the evolution of the quasar luminosity function and 2) the spatial clustering of quasars as a function of redshift. These studies require the assembly of a large sample of quasars covering a broad range of redshift and chosen with well-defined, uniform selection criteria.

The SDSS Quasar Survey will increase the number of known quasars by a factor of 100 over previous surveys such as the Large Bright Quasar Survey (LBQS; Hewett et al. 1995), which was until recently the largest complete quasar survey. In so doing, the SDSS Quasar Survey will also be approximately four times the size of the concurrent 2dF QSO Redshift Survey (Croom et al., 2001). The SDSS quasar sample has a high completeness fraction from $`z=0`$ to $`z5.8`$; the sample also has high-quality five-color photometry and high signal-to-noise ratio spectroscopy at moderate spectral resolution.

The selection of quasars from multi-color imaging data was pioneered by Sandage & Wyndham (1965) and has continued through the years (e.g., Koo & Kron, 1982; Schmidt & Green, 1983; Warren et al., 1991; Hewett et al., 1995; Hall et al., 1996; Croom et al., 2001); a review of the history of surveys for high-redshift quasars is given by Warren & Hewett (1990). The approach we adopt when selecting quasars from the imaging data of the Sloan Digital Sky Survey is similar to previous studies. However, certain characteristics of the SDSS (such as the novel filter system, matching to radio sources, etc., along with the quality and quantity of the data) make the selection of SDSS quasars unique. These features of the Survey require a detailed description of the algorithm that selects quasar candidates for follow-up spectroscopy, hereafter the SDSS quasar target selection algorithm.

Our quasar target selection algorithm seeks to explore all the regions of color space that quasars are known to occupy, avoid most regions of color space where the quasar density is much lower than the density of contaminants, and to explore relatively uncharted regions of color space to the extent possible given the available number of spectroscopic fibers. As a result of our exploration of less populated regions of color space, our algorithm is open to serendipitous discovery of quasars with unusual colors and thus unusual properties. Our formal science requirements are to recover 90% or more of previously known quasars, while maintaining an efficiency in excess of 65%, where the efficiency is given by the ratio of true quasars to quasar candidates. The balance between completeness and efficiency is a delicate one; with so many more stars than quasars in the data, improvements in efficiency by rejecting objects in regions of color space in which both stars and quasars lie will necessarily cut back on completeness. In addition, unlike many quasar surveys, it is important to realize that the SDSS quasar target selection algorithm was finalized in advance of collecting most of the imaging data. The algorithm also was required to be completely automated and operate on a single object at a time, independently of all other objects.

The wavelength coverage of the SDSS filters allows for the selection of quasars from $`z=0`$ to beyond a redshift of 6. The automated algorithm described herein requires that there be flux in at least two bands, which imposes an upper limit to the redshift of $`z5.8`$ (based on the minimum transmission between the $`i`$ and $`z`$ filter curves at $`8280\mathrm{\AA }`$ straddled by Lyman-$`\alpha `$ emission). It is possible to use SDSS imaging data to discover quasars with even larger redshifts by investigating objects that are detected in the $`z`$ filter only. However, such a search is beyond the capability of the survey proper as the efficiency of the automated selection for objects detected only in the $`z`$-band is much too low; searches for the very highest redshift quasars require spectroscopy outside of normal SDSS operations (e.g., Fan et al., 2001b).

At the low-redshift end, the design of the $`u`$ filter and the location of the gap between the $`u`$ and $`g`$ filters were chosen to emphasize the difference between objects with power-law spectral energy distributions (SEDs), such as quasars at $`z<2.2`$, and objects that are strongly affected by the Balmer decrement, particularly A stars, which are historically the prime contaminants in multi-color surveys for low-redshift quasars. The filter curves are described in Fukugita et al. (1996) with modifications as described by Stoughton et al. (2002).

Briefly, the quasar target selection code works as follows. 1) Objects with spurious and/or problematic fluxes in the imaging data are rejected. 2) Point source matches to FIRST radio sources are preferentially targeted without reference to their colors. 3) The sources remaining after the first step are compared to the distribution of normal stars and galaxies in two distinct 3D color spaces, one nominally for low-redshift quasar candidates (based on the $`ugri`$ colors), and one nominally for high redshift quasar candidates (based on the $`griz`$ colors). Stars in particular follow a one-dimensional locus in the four-dimensional SDSS color space, which we model explicitly (and keep fixed for the duration of the Survey). Those objects that are discernible outliers from the regions of color space populated by stars and non-active galaxies are selected for spectroscopic follow-up if they meet all of the other criteria, including the magnitude cuts. Objects meeting any of the selection requirements have one or more target flags set, see Table 1.

During the color selection process we draw no specific line between quasars and their less luminous cousins, Seyfert galaxy nuclei; objects which have the colors of low-redshift AGN are targeted even if they are resolved. This policy is in contrast to some other surveys for quasars; it is not unusual for extended objects to be rejected, which has the effect of imposing a lower limit to the redshift distribution of the survey. Throughout this paper, we will, in fact, use the word “quasar” where we often mean “AGN”. The complete SDSS data set is needed to ultimately determine if the traditional distinction between quasars and Seyfert galaxy nuclei is warranted.

Once quasar candidates have been identified, we obtain spectra of each candidate using the SDSS fiber-fed spectrographs. Each $`3^{}`$ diameter SDSS spectroscopic plate holds 640 fibers, of which an average of 80 are assigned to quasar candidates. Quasar candidates are allocated approximately 18 fibers per square degree. Plate overlaps account for the difference between 18 objects per square degree and 80 objects per plate (which have an area of $`7`$ square degrees). Given this constraint on density and the requirements on completeness and efficiency, we target color-selected quasar candidates to a Galactic-extinction corrected $`i^{}`$ magnitude of $`19.1`$111SDSS magnitudes in this paper will be quoted as $`u^{}g^{}r^{}i^{}z^{}`$ and not in the notation of the filters ($`ugriz`$) in order to indicate that the final calibration to the formal $`ugriz`$ system is not yet complete. See the discussion in Stoughton et al. (2002).. We also identify radio-selected quasar candidates by matching unresolved SDSS point sources to FIRST radio sources (Becker et al., 1995) to the same magnitude limit. Finally, since the density of high-redshift quasars ($`z3`$) is relatively low and since the SDSS spectrographs are capable of obtaining redshifts of quasars that are much fainter than $`i^{}=19.1`$, we use $`i^{}=20.2`$ as the magnitude limit for high-redshift quasar candidates.

Section 2 discusses the role of the commissioning period to the development of the Quasar Target Selection Algorithm. Section 3 presents the detailed selection criteria. Section 4 contains the diagnostic analysis used to finalize the algorithm. In § 5 and § 6, we present discussion and conclusions, respectively. Appendix A describes the creation of the stellar locus that we use to define outliers, whereas Appendix B discusses the algorithm by which outliers from this locus are selected.

## 2 Commissioning

It is well-known in the astronomical community that “first light” for any new telescope is not synonymous with the commencement of full science operations. The SDSS Collaboration recognized from the beginning that a testing period would be needed prior to the Survey proper — particularly for the development of the final quasar target selection algorithm. The initial pre-commissioning algorithm rejected objects with colors consistent with the stellar locus, while selecting regions of color-space that were known to harbor quasars or that had a sufficiently low density of sources that they could be explored efficiently. As this preliminary approach was inadequate for the main survey, this algorithm deliberately erred on the side on inclusiveness, so that we could explore the boundaries of the quasar locus in color and determine the nature of contaminants. The primary goals of the commissioning period were to refine this algorithm to 1) meet the survey requirements that the quasar sample be at least 90% complete and 65% efficient, and 2) establish the magnitude limits needed to meet the density requirements.

Although the results of previous quasars surveys reveal approximately what regions of color space quasars inhabit and where their contaminants are in color space, prior to commissioning we did not have all of the knowledge that was needed to achieve our goals. For example, we did not know the intrinsic spread in quasar spectral indices, which translates to a lack of knowledge of the intrinsic spread in quasar colors. Compounding this problem is that, prior to the SDSS, no large samples of quasars with photometric accuracy comparable to the SDSS existed (see the discussion in Richards et al., 2001); all of the large area spectroscopic surveys for quasars prior to the SDSS have been based on magnitudes measured from photographic plates.

One of our primary concerns during the commissioning period was that as stellar populations change between halo and disk, the detailed position and width of the stellar locus will be a function of direction on the sky. As the stellar locus used by the code is fixed by definition, any shift of the stellar locus as a function of position on the sky would have the effect of greatly worsening the target selection efficiency in certain areas of sky. We tested this possibility by examining the stellar locus in the Early Data Release (Stoughton et al., 2002) runs 752 and 756, each of which extend over six hours of right ascension on the Celestial Equator; they extend from low Galactic latitudes ($`b=+25^{}`$) to high ($`b=+62^{}`$) over a large range of Galactic longitudes ($`l=230^{}360^{}`$). We used a simplified version of the stellar locus code described in Newberg & Yanny (1997) to fit line segments to various parts of the stellar locus, and examined its parameters as a function of position on the sky. We found that the position of the locus shows a root-mean-square scatter of 0.015 mag in color, consistent with our errors on absolute photometric calibration. No systematic trend was seen with position on the sky. Similarly, the effective width of the locus was essentially constant. There was a noticeable effect that the blue end of the stellar locus is a function of magnitude as low metallicity halo blue horizontal branch stars enter the sample in large numbers fainter than $`r^{}19`$. However, we found empirically that there is no substantial change in the efficiency of quasar target selection either as a function of magnitude or as a function of position on the sky.

Based on the knowledge gained during the commissioning period and the results of the first 66 plates of data (2555 quasars), we refined the algorithm to the point where it was deemed to be sufficiently robust for regular survey operations. The target selection algorithms, including the quasar module, were “frozen” on 2000 November 3, such that all imaging runs processed after this date and all spectroscopic plates tiled after this date were appropriate, in principle, for the creation of statistical samples of quasars.

However, additional observations revealed that the completeness of the algorithm at $`z3.5`$ and $`z4.5`$ was unacceptably low — a fact that was only realized after a sufficient number of $`z>3`$ objects had been discovered to realize the deficit. In addition, changes to the photometric pipeline which processes the imaging data (PHOTO; Lupton et al. 2001), small shifts in the photometric solutions and better simulated quasar photometry dictated that further refinements to the code were necessary. The changes to the code were based upon a “testbed” of imaging data from SDSS runs 756, 1035, 1043, 1752, 1755 and part of run 752, in addition to all of the spectra obtained in these areas prior to 2001 July 20. (See Stoughton et al. (2002) for information on the SDSS runs.) These changes were approved on 2001 August 24; all spectra taken with this final version of the code thus constitute the basis for the statistical sample of SDSS quasars.

## 3 The Quasar Target Selection Process

This discussion of the SDSS quasar target selection algorithm is ordered largely in the way that events occur. A flowchart that describes the selection process is given in Figure 1; the order of the flowchart is slightly different from that of the code for the sake of clarity. Note that each object is considered individually and that more than one target selection flag can be set for each object. The target selection flags that are set by this algorithm are given in Table 1; see Stoughton et al. (2002), particularly Table 27, for additional information on the all of the target selection flags.

We start our description of the target selection algorithm with a discussion of the input data, both the photometry (§ 3.1) and flags indicating possible problems (§ 3.2). Point sources that have counterparts in the FIRST survey are targeted, as described in § 3.3, but the heart of the target selection algorithm is the selection of outliers from the stellar locus in color-color space, as described in § 3.4. This algorithm takes into account the estimated magnitude errors to determine whether it lies within the stellar locus (Appendix B). Finally, this algorithm is supplemented by the inclusion and exclusion of several special regions in color space, as described in § 3.5.

### 3.1 Input Photometry

The measured SDSS fluxes are converted into asinh magnitudes (Lupton et al., 1999); these magnitudes are more robust for color selection at low flux levels than are traditional logarithmic magnitudes (Pogson, 1856). This affects the handling of limiting magnitudes, as discussed in § 3.4.2. For objects that are detected at more than $`10\sigma `$, asinh magnitudes differ from logarithmic magnitudes by less than 1%.

Since we allow extended objects to be selected by the algorithm, but only in specific regions of color space, the algorithm needs to distinguish between extended and point sources. In the context of our algorithm, extended sources are defined as follows. Each two-dimensional image of each object in the SDSS is fit with a series of models, including the locally determined Point Spread Function (PSF), along with exponential and de Vaucouleurs profiles of arbitrary scale size, axis ratio, and orientation (convolved with the PSF). An extended object is defined as an object with substantial flux on scales beyond the PSF. With this in mind, star-galaxy separation is based on the difference between the PSF and either the exponential or the de Vaucouleurs magnitude (whichever has a larger likelihood) in each band; an object is classified as extended in that band if this difference is greater than 0.145 mag. The final, overall, morphology classification is determined by summing the counts in all five bands and applying the same criterion as for any single band, see § 4.4.6 of Stoughton et al. (2002) for more details. Yasuda et al. (2001) and Scranton et al. (2001) show that the star-galaxy separation is reliable at least to $`r^{}21`$ — typically much fainter than the limit explored by quasar target selection.

All magnitudes used within the quasar target selection algorithm (and throughout this paper) are PSF magnitudes, as opposed to fiber magnitudes or galaxy model magnitudes; see § 4.4.5 of Stoughton et al. (2002) for more details. For point sources, PSF magnitudes yield the most accurate color information; for extended sources the colors will be less diluted by starlight than will model, fiber or Petrosian magnitudes.

Finally, the magnitudes used by the quasar target selection algorithm have been corrected for Galactic reddening according to Schlegel et al. (1998). These have not been updated for the recently discovered shifts of the effective wavelengths of the SDSS filter curves (compare Fukugita et al. 1996 with Stoughton et al. 2002), which causes systematic errors of 7% of the reddening correction or less — negligible for the high-latitude regions of sky covered by SDSS.

### 3.2 Photometric Pipeline Flag Checking

During the process of extracting objects from the images and measuring their photometric properties, PHOTO sets a number of flags (which can be good or bad) for each detected object, some of these flags indicate objects whose photometry (and therefore, colors) may be problematic (e.g., blending of close pairs of objects, objects too close to the edge of the frame, objects affected by a cosmic ray hit, etc.). Some flags indicate problems that are sufficiently serious that the object in question should not be targeted for spectroscopy under any circumstances; these will be referred to as “fatal” errors. Other flags are important, but do not indicate a problem that is serious enough to reject an object outright; these are referred to as “non-fatal” errors. Objects with non-fatal errors are considered by the FIRST targeting algorithm (§ 3.3), but not by the color selection algorithm. A list of all of the PHOTO flags used directly by the quasar module of the target selection algorithm are given in Table 2. For more details regarding all of the PHOTO flags, see Table 9 of Stoughton et al. (2002).

#### 3.2.1 Fatal Errors

Fatal errors include objects flagged as BRIGHT, SATURATED, EDGE, or BLENDED in any band. BRIGHT objects duplicate entries of sufficiently high signal-to-noise ratio objects. The photometry of SATURATED objects is clearly not to be trusted. EDGE objects lie sufficiently close to the edge of a frame that their photometry is unreliable. BLENDED objects have several peaks; they are deblended into children (flagged as CHILD, each of which are considered by the algorithm). Objects are further required to have the status flag OK\_SCANLINE set, which avoids duplicate entries for regions of overlap between two adjacent scans. An additional constraint is that the morphology, objc\_type, must be either “3” or “6” (galaxy and stellar, respectively; see the discussion in § 3.1), since the other types are all error codes. Objects are required to be detected at 5$`\sigma `$ in at least one of the five bands; objects whose magnitude errors are larger than $`0.2`$ in all five bands are rejected.

At one point we had considered explicitly rejecting objects that PHOTO deemed to be moving (i.e., asteroids). Main-belt asteroids move several arcseconds over the roughly five minutes between imaging in $`r`$ and $`g`$. PHOTO recognizes such moving objects explicitly, and does proper photometry of them (Ivezić et al., 2001). As asteroids have colors very close to that of the Sun, they lie in the stellar locus; thus we have not found the need to reject them explicitly.

#### 3.2.2 Non-Fatal Errors

Some of the flags in the database are more subtle. We have identified a number of such flags (or combinations thereof) that effect quasar target selection. Some objects have flags that indicate that they have colors that are unreliable; these objects are not allowed to be targeted via the color-selection criteria, but radio sources associated with such objects can be targeted. The most common problem is associated with poor deblends of complex objects; the following are empirical combinations of flags that allow us to reject essentially all such problematic cases. In particular, we flag as non-fatal errors deblended children with PEAKCENTER, NOTCHECKED, or DEBLEND\_NOPEAK set in any band — if they are brighter than 23 mag in the same band, and have an error in that band of less than 0.12 mag. Similarly, children with photometric errors greater than 1.0 mag are flagged as non-fatal errors, as are children with photometric errors greater than 0.25 in a detected band but that are not DEBLEND\_NOPEAK.

Objects with INTERP\_CENTER set have a cosmic ray or bad column within 3 pixels of their center, which has been interpolated over; empirically, we find that many false quasar candidates are found with $`i^{}<16.5`$ and this flag set, so we flag all such objects as non-fatal errors. The errors of fainter detected objects with INTERP\_CENTER set are occasionally underestimated, so we increase the photometric errors by $`0.1`$ mag in that band in quadrature. Finally, there are a few bad columns that are not properly interpolated over by the photometric pipeline, and so we reject objects in CCD columns 1383-1387 and 1452-1460 in dewar 2. We also rejected CCD columns 1019-1031 in dewar 5 for imaging runs prior to run 1635; starting with run 1635 this defect was corrected in the CCD electronics.

#### 3.2.3 In the Special Case of CCD Amplifier Failure

For a few imaging runs, one of the two read-out amplifiers on the $`u`$ CCD in dewar 3 was not operating; as a result, half of the dewar 3 $`u`$ images were completely blank. Both non-detections in $`u`$ and objects lying on the amplifier split cause problems for the quasar target selection code. In both cases the objects will be flagged as BINNED1, BINNED2, or BINNED4 by PHOTO; objects on the edge are further flagged as LOCAL\_EDGE and will have erroneous $`u`$-band photometry, whereas objects that are entirely in the blank region have NOTCHECKED\_CENTER set.

For those objects lying in the undetected region or on the edge we increase the magnitude error in the problematic band by a full 10 mag. This increase in error causes nearly all of the objects affected by this problem to be considered as being consistent with the stellar locus and thus not selected as a quasar candidate (see § 3.4). This solution is a general one that can account for problems not only in the $`u`$, but also in the other filters should future problems arise.

However, sufficiently blue objects in $`gr`$ can still be false outliers from the stellar locus regardless of their $`u`$-band fluxes. Thus the above solution is not sufficient for objects with very blue $`gr`$ colors in the $`ugri`$ color cube (§ 3.4.4). As a result, we explicitly reject objects that are fully or partially in a region of a CCD with a bad amplifier during the $`ugri`$ color selection process. In addition, we expand the area of color space where white dwarfs are rejected (see § 3.5.1) to include any $`ug`$ color.

Fortunately, the failure of the $`u`$ CCD amplifier in dewar 3 was limited to a few imaging runs and the problem has been repaired. Nevertheless, the software patch remains in the algorithm should the problem recur in the future.

### 3.3 FIRST matching

The SDSS catalog is matched against the FIRST catalog of radio sources (Becker et al., 1995); stellar objects (objc\_type $`=6`$) with $`15.0<i^{}<19.1`$ that also have radio counterparts are selected by setting the target flag QSO\_FIRST\_CAP. An SDSS object is considered to be a match to a FIRST object if the FIRST and SDSS positions agree to within $`2\mathrm{}`$ (the relative astrometry of the two surveys is excellent, as discussed in Ivezić et al. 2002). No explicit morphology criteria are applied to the FIRST data; however, no attempt is made to match SDSS sources to double-lobed FIRST sources, for which the optical position would be expected to be located on the line between the two radio sources. This exclusion introduces a bias in the SDSS radio quasar sample against steep-spectrum, lobe-dominated quasars, yet it simplifies the matching process considerably and keeps contamination to a minimum. Extended optical sources are excluded from the radio selection (though not the color selection), since these are mostly moderate redshift galaxies.

### 3.4 Color Selection

#### 3.4.1 The Distribution of Stars and Quasars in SDSS Color Space

Since stars far outnumber quasars to the SDSS magnitude limits, the first step to selecting quasars in an efficient manner is to remove from consideration the region inhabited by stars. The colors of ordinary stars occupy a continuous, almost one-dimensional region in $`(ug),(gr),(ri),(iz)`$ color-color-color-color space (Newberg & Yanny, 1997; Fan, 1999; Finlator et al., 2000), where temperature is the primary parameter that determines position along the length of the “locus” of stars. Whereas stars have a spectrum that is roughly blackbody in shape, quasars have spectra that are characterized by featureless blue continua and strong emission lines, causing quasars to have colors quite different from those of stars. As a result of their distinct colors, quasar candidates can be identified as outliers from the stellar locus. We define a region of multicolor space which contains this locus of stars. This stellar locus does not include all types of stars, but rather is limited to ordinary F to M stars that dominate the stellar density in the Galaxy (at high latitude). The quasar target selection algorithm models this stellar locus, following Newberg & Yanny (1997), as a two-dimensional ribbon with an elliptical cross-section (see Appendix A for details). In practice, our definition of the stellar locus is done in two stages, once for the $`(ug),(gr),(ri)`$ color cube (hereafter $`ugri`$), and once for the $`(gr),(ri),(iz)`$ color cube (hereafter $`griz`$). Splitting 4D color space into 3D color spaces was a choice made to simplify the code: there is no physical basis for this separation. The application of this code to select stellar locus outliers is described in detail in Appendix B, and is briefly outlined below.

The algorithm chooses objects that lie more than $`4\sigma `$ from the stellar locus, where the quantity $`\sigma `$ is determined from the errors of the object in question and the width of the stellar locus at the nearest point. This procedure gives a well-defined, reproducible color-cut for quasar target selection (as we define the stellar locus a priori, and do not dynamically adjust it as the survey progresses), and as we will see, allows us to meet our completeness and efficiency goals.

The overall shape of the featureless continua of quasars is well approximated by a power-law (Vanden Berk et al., 2001), although the continuum need not be a power-law physically. Since a redshifted power-law remains a power-law with the same spectral index, quasar colors are only a weak function of redshift for $`z2.2`$, as emission-lines move in and out of the filters (Richards et al., 2001). However, quasar spectra deviate dramatically from power-laws at rest wavelengths below 1216Å, where the Lyman-$`\alpha `$ forest systematically absorbs light from the quasar (Lynds, 1971); the net effect is that quasars become increasingly redder with redshift as the Lyman-$`\alpha `$ forest moves through the filter set. Modeling of this effect by Fan (1999) and empirical evidence from Richards et al. (2001) shows that, in the SDSS filters, the quasar locus is well-separated from the stellar locus for both relatively low ($`z2.2`$) and relatively high ($`z>3.0`$) redshifts, but that at intermediate redshifts, quasars have broad-band SDSS colors that are often indistinguishable from early F and late A stars. We handle the region of color space in which intermediate redshift quasars lie separately, as described in § 3.5.

#### 3.4.2 Color Selection Pre-processing

Before color selection begins, we first remove from consideration those objects with non-fatal errors, since their colors may be suspect. Since we allow such objects to be selected by the FIRST algorithm, we can statistically correct for their loss during color selection. Next, to account for systematic errors in the photometric calibration, we add 0.0075 mag in quadrature to the estimated PSF magnitude errors from PHOTO. As discussed above, stellar outliers are defined as those more than $`4\sigma `$ from the stellar locus, so this process in effect allows for 0.03 mag calibration errors. Furthermore, since we correct the magnitudes for Galactic reddening according to the reddening map of Schlegel et al. (1998), we also add to the errors (in quadrature) 15% of the reddening values, which is their estimate of the systematic errors in this reddening map.

Finally, objects at or below the $`5\sigma `$ detection limit in any band are treated by the outlier algorithm somewhat differently from objects that are detected in all five bands (see Appendix B). The non-linear relationship between count errors and magnitude errors requires special treatment in determining what “$`4\sigma `$ from the stellar locus” means. For such objects, we determine the final magnitudes by converting the asinh magnitude to counts, adding 4 times the estimated error in counts, and converting back to asinh magnitude. These new asinh magnitudes (and the resulting colors) are used to test whether an object is consistent with being in the stellar locus.

#### 3.4.3 Color-Selection Target Flags

With these preprocessing steps completed, the actual color outlier selection begins. The colors of each object are examined in turn, and asked whether they are consistent with lying within either the $`ugri`$ or $`griz`$ stellar loci, incorporating the photometric errors. The details of this process are described in Appendix B. In short, quasar candidates are chosen to be those objects which lie more than $`4\sigma `$ from either stellar locus. Outliers from the $`ugri`$ color-cube have the quasar target selection flag QSO\_CAP set, whereas outliers from the $`griz`$ color-cube are flagged as QSO\_HIZ (see Table 1). Objects which are located in regions of color space where the contamination rate is expected to be high are flagged as QSO\_REJECT and are not targeted even if they are outliers from either of the stellar loci (see § 3.5).

Quasar target selection is limited to objects fainter than $`i^{}=15`$; the wings of the spectra of the brighter objects tend to overwhelm the spectra of objects in adjacent fibers as seen on the CCD detector of the SDSS spectrographs. The $`ugri`$-selected objects are targeted to $`i^{}=19.1`$, and the $`griz`$-selected objects are targeted to $`i^{}=20.2`$, but our photometry is sufficiently accurate both brighter and fainter than these limits that outliers from the stellar locus are of interest for follow-up studies. We therefore mark such objects outside these magnitude limits as QSO\_MAG\_OUTLIER; these objects are not targeted for spectroscopy under routine operations.

#### 3.4.4 Low-redshift ($`ugri`$) Selection

In $`ugri`$ color-space, objects that have 1) survived the flag checks, 2) are outliers from the stellar locus (see Appendix A), and 3) are not in the exclusion boxes mentioned below (§ 3.5.1) are selected as quasar candidates to a magnitude limit of $`i^{}<19.1`$. As described in Appendix B, the primary selection is accomplished by convolving the errors of a new object with the $`4\sigma `$ $`ugri`$ stellar locus depicted by the red outlines in Figures 2 and 3, thereby creating a 3D error surface surrounding the stellar locus. If the colors of the object are inside this error region, then the object is deemed to be consistent with the stellar locus and the object is not selected. If the object is outside of this surface, it is considered to be a good quasar candidate by virtue of its status as an outlier from the stellar locus. The parameters for the $`ugri`$ stellar locus are given in Table 3; see also Appendix A. Since the stellar locus that we use is set a priori and is not determined from the SDSS data for each new run, the cuts in color space are uniform over the survey. Note also that the boundary of the stellar locus is determined from a series of cylinders, and no attempt is made to make this boundary smooth where the cylinders overlap.

During the $`ugri`$ color selection process, both extended and point source objects are targeted as quasar candidates; we do not explicitly differentiate between quasars and their lower-luminosity cousins that are typically extended. Note that by using PSF magnitudes throughout, we isolate the colors of any point-like components of galaxies with active nuclei. However, not all extended objects are allowed to be selected — just those that have colors that are far from the colors of the main galaxy distribution and that are consistent with the colors of AGN. At one point we had considered fitting an empirical “galaxy locus” much like our stellar locus however, in practice, we found it easier to make some simple color cuts to keep from targeting too many normal galaxies.

In Figure 4, we show the color-color and color-magnitude distribution of stars and galaxies that are brighter than $`i^{}<19.1`$. These objects are all of the point and extended sources in the testbed data (see § 2) that do not have fatal or non-fatal errors according to the quasar target selection algorithm and are otherwise good quasar candidates. Black points and contours show unresolved sources, orange points and contours show the extended sources. That the star/galaxy separation algorithm is not perfect is obvious from the number of extended sources along the branch of late-type stars ($`r^{}i^{}>1`$), a color that low-redshift galaxies rarely have (Yasuda et al., 2001; Strateva et al., 2001). Even so, the separation is quite good. Normal galaxy colors are clearly distinct from the stellar locus; they are very concentrated in $`riz`$ color space, they extend redward of the stellar locus in $`gri`$ color space, and they occupy roughly the space expected from a superposition of stars in $`ugr`$ color space.

As Figure 4 makes clear, galaxies can be outliers from the stellar locus, so we use two color cuts to reject extended objects unlikely to harbor an active nucleus. First, extended objects that are detected in both $`u`$ and $`g`$, that have errors less than $`0.2`$ mag in each band, and that have $`(u^{}g^{})>0.9`$ are rejected. Quasars with colors redder than $`(u^{}g^{})>0.9`$ have redshifts that are sufficiently large ($`z2.6`$) that they should not be resolved.

This cut misses the extension of the galaxy locus to somewhat bluer $`u^{}g^{}`$ colors, and thus we apply a second cut, rejecting extended objects with $`l>0`$ and $`k>0`$ (in the notation of Newberg & Yanny 1997; also see Appendix A). This second cut effectively removes all extended objects that are “above” and to the “left” of the stellar locus in the $`(u^{}g^{}),(g^{}r^{})`$ color-color diagrams. The blue edge of this cut is illustrated by the vectors drawn perpendicular to the stellar locus at the blue tip of the locus in the $`ugr`$ and $`gri`$ plots in Figure 4 and also Figures 2 and 3. Note that the axes in these plots have different scales, which causes the vector to appear as if it were not perpendicular to the long direction of the stellar locus.

Objects that meet all of the above criteria are selected for follow-up spectroscopy by setting the QSO\_CAP bit in their target selection flag (see Table 1).

#### 3.4.5 High-redshift ($`griz`$) Selection

In a manner equivalent to that for the $`ugri`$ color-cube, outliers from the stellar locus in the $`griz`$ color-cube with $`i^{}<20.2`$ are targeted for follow-up spectroscopy as quasar candidates. These objects will be flagged as QSO\_HIZ. The $`4\sigma `$ intrinsic width of the $`griz`$ stellar locus is given by the red outlines in Figures 5 and 6; the parameters for the $`griz`$ stellar locus are given in Table 4, see also Appendices A and B. Targeted objects in the $`griz`$ color-cube must be classified as stellar, as they will lie at redshifts above $`z3.5`$, and the majority of quasars with $`z0.6`$ are classified as stellar at the resolution of the SDSS. Note that this means that we will be biased against gravitational lenses with $`z3`$; however, we cannot afford the level of contamination that would accompany the inclusion of very red, extended sources.

The purpose of the $`griz`$ selection is specifically to select high-redshift quasars. However, some low-redshift quasars are outliers from the $`griz`$ stellar locus as well; given that we target the $`griz`$ color-cube 1.1 mag fainter than the $`ugri`$ color-cube, the QSO\_HIZ targets could be dominated by low-redshift quasars. To avoid this problem, objects are not selected as quasar candidates in the $`griz`$ color-cube when the following conditions are met:

$`\begin{array}{cccccccc}\hfill \mathrm{A})& \hfill g^{}r^{}& <& 1.0\hfill & & & & \\ \hfill \mathrm{B})& \hfill u^{}g^{}& & 0.8\hfill & & & & \\ \hfill \mathrm{C})& \hfill i^{}& & 19.1\hfill & \mathrm{OR}& \hfill u^{}g^{}& <& 2.5.\hfill \end{array}`$ (4)
These cuts are empirically defined to remove faint, low-redshift quasars in addition to some faint objects that are clearly in the stellar locus but that the automated code fails to exclude.

We have found that there are objects selected as high-redshift quasars by simple color cuts (Fan et al. 2001a) which are missed by this color-selection algorithm. The problem objects are most likely to be objects that are just above the detection limit. The primary color-selection algorithm should work well for objects well-above the detection limit where our assumption of symmetric magnitude errors is roughly true. It also should work well for objects below the nominal detection limit (as long as they are detected in the $`i`$-band), since we treat these objects specially. However, our assumption of symmetric magnitude errors (see Appendix B) can break down for objects just above the detection limit.

Consider an object to the lower right of the stellar locus in $`gri`$, e.g., at $`g^{}r^{}=1.5`$, $`r^{}i^{}=0`$, which is barely detected in $`g`$. It will thus have large photometric errors in $`g`$, large enough that its $`g^{}r^{}`$ color is consistent with the stellar locus at $`4\sigma `$. However, there are two ways of asking whether such an outlier is consistent with the stellar locus. First is to ask whether the errors of the object could make it consistent with the stellar locus. Second is to ask whether an object in the stellar locus could be scattered into the region occupied by the outlier as a result of its errors. Our algorithm is constructed from the first point of view.

For bright objects, these are essentially the same question; however, for objects near the limiting magnitude, but that are still detected, our assumption of symmetric magnitude errors causes these two viewpoints to diverge. If instead we took the second point of view, the $`g`$ magnitude of the corresponding object in the stellar locus would be substantially brighter, it would have substantially smaller errors, and our outlier would be inconsistent with the stellar locus. Thus, if instead of asking whether the errors of the outlier make it consistent with the stellar locus, we asked whether the errors of a stellar locus object could cause it to scatter to the position of the outlier, we would get different answers (under the assumption of symmetric magnitude errors).

We attempt to correct for cases such as these where the color outlier algorithm may miss good quasar candidates by implementing some simple cuts in the $`griz`$ color cube, as described in the next section. One of these cuts is designed to recover $`z3.6`$ quasars, and the second cut is designed to recover $`z4.5`$ quasars.

Finally, we wish to extend our QSO\_HIZ sample to $`i^{}=20.2`$ for objects with $`z>3.0`$. These are outliers in the $`ugr`$ color diagram and are selected with simple cuts in this diagram, as described in the next section.

### 3.5 Exclusion and Inclusion Regions

Based on experience from previous multi-color quasar surveys and from our own commissioning data, we know that there are regions of color-space outside of the stellar locus which are dominated by objects other than quasars. There are also regions of color space populated by quasars that are not selected by the color outlier routines described above. Therefore we have defined some regions of color space where objects are either explicitly included or excluded.

We reject objects which lie in the regions that are typically dominated by white dwarfs (WD), A stars, and M star-white dwarf pairs (WD+M). See Figure 7 and § 3.5.1 for the boundaries of these boxes.

In addition, as a result of the fact that, in the SDSS color space, the “quasar locus” crosses the stellar locus for quasars with redshifts between $`z=2.5`$ and $`z=3.0`$, we must explicitly include a number of objects in this region in order to properly sample the distribution of quasars in this redshift range. This “mid-$`z`$” inclusion box is also shown in Figure 7. The inclusion of some of these objects as quasar candidates results in lower efficiency, but without this approach we would not be able to investigate this redshift range.

Finally, we have instituted some color cuts to aid in the selection of high redshift quasars, as described in the previous subsection. We have also implemented a UVX color cut as an attempt at backwards compatibility with previous UVX surveys for quasars. Each of these cuts in shown in Figure 7.

#### 3.5.1 Exclusion Regions

Objects in any of the three exclusion regions (WD, WD+M, A stars) are flagged as QSO\_REJECT, and are not targeted — unless they are also selected as FIRST targets. After the QSO\_REJECT flag has been set, in the Main Survey, no further attempt is made to target these objects based upon their colors. However, we allow ourselves the option of targeting QSO\_REJECT objects in limited areas of the sky (e.g., in the Southern Survey area) to explore the nature of the objects we are missing in the Main Survey.

The white dwarf exclusion region, which is shown in dark blue in Figure 7, includes objects which satisfy all the following criteria

$`\begin{array}{cccccc}\hfill \mathrm{A})& \hfill 0.8& <& u^{}g^{}& <& 0.7\hfill \\ \hfill \mathrm{B})& \hfill 0.8& <& g^{}r^{}& <& 0.1\hfill \\ \hfill \mathrm{C})& \hfill 0.6& <& r^{}i^{}& <& 0.1\hfill \\ \hfill \mathrm{D})& \hfill 1.0& <& i^{}z^{}& <& 0.1.\hfill \end{array}`$ (9)
There are essentially no common astrophysical objects with colors bluer than the blue limits given above, but by applying these limits, we leave open the possibility of serendipitously discovering truly unusual objects.

Next, we reject A stars, since their numbers are too small to have any effect upon the definition of the stellar locus (see Appendix A), but are found in sufficiently large numbers to significantly contaminate the quasar sample. The region that is rejected is defined by the intersection of

$`\begin{array}{cccccc}\hfill \mathrm{A})& \hfill 0.7& <& u^{}g^{}& <& 1.4\hfill \\ \hfill \mathrm{B})& \hfill 0.5& <& g^{}r^{}& <& 0.0\hfill \\ \hfill \mathrm{C})& \hfill 0.5& <& r^{}i^{}& <& 0.2\hfill \\ \hfill \mathrm{D})& \hfill 0.4& <& i^{}z^{}& <& 0.2.\hfill \end{array}`$ (14)
The last region of color-space that we reject is that which is occupied by unresolved red-blue star pairs, usually M star and white dwarf pairs. These objects appeared as significant contaminants in the early target selection process when we attempted to target all point sources that were outside of the stellar locus. The color-space that is rejected is the intersection of

$`\begin{array}{cccccc}\hfill \mathrm{A})& \hfill 0.3& <& g^{}r^{}& <& 1.25\hfill \\ \hfill \mathrm{B})& \hfill 0.6& <& r^{}i^{}& <& 2.0\hfill \\ \hfill \mathrm{C})& \hfill 0.4& <& i^{}z^{}& <& 1.2\hfill \\ \hfill \mathrm{D})& \hfill \sigma _g^{}& <& 0.2,& & \end{array}`$ (19)
where the additional restriction on the error in $`g^{}`$ keeps us from rejecting too many normal stars with large errors; such objects are outliers according to our stellar locus definition and are properly rejected by the stellar locus code.

We note that except for the requirement that $`\sigma _g^{}<0.2`$ in the WD+M box, there are no formal requirements that the error in the colors be small for the objects in the exclusion regions. That is, we do not require that the objects be in the regions within their errors, just within the regions based on the measured colors.

Figure 8 displays the spectra of three objects that are typical of the classes of objects that are excluded. The top panel shows a hot white dwarf, with its characteristic broad Balmer lines, while the middle panel shows an A star lying in the box defined by equation (14). The lower panel shows a blue/red pair; note the rising spectrum in the blue with strong Balmer lines, and rising spectrum in the red with characteristic TiO and VO bands.

#### 3.5.2 Inclusion Regions

In addition to objects that are explicitly rejected by these three exclusion boxes, we also have a series of color cuts and boxes where objects are explicitly included even if they do not meet the other color-selection requirements. We specifically target “mid-$`z`$” ($`2.5<z<3`$) quasars in a small region of color-space where these quasars cross the stellar locus in SDSS color space. We also explore three regions of color space for high redshift quasars that might otherwise be missed by the color outlier selection routine (§ 3.4).

Figure 9 illustrates the mid-$`z`$ problem, showing a $`z2.7`$ quasar spectrum, a star that inhabits the same region of color space, and the SDSS filter curves. Although the spectra do not cover the $`u`$ filter, we can see that even though the continua of the two spectra are different, the quasar emission lines cause the quasar to have very similar broad-band colors to the star. See Figure 1 of Fan (1999) for a similar figure using simulated spectra that shows that the $`u^{}g^{}`$ colors of the quasar and star are also similar.

The first inclusion region that we define is an attempt to deal with this problem near $`z2.7`$. If we failed to target quasar candidates in this region of color space, our completeness would be very low for $`2.5<z<3`$, a range of tremendous importance for quasar absorption line studies such as measurements of the primordial deuterium abundance (e.g., Burles et al., 1999). In addition, this redshift range covers the peak of the quasar co-moving number density (Schmidt et al., 1995). However, if we were to explicitly target all of the objects in this region of color space, our efficiency would become unacceptably low.

Thus, we have decided on a hybrid approach to allow a statistical study of the quasar population in this redshift range. First, we define a region in color space as follows:

$`\begin{array}{cccccc}\hfill \mathrm{A})& \hfill 0.6& <& u^{}g^{}& <& 1.5\hfill \\ \hfill \mathrm{B})& \hfill 0.0& <& g^{}r^{}& <& 0.2\hfill \\ \hfill \mathrm{C})& \hfill 0.1& <& r^{}i^{}& <& 0.4\hfill \\ \hfill \mathrm{D})& \hfill 0.1& <& i^{}z^{}& <& 0.4.\hfill \end{array}`$ (24)
Second, the selected objects are further restricted by requiring that they be point sources and that they lie outside of a $`2\sigma `$ region surrounding the stellar locus (as opposed to the $`4\sigma `$ limit that we normally use; see Figures 2 and 3 (green lines), along with § 3.4 and Appendix A). Finally, since this region of color space crosses the stellar locus, we choose to explicitly target only 10% of the objects in this mid-$`z`$ color box in order to limit our reduction in efficiency. This sparse sampling is accomplished by targeting only those objects whose tenths digit in decimal degrees right ascension is equal to seven, which is as good of a way of defining a random sample as any. The end result is that we target enough objects in this region (flagged as QSO\_CAP) that we can correct for our incompleteness in a statistical sense without wasting too many fibers taking spectra of normal stars.

Another inclusion region involves quasars with $`z2.2`$. All objects which are detected in both $`u`$ and $`g`$, that have errors less than $`0.1`$ mag in both bands and $`(u^{}g^{})<0.6`$ are explicitly selected (as QSO\_CAP) so long as they are not in the white dwarf exclusion box and satisfy the magnitude limits. This cut is intended to be the equivalent of previous UVX color-cuts (e.g., Boyle et al., 1990; Koo & Kron, 1988) in the sense that this cut selects objects with roughly the same upper limit in redshift (namely $`z2.2`$). In reality, this cut does not cause many objects to be selected that are not otherwise selected as stellar locus outliers, but most of the candidates selected only because of this color-cut are indeed quasars or AGN.

The final series of color-cuts are designed to recover more high redshift quasars than would be possible by simply targeting red outliers from the stellar locus (see the discussion at the end of § 3.4.5). Fan et al. (2001a) show that certain simple color-cuts are very effective in the selection of high-redshift quasars. As a result, we also target objects (as QSO\_HIZ) that meet criteria similar to those used by Fan et al. (2001a). In fact, the cuts used herein are somewhat more inclusive than those used by Fan et al. (2001a), since we can afford a slightly lower selection efficiency as a trade-off for increasing our completeness.

Similar to Fan et al. (2001a), we create an inclusion region in $`gri`$ color-space, which is intended to recover quasars with $`z3.6`$ (which are problematic for the stellar locus outlier code). The criteria for the $`gri`$ inclusion region is the intersection of:

$`\begin{array}{cccccccc}\hfill \mathrm{A})& \hfill \sigma _i^{}& <& 0.2\hfill & & & & \\ \hfill \mathrm{B})& \hfill u^{}g^{}& >& 1.5\hfill & \mathrm{OR}& \hfill u^{}& >& 20.6\hfill \\ \hfill \mathrm{C})& \hfill g^{}r^{}& >& 0.7\hfill & & & & \\ \hfill \mathrm{D})& \hfill g^{}r^{}& >& 2.1\hfill & \mathrm{OR}& \hfill r^{}i^{}& <& 0.44(g^{}r^{})0.358\hfill \\ \hfill \mathrm{E})& \hfill i^{}z^{}& <& 0.25\hfill & & & & \\ \hfill \mathrm{F})& \hfill i^{}z^{}& >& 1.0.\hfill & & & & \end{array}`$ (31)
Cuts C) and D), which involve $`gri`$ color-space, are depicted in the upper right-hand panel of Figure 7 (red line). The restriction on the $`i^{}`$ errors, A), is to ensure the integrity of the $`r^{}i^{}`$ and $`i^{}z^{}`$ colors. The cuts in $`u^{}g^{}`$ and $`u^{}`$, B), restrict the sample to $`u`$-band dropouts. The vertical cuts in $`g^{}r^{}`$ and the diagonal cut, C) and D), keep the region from getting too close to the stellar locus. Finally, restriction E) prevents most normal M stars from being selected and restriction F) prevents objects that are too blue in $`i^{}z^{}`$ to be high-$`z`$ quasars from entering the selection region.

We similarly define a region in $`riz`$ color space that is designed to select quasars with $`z4.5`$. These criteria are

$`\begin{array}{cccc}\hfill \mathrm{A})& \hfill \sigma _i^{}& <& 0.2\hfill \\ \hfill \mathrm{B})& \hfill u^{}& >& 21.5\hfill \\ \hfill \mathrm{C})& \hfill g^{}& >& 21.0\hfill \\ \hfill \mathrm{D})& \hfill r^{}i^{}& >& 0.6\hfill \\ \hfill \mathrm{E})& \hfill i^{}z^{}& >& 1.0\hfill \\ \hfill \mathrm{F})& \hfill i^{}z^{}& <& 0.52(r^{}i^{})0.412.\hfill \end{array}`$ (38)
In this case, the $`u^{}`$ and $`g^{}`$ magnitude limits, B) and C), are designed to restrict the sample to objects that are both $`u`$\- and $`g`$-band drop-outs. The $`r^{}i^{}`$ cut, D), places a limit on the amount of flux in the $`r`$-band in addition to keeping the selected objects from getting too close to the stellar locus. As above, the blue limit on $`i^{}z^{}`$, E), is designed to reject objects which are too blue to be high-$`z`$ quasars. Finally, the diagonal cut, F), limits the number of normal stars that stray into the inclusion region. In the lower left-hand panel of Figure 7, we show (as a red line) the cuts that are relevant to the $`riz`$ color plane, D), E), and F).

Finally, we add an inclusion region in $`ugr`$ color space that was not used by Fan et al. (2001a); this cut is designed to recover $`z3.0`$ quasars — especially those fainter than $`i^{}=19.1`$, which is the magnitude limit of the low-redshift sample, and those $`z3.5`$ quasars that may be undetected in $`u`$ but which are not outliers in $`griz`$. The selection criteria used in this region are

$`\begin{array}{cccc}\hfill \mathrm{A})& \hfill u^{}& >& 20.6\hfill \\ \hfill \mathrm{B})& \hfill u^{}g^{}& >& 1.5\hfill \\ \hfill \mathrm{C})& \hfill g^{}r^{}& <& 1.2\hfill \\ \hfill \mathrm{D})& \hfill r^{}i^{}& <& 0.3\hfill \\ \hfill \mathrm{E})& \hfill i^{}z^{}& >& 1.0\hfill \\ \hfill \mathrm{F})& \hfill g^{}r^{}& <& 0.44(u^{}g^{})0.56.\hfill \end{array}`$ (45)
The cuts that correspond to the $`ugr`$ region of color space are shown (as a red line) in the upper left-hand panel of Figure 7. Both the magnitude limit on $`u^{}`$, A), and the color cut in $`u^{}g^{}`$, B), are meant to ensure that the objects are sufficiently red to be high-$`z`$ quasars. The diagonal cut, F), and the upper limit to $`g^{}r^{}`$, C), keep the objects from getting too close to the stellar locus (especially where the errors get large for M stars). The $`r^{}i^{}`$ cut, D), is also designed to limit the number of M stars making the cut. Finally, as with the above high-$`z`$ regions, we exclude objects that are too blue in $`i^{}z^{}`$, E), to be real high-$`z`$ quasar candidates.

In practice, this $`ugr`$ high-$`z`$ cut is combined with another cut that selects outliers in the $`ugri`$ color-cube that are sufficiently red. These objects are required to be outside of the $`ugri`$ stellar locus and must be detected in both $`u^{}`$ and $`g^{}`$, have $`u^{}`$ and $`g^{}`$ errors less than 0.2 mag and have $`(u^{}g^{})>1.5`$. Objects that meet these criteria or the $`ugr`$ high-$`z`$ criteria described above are allowed to be selected as quasar candidates (flagged as QSO\_HIZ) to the fainter $`i^{}=20.2`$ limit as long as they are not extended sources.

## 4 Diagnostics

How well does the quasar selection algorithm perform? As discussed above, this is really two questions: what is the selection efficiency and what is the completeness? We need to know both of these quantities as a function of redshift and magnitude (both apparent and absolute).

Completeness and efficiency diagnostics were carried out using both simulated quasar photometry and empirical results from early SDSS imaging and spectroscopy. As discussed in § 2, the empirical testbed contains all of the imaging data in runs 756, 1035, 1043, 1752, 1755 and some of run 752. On the observational side, completeness is defined as the fraction of previously known quasars in the appropriate magnitude range that are selected by the algorithm, as quantified in § 4.1. Efficiency is defined as the fraction of quasar candidates that turn out to be quasars when spectra are taken. More spectroscopic data (using the final version of the target selection code) is needed in order to fully characterize the completeness and efficiency of the survey; however, we have enough data to determine that the algorithm is meeting the goals for completeness and efficiency. In § 4.2, we use data from over 100 square degrees with spectra available for 90% of the quasar candidates, and in § 4.1, we examine over 1500 known quasars in the testbed area along with the colors of over 50,000 simulated quasars.

To help determine the survey completeness we also make use of simulated quasar colors. We calculate the simulated distribution of quasar colors at a given redshift and magnitude, following the procedures described in Fan (1999) and Fan et al. (2001a). The intrinsic quasar spectrum model includes a power-law continuum and a series of broad emission lines. We use the same distributions of the power-law index for the quasar continuum ($`\alpha =0.5\pm 0.3`$; $`f_\nu \nu ^\alpha `$) and the equivalent widths for the emission lines as in Fan (1999) (except for Fe II, which now has a larger equivalent width). The synthetic quasar absorption spectrum takes into account intervening H I absorbers along the line of sight, including Ly$`\alpha `$ forest systems, Lyman-limit systems and damped Ly$`\alpha `$ systems, using distribution functions similar to those used by Fan (1999). Finally, we calculate the SDSS magnitudes and the associated photometric error from the model spectrum in each band, using the filter transmission curves and system efficiency of Stoughton et al. (2002), assuming a median seeing of $`1\stackrel{}{\mathrm{.}}4`$ FWHM. The simulated colors are generated for a uniformly distributed grid of redshift and $`i`$ magnitude.

### 4.1 Completeness

Completeness testing was accomplished in two ways: checking to see that previously known quasars are recovered, and by evaluating the results of target selection for simulated quasars. We began by seeking to maximize the completeness of previously known quasars. To facilitate this we created a catalog of previously known quasars; for details see Richards et al. (2001). Objects in this catalog were matched to the objects in the quasar target selection testbed data.

Table 5 gives the results of this matching. In short, the SDSS quasar target selection algorithm targets 1456 of 1540 (94.5%) of known quasars that should have been targeted, and establishes an upper limit to the completeness of our algorithm with respect to real AGN. These can be broken down into a number of categories. Quasars from the NASA/IPAC Extragalactic Database (NED) are recovered at the rate of 369 in 394 (93.7%); 96.6% (56 of 58) of FIRST quasars are recovered (using both color and radio selection); quasars discovered in the first 66 plates of SDSS spectroscopic commissioning (using a more liberal, but less efficient selection algorithm) are recovered by the final quasar target selection algorithm at a rate of 1154 in 1210 (95.4%); finally, 88.6% of high-$`z`$ quasars discovered during the early period of the SDSS high-$`z`$ quasar follow-up campaign (Fan et al., 2001a) that satisfy the magnitude requirements are recovered (39 of 44). Note that the completeness of the last category is somewhat lower than the others because Fan et al. (2001a) had less strict flag-checking requirements than does the Main Survey for quasars; we cannot afford to be as lenient during the Main Survey due to efficiency constraints. Table 5 also provides other information that may be relevant to the completeness of the SDSS Quasar Survey.

We find that most of the known quasars not selected by our algoritm are missing as a result of non-repeatable problems (cosmic rays, etc.) and not because of shortcomings of our selection algorithm. A known quasar that is missed because of one or more cosmetic defects would not necessarily be missed if new imaging data were obtained for that object.

We would also like to quantify the completeness as a function of redshift and magnitude; we do so with the grid of model quasars discussed above. These simulated quasars have a much more homogeneous distribution in redshift-magnitude space than do real quasars. Figure 10 shows the completeness of the selection function in redshift-$`i^{}`$ space, whereas Figure 11 shows the completeness as a function of redshift and $`M_i^{}`$ for the same simulated quasars. The resulting selection function is tabulated in Table 6, as a function of $`i`$ magnitude for $`z5.3`$ and as a function of $`z`$ magnitude for $`z>5.3`$, where the quasars become $`i`$-band drop-outs. For the full grid of simulated quasars uniformly distributed between $`0z5.8`$ and $`16.0i^{}19.0`$, the mean completeness is 94.6%.

However, this fraction is somewhat misleading. Our true completeness must actually be smaller than this number. This completeness assumes a uniform distribution of quasars in redshift space, which is unrealistic; the true, overall completeness of the quasar survey will be different from the values quoted above. In particular, from Figures 10 and 11 and Table 6, it is evident that the average completeness is a function of quasar redshift and luminosity. The survey completeness is low in the redshift range $`2.4<z<3.0`$, because at these redshifts the quasar locus crosses the stellar locus in the SDSS color space, and we sparse sample in the mid-$`z`$ color box (§ 3.5.2) that selects these quasars. The survey completeness is larger than 80% for all other redshifts up to $`z5.3`$ for quasars $`0.5`$ magnitude brighter than the survey limit. Note that the completeness is given in terms of “true” magnitude (without photometric error) in the simulation. Therefore, the completeness does not immediately reach zero for quasars fainter (or brighter) than the survey limit ($`i=19.1`$ for low-$`z`$ quasars, and $`i=20.2`$ for $`z>3`$), as they are scattered into the selected range due to the photometric error. Note also that the SDSS is only sensitive to relatively luminous quasars ($`M_i^{}25`$) for $`z2`$.

In addition, the completeness based on the simulations is also an over-estimate because none of the simulated quasars are affected by cosmetic defects (unlike the known quasars). We expect to miss a few percent of quasars due to non-repeatable defects, independent of redshift or apparent magnitude. That is, if we observed the same area of sky again, we would very likely recover these objects. Of course, such incompleteness is independent of redshift and largely independent of color and brightness.

We note that our algorithm is quite sensitive to red quasars — in contrast to most previous optically selected surveys. The reasons for this sensitivity are threefold. First, we are magnitude limited in the $`i`$-band instead of the $`B`$-band and are thus less sensitive to dust reddening effects which are a strong function of wavelength with stronger absorption in the blue. Second, the precision of our photometry reduces the chance of a quasar being scattered into the stellar locus, or for photometry errors to broaden the stellar locus, which would shrink the region of color space in which we could select quasars. Finally, we are not biased against regions of color space that are not known to harbor quasars; to the extent possible we consider any source outside of the stellar locus to be a quasar candidate.

One way to test the sensitivity of our color-selection algorithm is to ask what fraction of the radio-selected quasars are also color-selected. As can be seen from Table 5, of the known quasars that met our radio selection criteria, only 20 of the 162 (12.3%) were not also selected according to their colors (see also § 4.2). Of the 3814 quasars in the Early Data Release (EDR) quasar sample (Schneider et al., 2002), there were only 23 objects which were radio-selected only; a composite of these 23 objects shows that they are quite reddened and tend to be low-ionization BAL quasars.

Understanding the completeness of the survey as a function of quasar properties is crucial for the SDSS quasar Key Projects, the evolution of quasar luminosity function and large scale distribution of quasars. Here we only present the survey completeness in term of its average value (both from matching with known quasars and from the simulation). The completeness is also a function of the quasar SED, in particular the continuum shape and emission line strength. Detailed discussion will be presented in a later work; for high-redshift quasars, see the discussion in Fan et al. (2001a). In the SDSS Southern Survey, for a relatively small area, we plan to relax a number of color constraints (including various exclusion boxes) in the quasar target selection algorithm, and push the selection closer to the stellar locus in the color space. In a future paper, we will use these data to address the completeness question in detail, especially for quasars at $`z3`$.

Although the process of testing the completeness of the algorithm using the Southern Survey is beyond the scope of this communication, we have begun the process. For example, we have further explored our completeness by investigating those objects that are flagged as QSO\_REJECT. One of the goals of the Southern Survey is to take spectra of all such objects that are otherwise good quasar candidates222The QSO\_REJECT flag gets set before objects are tested against the stellar locus, thus not all QSO\_REJECT objects will be good quasar candidates.. As of this writing, we have taken spectra of 1640 QSO\_REJECT objects from runs 94 and 1755 using a modified version of the quasar target selection algorithm that 1) allows QSO\_REJECT objects to be selected, 2) targets all point sources in the mid-$`z`$ region (as opposed to 10%), and 3) has fainter magnitude limits. Of these 1640, only 26 are AGN that are not also selected by the Main Survey algorithm. Of these, the majority are weak LINERs (Heckman, 1980) with a strong stellar component, with redshifts $`0.10.3`$. There are only two quasars with higher redshifts ($`z=2.25`$ and $`z=2.86`$); one is a Type II quasar (e.g., see Urry & Padovani 1995). The parent sample of objects selected from runs 94 and 1755 is about $`11,500`$ objects. If 65% of these are quasars, we estimate that the WD, WD+M and A-star exclusion boxes (§ 3.5.1) that are used to set the QSO\_REJECT flag are rejecting only $`26/(0.6511,500)=0.3\%`$ of quasars that are outside of the stellar locus (assuming that the objects that we have spectra of are representative of the full sample). Thus, the exclusion boxes have a negligible effect upon our completeness.

### 4.2 Efficiency

To test the efficiency of the algorithm, we used a $`100`$ square degree region of sky which has been targeted by the final version of the quasar target selection algorithm. In particular, we examined the 1872 quasar candidates with $`16.25^{}<\mathrm{RA}<57^{}`$, $`1.25^{}<\mathrm{Dec}<+1.25^{}`$ (runs 94 and 125 from the SDSS Early Data Release; Stoughton et al. 2002). Of these objects, we have spectra in hand for all but 185 objects, which we believe to be largely spurious candidates due to the poor image quality of those early SDSS runs.

Overall, we found that 1113 of the 1687 quasar candidates with spectra are quasars or AGN. This number corresponds to an efficiency of 66.0%, which is consistent with the a priori requirements for the algorithm. Of the quasar candidates that are not quasars, 266 are galaxies (15.8%) and 294 are stars (17.4%). Table 7 presents a summary of the efficiency results for $`100`$ square degrees of data; its columns are 1) the number of quasar candidates, 2) the number of quasar candidates for which we have obtained spectra, 3) the number in column 2 that turn out to be quasars/AGN, 4) the ratio of column 3 to column 2, 5) the number in column 2 that turn out to be galaxies, 6) the ratio of column 5 to column 2, 7) the number in column 2 that turn out to be stars, and 8) the ratio of column 7 to column 2.

In addition to the objects for which we obtained good spectra, there were 11 candidates that were assigned fibers, but that either had no spectra or were spectra of blank areas of sky. We found that two of these were the result of broken fibers in the spectrograph, one was a supernova, and the others were mostly asteroids.

The contaminating galaxies come in three categories: star-forming, blue, emission-line galaxies at low redshift; faint red objects at $`z=0.4\mathrm{to}\mathrm{\hspace{0.33em}0.5}`$; and compact E+A galaxies at $`z=0.4\mathrm{to}\mathrm{\hspace{0.33em}0.8}`$ (e.g., Zabludoff et al., 1996), whose strong Balmer break mimics the onset of the Ly$`\alpha `$ forest in a high-redshift quasar in the SDSS filter set. The contaminating stars are largely cool M and L stars, a few A, F, white dwarf, and white dwarf/M dwarf pairs, and a number of interesting objects, such as carbon stars and low-metallicity subdwarf M stars.

We have also broken down the efficiency according to category: low-$`z`$ ($`ugri`$ color selected), high-$`z`$ ($`griz`$ color selected), and FIRST-selected quasar candidates. Low-$`z`$ targets include 1392 quasar candidates, of which 1339 have spectra. Of these 1339, 1005 are quasars (75.0%), 233 are galaxies (17.4%), and 98 are stars (7.3%). Of the quasars, 116 are $`z>2`$, 16 are $`z>3`$. Of the 1392 candidates, 1155 are not also targeted as high-$`z`$ or FIRST objects; 1110 of these have spectra. Of these 1110, 789 are quasars, of which 81 are $`z>2`$, and 3 are $`z>3`$.

Similarly, for high-$`z`$ targets there were 663 quasar candidates, 529 of which have spectra. Of these 529, 288 are quasars (54.4%), 35 are galaxies (6.6%), and 194 are stars (36.7%). Of the 663 high-$`z`$ targets, 426 are exclusively high-$`z`$; 300 of these have spectra. Of those 300, only 72 are quasars; 61 have $`z>2`$, 55 have $`z>3`$, and 7 have $`z>4`$.

In addition to the low-$`z`$ and high-$`z`$ selected objects, there are 74 FIRST-selected quasar candidates, 69 of which have spectra. Of these 69, 60 are quasars (87.0%) and 9 are stars (13.0%). Of the 74 FIRST targets, 22 were targeted only by matching with FIRST sources. Ten of these 22 are quasars, 9 are stars, and the remaining 3 don’t have a spectrum. We examined the spectra of the ten AGN; two are unusual BAL quasars (Hall et al., 2002), several are at $`z2.6`$ where the quasar and stellar loci cross, and the remaining few don’t look particularly unusual; they are perhaps a bit redder than a typical quasar.

Figure 12 shows examples of two quasars from the sample: one at z=3.6 which shows strong self-absorption in the C IV and N V lines, and one low-redshift Seyfert I galaxy (note the Ca H and K stellar absorption lines). Also shown are examples of some of the non-quasars which are selected as quasar candidates: an E+A galaxy (e.g., Zabludoff et al., 1996), whose Balmer break gives colors reminiscent of a quasar with the onset of the Lyman alpha forest at $`z=4.7`$; an emission-line dominated starburst galaxy; a carbon star (e.g., Margon et al 2002, in preparation); and a low-metallicity subdwarf, whose broad absorption lines give colors quite separate from the stellar locus.

In summary, our current analysis shows that the algorithm is meeting the a priori requirement of 65% efficiency and we fully expect that further observations will confirm this result. This efficiency is a function of the selection method with efficiencies of 75.0%, 54.4% and 87.0% expected for low-$`z`$ ($`ugri`$) color selection, high-$`z`$ ($`griz`$) color selection, and FIRST radio selection, respectively.

### 4.3 Density

Based on the testbed data, the SDSS quasar target selection algorithm selects an average of $`18.7`$ quasar candidates per square degree; the $`1\sigma `$ error in the mean is $`2.9`$ quasars per square degree. The density as a function of category is given in Table 8 based on the $`446.3952`$ square degrees of sky in the testbed. The mean densities (quasars per square degree) as a function of category are $`13.0`$, $`7.7`$, and $`0.7`$ for low-$`z`$, high-$`z`$, and FIRST targets, respectively. Note that the sum of the densities does not equal the overall density due to overlaps between the categories. Also, the FIRST density is underestimated since not all of the runs were matched to FIRST, yet we used the total area to compute the density, since it is difficult to determine the exact area in common. The true density of FIRST sources is closer to one quasar per square degree; however, only a small fraction of these are not also selected by the color algorithm, so this will have little effect on our total density of quasar candidates.

### 4.4 Color and Redshift Distributions

In Figure 13 we show the color-color and color-magnitude distributions of all 8330 quasar candidates from the testbed. Blue points show the distribution of low-$`z`$ ($`ugri`$-selected) quasar candidates, whereas red points are high-$`z`$ ($`griz`$-selected), and green points are FIRST-selected candidates. The magenta lines show the main parts of the three high-$`z`$ inclusion regions (see § 3.5.2) and the light blue lines show the blue extent of the extended object rejection for $`ugri`$-selected objects.

For comparison, in Figure 14, we show the color-color distribution of 3040 quasars out of 8330 quasar candidates in the testbed333Note that many of the 8330 quasar candidates from the testbed do not yet have spectra, thus the 3040 confirmed quasars do not represent all of the true quasars in this sample.. In this figure, the colors of the points indicate the redshift of the object as given in the figure legend. In Figure 15 we show the redshift distribution of the first 1073 confirmed quasars selected using the algorithm described herein. The color-redshift relation for SDSS quasars was presented in Richards et al. (2001).

## 5 Discussion

Multi-color quasar target selection is easy in principle as we have a good idea of what regions of color space are inhabited by quasars. However, it is difficult to estimate how well one’s algorithm handles more exotic objects and/or objects that occupy previously un- or under-explored regions of parameter space. This is one area where the SDSS has an advantage over many previous quasar surveys. The quality and quantity of the data allow us to take full advantage of exploring large regions of parameter space. In fact, the quasar algorithm has allowed the discovery of a number of unusual objects, including extreme BAL quasars; see Hall et al. (2002).

The SDSS quasar selection algorithm was largely designed prior to the start of the survey and was based on the idea that it should be possible to roughly fit a multi-dimensional surface to the locus defined by normal stars. Using a small amount of commissioning data and the work of Newberg & Yanny (1997), we defined the initial set of stellar locus parameters. The evolution of these parameters based on a much larger set of data provides the backbone for the final version of the algorithm that we have described herein.

With the knowledge that we have gained in constructing this algorithm and with the plethora of SDSS data that is now available to us, we can imagine how one might devise a superior algorithm, by making use of probability density functions in multi-dimensional parameter space. Such an algorithm might be designed as follows. First, take a large amount of SDSS data that has known spectral properties (or obvious spectral properties that can be discerned purely from the colors of the objects). Place all of these objects on a 5D grid that includes four colors and a magnitude. At each of these grid points, we can then compute the probability that the objects in the bin are quasars. With this information, in principle, one could take a new object and compare it to a look-up table of probabilities based on the control sample. The definition of quasar candidates would then involve nothing more than setting a probability threshold.

The main difference between a probability density type of algorithm discussed above and the algorithm that we have actually implemented is that the algorithm described herein does not take into account the fact that the stellar locus cross-section is not necessarily Gaussian, nor that the density of stars along the locus is not the same. Thus this algorithm does not choose a threshold at constant stellar density. Nevertheless the algorithm does create a well-defined stellar locus.

In practice, the size of the look-up table would make a probability density type of algorithm impossible to implement as a result of the amount of time it would take to run such an algorithm. However, it is possible to overcome this hurdle by implementing a Gaussian mixture model based on the Expectation Maximization (EM) Algorithm (Connolly et al., 2000), which fits Gaussians to the distribution of objects in multidimensional parameter space and has the effect of reducing an otherwise unwieldy look-up table to a much smaller number of Gaussian fits that describe the density of objects in multi-dimensional parameter space. We have begun work on just such an algorithm, which we hope will eventually serve as a supplement to, and an independent crosscheck on, the current algorithm.

## 6 Conclusions

We have presented the SDSS Quasar Target Selection Algorithm. Initial testing shows that the algorithm is better than 90% complete as determined by both previously known quasars and simulated quasars — consistent with the 90% completeness requirement that was established prior to the development of the algorithm. The expected efficiency of the algorithm (in terms of what fraction of objects targeted as quasars turn out to be quasars) is $`65`$% — again, consistent with the original requirement of 65%. This combination of completeness and efficiency is unprecedented in quasar surveys.

The high-quality CCD photometry coupled with the stellar locus outlier and FIRST selection techniques will aid in the exploration of new regions of parameter space that have been unexplored in previous surveys that have tended to rely on 2-3 color photometry from photographic plates using multi-color selection techniques. Furthermore, the high efficiency allows us to complete the goal of obtaining spectra for 100,000 quasars during the SDSS Quasar Survey in a remarkably short period of time, with relatively little contamination from non-quasars — all while maintaining a high degree of completeness as a function of quasar parameter space.

This work was supported in part by National Science Foundation grants AST99-00703 (GTR and DPS), PHY00-70928 (XF) and AST00-71091 (MAS). MAS acknowledges additional support from the Princeton University Research Board. XF acknowledges support from a Frank and Peggy Taplin Fellowship. This research has made use of the NASA/IPAC Extragalactic Database (NED) which is operated by the Jet Propulsion Laboratory, California Institute of Technology, under contract with the National Aeronautics and Space Administration. The Sloan Digital Sky Survey (SDSS) is a joint project of The University of Chicago, Fermilab, the Institute for Advanced Study, the Japan Participation Group, The Johns Hopkins University, the Max-Planck-Institute for Astronomy (MPIA), the Max-Planck-Institute for Astrophysics (MPA), New Mexico State University, Princeton University, the United States Naval Observatory, and the University of Washington. Apache Point Observatory, site of the SDSS telescopes, is operated by the Astrophysical Research Consortium (ARC). Funding for the project has been provided by the Alfred P. Sloan Foundation, the SDSS member institutions, the National Aeronautics and Space Administration, the National Science Foundation, the U.S. Department of Energy, the Japanese Monbukagakusho, and the Max Planck Society. The SDSS Web site is http://www.sdss.org/.

## Appendix A Construction of the Stellar Locus

### A.1 Overview

Ideally, the region of color-space inhabited by stars would be defined using a large, representative sample of stars with zero photometric errors. The algorithm to define the stellar locus would identify regions of color space where the density was large enough to give us unacceptable contamination in the quasar survey. Then, the selection algorithm would select objects which are inconsistent with being stars at some threshold (say $`4\sigma `$).

The sample of stars we used to define the locus of stars in the SDSS is large and representative, but is not free from photometric errors. We use the algorithm of Newberg & Yanny (1997) to define the stellar locus. This algorithm is capable of generating a region of three-dimensional color space which consists of a series of overlapping right elliptical cylinders with half-ellipsoids on the ends. Though it attempts to place these cylinders on the densest parts of color space, it falls short of describing a surface of constant stellar density.

We parameterize the locus in the regions of color space extending from F stars through M stars. A stars have low enough density relative to the F-M stars that the Newberg & Yanny (1997) algorithm does not fit them, so these stars are eliminated with a separate color cut. Very hot O and B stars are rare enough that they can be ignored. Stars cooler than M (L and T dwarfs) are also sufficiently rare that we do not include them in our stellar locus definition.

Since the SDSS data includes four colors, we defined two three-dimensional loci; the $`ugri`$ locus uses ($`u^{}g^{}`$), ($`g^{}r^{}`$), and ($`r^{}i^{}`$) colors, and the $`griz`$ locus uses ($`g^{}r^{}`$), ($`r^{}i^{}`$), and ($`i^{}z^{}`$) colors. The $`ugri`$ locus does most of the work for the selection of $`z3`$ quasars, whereas the $`griz`$ locus is primarily responsible for higher redshift quasars. Because our detection rate for $`2.5z3.0`$ quasars was unacceptably low, we also define a “mid-$`z`$” locus which is the same as the $`ugri`$ locus except that the width of every cylinder is smaller, allowing us to dig further into the locus where we expect these interesting quasars. We refer the reader to Figures 235, and 6, which show the locus parameterizations for the three loci that are discussed herein.

#### A.1.1 Locus Construction

The goal of locus construction is to define the series of right elliptical cylinders so that it encloses the highest density regions of stars in color space. Each cylinder can be described by a center in three-dimensional color space, a unit vector along the cylinder axis ($`\widehat{k}`$), the position angle of the major axis (defined as $`\mathrm{cos}(\theta )=\widehat{l}[(\widehat{k}\times \widehat{z})\times \widehat{k}]/|\widehat{k}\times \widehat{z}|`$, where $`\widehat{z}`$ is the reddest color axis, $`\widehat{l}`$ is the unit vector along the major axis of the cross section, and $`\widehat{m}`$ is the unit vector along the major axis of the cross section), and the length of the major ($`a_l`$) and minor ($`a_m`$) axes. The ends of each cylinder are naturally defined by the planes perpendicular to, and bisecting, lines drawn between the center of the cylinder and the cylinders which precede and follow it. The bare end of the first and last cylinders are terminated at the centers of the half ellipsoids attached to the ends of the locus. In practice, we define the ellipsoid on the red end so that the reddest cylinder effectively extends indefinitely. Tables 3 and 4 give the locus parameters.

The centers of the cylinders (“locus points”) are determined by a stable, iterative process of adding locus points and moving them to the centers of local high density regions (Newberg & Yanny, 1997). The unit vector, $`\widehat{k}`$, points from the center of the preceding cylinder to the center of the following cylinder. The position angles of the major and minor axes are determined from a principal components analysis of the projected positions of stars within the cylinder onto a plane perpendicular to $`\widehat{k}`$. The lengths of the major and minor axes are four times the one-sigma deviations of the points from the center of the cylinder. Note that this procedure allows discontinuities in the surface which separates the locus of stars from the region in which quasars are selected, as is evident, e.g., in Figure 2. The blue end of the stellar locus is described by a half ellipsoid which fits onto the end of the bluest cylinder. A single input parameter ($`k_{\mathrm{blue}}`$) determines the distance from the center of the bluest cylinder, along its axis, to the center of the end ellipsoid. Two of the axis lengths are given by the major and minor axis lengths of the bluest cylinder. The length of the ellipsoid axis along the stellar locus is given by a separate input parameter, $`a_{k\mathrm{blue}}`$. In the limit that $`a_{k\mathrm{blue}}=0`$, the locus ends with a plane rather than an ellipsoid.

#### A.1.2 Locus Specifics

The input data used to define the three stellar loci consisted of $`400,000`$ point sources from SDSS imaging runs 94, 125, 752, and 756 (see Stoughton et al. 2002, Table 3 and Figure 1 for coordinates) using the versions processed prior to 2000 November 3. More recent processing versions are available, but we found that constructing new loci with the newer data did not change the locus parameters enough to justify using the new parameters, given that many quasars had already been selected using the older parameters. These sources included only those objects with errors smaller than $`(0.1,0.03,0.03,0.03,0.06)`$ in $`(u^{},g^{},r^{},i^{},z^{})`$. In addition, objects with flags that would cause them to be rejected by the quasar target selection algorithm were removed from the sample (§ 3.2).

In order to construct the loci, we must first define some input parameters. See Newberg & Yanny (1997) for the definition of these quantities. The algorithm from Newberg & Yanny (1997) was extended to include ellipsoids at the red and blue ends, following the definitions in § A.1.1. For the construction of the $`ugri`$ stellar locus we first exclude point sources with $`(u^{}g^{})<0.5`$ or $`(g^{}r^{})<0`$, which are likely to be quasars and A stars, respectively (see Figures 2 and 3). Next we chose endpoints of $`𝐫_{\mathrm{start}}=(u^{}g^{},g^{}r^{},r^{}i^{})=(0.75,0.25,0.1)`$ and $`𝐫_{\mathrm{end}}=(2.55,1.3,1.2)`$. The maximum distance from the locus point associated with a star was chosen to be $`d_x=d_y=d_z=0.4`$. The locus width spacing was defined by setting $`N_{\sigma _{\mathrm{spacing}}}=3`$, such that new locus points are not added if they are closer to each other than $`N_{\sigma _{\mathrm{spacing}}}`$ times the major axis of the ellipse fitted to the locus at a given point. The algorithm was allowed to iterate 10 times, and the maximum number of locus points was constrained to be less than 20. The “width” of the locus was set to be $`N_{\sigma _{\mathrm{width}}}=4`$ and the errors were convolved with this width with $`N_{\sigma _{\mathrm{errors}}}=4`$. The end caps were defined according to $`k_{\mathrm{blue}}=0.05`$, $`k_{\mathrm{red}}=100`$, $`a_{k\mathrm{blue}}=0.2`$, and $`a_{k\mathrm{red}}=0.0`$. The parameterization of the $`ugri`$ stellar locus is given in Table 3.

The mid-$`z`$ locus is exactly the same as the normal $`ugri`$ locus, except that $`N_{\sigma _{\mathrm{width}}}=2`$ for the mid-$`z`$ locus. This smaller locus width allows us to probe closer to the most dense regions of the stellar locus when looking for $`2.5<z<3.0`$ quasars that can have colors that are similar to normal stars. The end caps for the mid-$`z`$ locus were defined according to $`k_{\mathrm{blue}}=0.05`$, $`k_{\mathrm{red}}=100`$, $`a_{k\mathrm{blue}}=0.1`$, and $`a_{k\mathrm{red}}=0.0`$.

For the $`griz`$ stellar locus, $`𝐫_{\mathrm{start}}=(g^{}r^{},r^{}i^{},i^{}z^{})=(0.1,0.1,0.1)`$ and $`𝐫_{\mathrm{end}}=(1.4,1.5,0.8)`$. As with the $`ugri`$ locus, $`N_{\sigma _{\mathrm{spacing}}}=3`$, $`d_x=d_y=d_z=0.4`$, $`N_{\sigma _{\mathrm{width}}}=4`$, $`N_{\sigma _{\mathrm{errors}}}=4`$ and the number of iterations was set to 10; however, the maximum number of locus points was 25. The end caps were defined according to $`k_{\mathrm{blue}}=0.3`$, $`k_{\mathrm{red}}=100`$, $`a_{k\mathrm{blue}}=0.5`$, and $`a_{k\mathrm{red}}=0.0`$. The parameterization of the $`griz`$ stellar locus is given in Table 4, see also Figures 5 and 6.

## Appendix B Details of the Outlier Rejection Algorithm

### B.1 Overview

This appendix describes the algorithm which selects objects that, within the measured photometric errors, do not fall within the stellar locus parameterization (see Appendix A). It is intended that the stellar locus parameterization describe a region of color space inhabited by stars, with no photometric errors included. If we had exact three-color photometry for each SDSS object, then our color selection routine would simply select all objects exterior to the parameterized locus. Simply stated, we select all objects whose photometric error ellipsoids (defined by $`N_{\sigma _{err}}`$ times the one-sigma error ellipsoid) do not intersect the stellar locus. The algorithm described in this appendix does nothing else. It does not use information about the locus of quasars, the object profiles, or the properties of any other astronomical objects. There are no astrophysical decisions buried in the mathematics, which is far more complicated than the statement of the problem which it addresses.

The mathematics solves this problem for three-dimensional color space. These three colors are designated $`(x,y,z)`$. In practice, they are either $`(ug,gr,ri)`$ or $`(gr,ri,iz)`$. To generate the error ellipse for each object, we must additionally know the variances and covariances in each color. The target selection algorithm currently assumes that the errors in each filter are uncorrelated and free from systematics (and thus uncorrelated), so that $`cov(ab,bc)=var(b)`$, where $`a,b,`$ and $`c`$ are magnitudes in a single filter. The variance for a given color is given by $`var(ab)=var(a)+var(b)`$. This is a good estimate if the errors are not too large.

Objects with large errors are typically near the detection threshold, and may be undetected in one or more filters. This results in incomplete knowledge of the position in color space. For example, if an object was detected in $`g`$, but was below the detection threshold in $`u`$, then we know that $`ug>u_{lim}g`$. If the $`u`$ measurement was missed due to a defect in the image, then nothing would be known about the $`ug`$ color. In general, we either know the color and variances of an object, or we know a limiting color. The limiting color is calculated from the flux corresponding to $`N_{\sigma _{err}}`$ times the one-sigma error in flux. In this case, the algorithm determines if there is any allowed value of the unknown colors which places the object in the stellar locus. We require that at least one color out of three be measured.

### B.2 Finding the Closest Locus Point

Given the measured colors (but not the errors in the colors), we determine which locus point is closest to the colors of the input object. We do this by looking at the Euclidean distance in color space, not taking into account any variation in the width of the locus, to simplify the computation.

In the case that one or two of the colors were not measured, the distance to each locus point is calculated after first moving the data point as close as is allowed by the color limits.

If two locus points are equally distant from the datapoint, the redder one is chosen. If the closest locus point is not between the centers of the ending ellipsoids, then the closest locus point is reassigned to be the first one interior to the ellipsoid centers.

### B.3 Handling Errors in Individual Objects

The closest locus point has an associated unit vector along the axis of a right elliptical cylinder, and a defined elliptical cross section and orientation, which define the local region of color space inhabited by the locus of stars. The catalog entry under consideration is assumed to be a star if the extent of its error ellipsoid overlaps any portion of this right elliptical cylinder which is interior to the ellipsoids at the ends of the locus. In practice, we determine this by adjusting the size of the cylinder containing the locus of stars according to the extent of the error ellipse, and then asking whether the object’s colors place it interior to this larger right elliptical cylinder. This is described in more detail below.

First, we estimate the error ellipse in the $`(l,m)`$ plane. The variance, covariance matrix for this plane is given by:

$$V_{ab}=\underset{x}{}\underset{y}{}\frac{a}{x}\frac{b}{y}S_{xy},$$

where $`𝐕`$ is the (two dimensional) covariance matrix in the $`l,m`$ plane, $`𝐒`$ is the (three dimensional) covariance matrix in color space, and the sums are over the three coordinates: $`ug,gr,`$ and $`ri`$ (for the $`ugri`$ color-cube, and similarly for the $`griz`$ color-cube). The error ellipse is given by:

$$\stackrel{}{𝐥}^𝐓𝐕^\mathrm{𝟏}\stackrel{}{𝐥}=N_{\sigma _{err}}^2,$$

where $`\stackrel{}{𝐥}=l\widehat{𝐥}+m\widehat{𝐦}`$. Solving this set of equations, the ellipse parameters are:

$$a_{err}^2=N_{\sigma _{err}}^2\frac{V_{ll}+V_{mm}\pm \sqrt{(V_{ll}V_{mm})^2+4V_{lm}^2}}{2},$$

$$\mathrm{tan}\theta _{err}=\{\begin{array}{cc}0\hfill & V_{lm}=0,V_{ll}>V_{mm}\hfill \\ \mathrm{}\hfill & V_{lm}=0,V_{mm}>V_{ll}\hfill \\ \frac{(V_{ll}V_{mm})+\sqrt{(V_{ll}V_{mm})^2+4V_{lm}V_{lm}}}{2V_{lm}}\hfill & V_{lm}0\hfill \end{array}$$

Now that we have the parameters for the error ellipse, we will adjust the stellar locus to reflect this information by “convolving” the $`N_{\sigma _{err}}`$ error ellipse and the cross-sectional locus ellipse. When convolving the two ellipses, we will make two important assumptions: the error distribution around each data point is Gaussian, and the distribution of stars within the stellar locus is Gaussian. These assumptions allow us to represent each of the ellipses as a Gaussian function, and, as such, we will convolve them. If one convolves two bivariate Gaussians, $`G_1`$ and $`G_2`$ (with elliptical cross sections), one obtains a third bivariate Gaussian with elliptical cross section. Here we will convolve the parameterized locus ellipse for the stellar locus in the $`l`$-$`m`$ plane with the rotated error ellipse, also in the $`l`$-$`m`$ plane. By convolving two Gaussians with these ellipses as their cross sections, we will discover a third ellipse which we will use to determine if the data point is within the locus, or if it is a viable candidate for target selection.

$$G_{convolved}=_{\mathrm{}}^{\mathrm{}}_{\mathrm{}}^{\mathrm{}}G_1(ll^{},mm^{})G_2(l^{},m^{})𝑑l^{}𝑑m^{}$$

$$G_1=\mathrm{exp}\left[\left(\frac{l^2}{2a_l^2}+\frac{m^2}{2a_m^2}\right)\right]$$

$$G_2=\mathrm{exp}\left(\left[\frac{(l\mathrm{cos}\theta _{err}+m\mathrm{sin}\theta _{err})^2}{2a_{errmaj}^2}+\frac{(l\mathrm{sin}\theta _{err}+m\mathrm{cos}\theta _{err})^2}{2a_{errmin}^2}\right]\right)$$

In this convolution, $`G_1`$ represents the parametrized locus and $`G_2`$ represented the error ellipse rotated to the $`l`$-$`m`$ plane. After the convolution we are left with a Gaussian which is given by:

$$K_1K_2\mathrm{exp}\left(\frac{l^2}{2a_l^2}\frac{m^2}{2a_m^2}+\frac{l^2}{4Aa_l^4}+\frac{T^2}{4R}\right)$$

where:

$$A=\frac{\mathrm{cos}^2\theta _{err}^2}{2a_{errmaj}^2}+\frac{\mathrm{sin}^2\theta _{err}^2}{2a_{errmin}^2}+\frac{1}{2a_l^2}$$

$$T=\frac{2l\mathrm{sin}\theta _{err}\mathrm{cos}\theta _{err}(a_{errmaj}^2a_{errmin}^2)}{4Aa_l^2}$$

$$R=\frac{\mathrm{sin}^2\theta _{err}}{2a_{errmin}^2}+\frac{\mathrm{cos}^2\theta _{err}}{2a_{errmaj}^2}+\frac{1}{a_l^2}+\frac{\mathrm{cos}^2\theta _{err}\mathrm{sin}^2\theta _{err}(a_{errmaj}^1a_{errmin}^1)}{4A}.$$

Here $`K_1`$ and $`K_2`$ are products of the integration, while the various terms within the exponent come from completing the square to facilitate the integration. Since we are only concerned with the elliptical cross section contained in the exponent, we will ignore the rest of the Gaussian and concentrate solely on the exponent. After considerable algebra the convolved ellipse looks like the following:

$$\alpha _ol^2\beta _olm+\gamma _om^2=1$$

where:

$$\alpha _o=\frac{1}{4R}\left(\frac{4R}{4Aa_l^4}\frac{4R}{2a_l^2}+\frac{\mathrm{sin}^2\theta _{err}\mathrm{cos}^2\theta _{err}(a_{errmaj}^2a_{errmin}^2)^2}{Aa_l^2}\right)$$

$$\beta _o=\frac{1}{4R}\left(\frac{\mathrm{sin}\theta _{err}\mathrm{cos}\theta _{err}(a_{errmaj}^2a_{errmin}^2)}{4Aa_l^2}\right)$$

$$\gamma _o=\frac{1}{4R}\left(\frac{1}{a_m^4}\frac{4R}{2a_m^2}\right).$$

After a great deal of simplification, the convolved ellipse is given by:

$$\alpha l^22\beta lm+\gamma m^2=d,$$

where

$$\begin{array}{c}d=a_{errmaj}^2a_{errmin}^2+(a_l^2a_{errmaj}^2+a_m^2a_{errmin}^2)\mathrm{sin}^2\theta _{err}+(a_{errmaj}^2a_m^2+a_l^2a_{errmin}^2)\mathrm{cos}^2\theta _{err}+a_l^2a_m^2\hfill \\ \alpha =a_{errmin}^2\mathrm{cos}^2\theta _{err}+a_{errmaj}^2\mathrm{sin}^2\theta _{err}+a_m^2\hfill \\ \beta =\mathrm{sin}\theta _{err}\mathrm{cos}\theta _{err}(a_{errmaj}^2a_{errmin}^2)\hfill \\ \gamma =a_{errmin}^2\mathrm{sin}^2\theta _{err}+a_{errmaj}^2\mathrm{cos}^2\theta _{err}+a_l^2.\hfill \end{array}$$

The major and minor axes of the convolved ellipse are given by the eigenvalues of the matrix form of the ellipse and the angle of inclination is the angle of the eigenvector pointed in the direction of the major axis. The variance/covariance matrix for the convolved ellipse is:

$$V_{convolved}=\frac{1}{d}\left(\begin{array}{cc}\alpha & \beta \\ \beta & \gamma \end{array}\right)$$

The characteristic equation of this matrix is given by

$$\lambda ^2\frac{\alpha +\gamma }{d}\lambda +\frac{\alpha \gamma \beta ^2}{d^2}$$

Solving this for the eigenvalues we get $`\lambda _1=(a+b)^1`$ and $`\lambda _2=(ab)^1`$. These eigenvalues are the values which diagonalize the matrix, and thus they give the coefficients to any point $`(l,m)`$ which happens to lie on either the major or minor axis. Thus the major and minor axes are given by:

$$a_{totmaj}^2=a+b,$$

$$a_{totmin}^2=ab,$$

The angle of rotation of the ellipse is found from the angle of the eigenvector pointed towards the major axis:

$$\mathrm{tan}\theta _{tot}=\{\begin{array}{cc}0\hfill & \beta =0,\alpha =\gamma \hfill \\ \mathrm{}\hfill & \beta =0,\alpha \gamma \hfill \\ \frac{\alpha \gamma +\sqrt{(\alpha \gamma )^2+4\beta ^2}}{2\beta }\hfill & \beta 0,\theta _{err}0\hfill \\ \frac{\alpha \gamma +\sqrt{(\alpha \gamma )^2+4\beta ^2}}{2\beta }\hfill & \beta 0,\theta _{err}<0\hfill \end{array},$$

where

$`a`$ $`=`$ $`{\displaystyle \frac{(\alpha +\gamma )}{2}}={\displaystyle \frac{a_{errmaj}^2+a_{errmin}^2+a_l^2+a_m^2}{2}},`$
$`b`$ $`=`$ $`{\displaystyle \frac{\sqrt{(\alpha +\gamma )^24(\alpha \gamma \beta ^2)}}{2}}=`$
$`{\displaystyle \frac{\sqrt{(a_{errmaj}^2a_{errmin}^2)^2+2(a_{errmaj}^2a_{errmin}^2)(a_l^2a_m^2)(\mathrm{cos}^2\theta _{err}sin^2\theta _{err})+(a_l^2a_m^2)^2}}{2}}.`$
Here, $`a`$ and $`b`$ are positive by definition. We need not worry about taking the square root of a negative number when computing the angle, since $`ab\alpha a+b`$ for all cases. If $`b=0`$, then the resulting ellipse is circular, so we arbitrarily assign $`\theta =0`$

We now can redefine the $`\widehat{𝐥},\widehat{𝐦}`$ axes associated with the closest locus point to describe this new elliptical cross section. The value of $`\theta _{tot}`$ must be added to the original angle $`\theta `$ describing the locus ellipse, since we have calculated the angle with respect to the $`\widehat{𝐥}`$ axis. When adding, we must be sure to keep the new value of $`\theta `$ in the allowed range: $`\frac{\pi }{2}<\theta \frac{\pi }{2}`$.

In addition to increasing the width of the excluded locus, we increase $`a_k`$ on the ends of the locus in a similar manner:

$$var(k)=\underset{x}{}\underset{y}{}\frac{k}{x}\frac{k}{y}S_{xy},$$

$$a_{ktot}=\sqrt{a_k^2+N_{\sigma _{err}}^2var(k)},$$

where the k in this equation is not for the locus point which is closest to the datapoint, but instead for the locus point which is closest to the respective endpoints (subject to being between the two endpoints).

In the remainder of this paper we will use $`a_l,a_m,a_k,`$ and $`\theta `$ to refer to the derived $`a_{totmaj},a_{totmin},a_{ktot}`$ and $`\theta +\theta _{tot}`$. Likewise, the $`\widehat{𝐥},\widehat{𝐦}`$ unit vectors are in the new coordinate system.

### B.4 Dealing with Non-detections in Some Filters

If not all of the colors of the object are known, then we are free to find the allowed point in color space that is most likely to be in the locus. This is not in general the same as finding the colors that are closest to the locus point in the Euclidean sense, since the parameterized region is an elliptical cylinder, not a sphere centered at the locus point. We instead wish to minimize the $`r^{}`$ distance to the locus, where $`r^{}`$ is given by:

$$r^{}=\sqrt{\left(\frac{l}{a_l}\right)^2+\left(\frac{m}{a_m}\right)^2},$$

where $`l\mathrm{\Delta }\stackrel{}{𝐫}\widehat{𝐥},m\mathrm{\Delta }\stackrel{}{𝐫}\widehat{𝐦}`$, $`\mathrm{\Delta }\stackrel{}{𝐫}\stackrel{}{𝐫}\stackrel{}{𝐫}_p`$, and $`\stackrel{}{𝐫}_p`$ is the position in color space of the closest point.

First, let’s solve the case where only the $`x`$ color, is unknown. To make the equations easier to read, we will use the notation $`\mathrm{\Delta }\stackrel{}{𝐫}(\mathrm{\Delta }x,\mathrm{\Delta }y,\mathrm{\Delta }z),\widehat{𝐥}=l_x\widehat{𝐱}+l_y\widehat{𝐲}+l_z\widehat{𝐳},\widehat{𝐦}=m_x\widehat{𝐱}+m_y\widehat{𝐲}+m_z\widehat{𝐳}`$. The solution is:

$$\mathrm{\Delta }x=\{\begin{array}{cc}\frac{\{(a_m^2l_xl_y+a_l^2m_xm_y)\mathrm{\Delta }y+(a_m^2l_xl_z+a_l^2m_xm_z)\mathrm{\Delta }z\}}{a_m^2l_x^2+a_l^2m_x^2}\hfill & a_m^2l_x^2+a_l^2m_x^20\hfill \\ \frac{l_y\mathrm{\Delta }y+l_z\mathrm{\Delta }z}{l_x}\hfill & a_m^2l_x^2+a_l^2m_x^2=0,l_x0\hfill \\ \frac{m_y\mathrm{\Delta }y+m_z\mathrm{\Delta }z}{m_x}\hfill & a_m^2l_x^2+a_l^2m_x^2=0,m_x0\hfill \\ 0\hfill & a_m^2l_x^2+a_l^2m_x^2=0,l_x=0,m_x=0\hfill \end{array}.$$

The first case above is the result of the minimization process. If the denominator is zero, but $`l_x0`$, then it follows that $`a_m=0`$. Also, either $`a_l=0`$ or $`m_x=0`$. In the first case, we will only be able to find a color point in the locus if we can fortuitously set $`m=l=0`$ by moving along the $`x`$ axis. In the second case, we cannot affect the magnitude of m. Either case is optimized by setting $`l=0`$. If the denominator is zero, but instead $`l_x=0`$, then we still need either $`a_l=0`$ or $`m_x=0`$. In the first case we cannot affect the distance along the major axis, so we set the distance along the minor axis to zero. The second case gives us $`\widehat{𝐱}=\widehat{𝐤}`$, so we might as well set $`\mathrm{\Delta }x=0.`$

If the value of $`x`$ is completely unknown, then we use this calculated $`\mathrm{\Delta }x`$ to determine whether the object is consistent with being a star. If the value of the color, $`x`$, is a limit, then we must ask whether the computed value is within the limits. If it is not, then we instead use the limiting $`x`$ value to determine whether the datapoint is consistent with being a star.

Next, we tackle the case where both the $`x`$ color and $`y`$ color are unknown. When two of the colors are unknown, one can find values that will put the point exactly on the line $`\stackrel{}{𝐫}\stackrel{}{𝐫}_p=\lambda \widehat{𝐤},`$ where $`\lambda `$ is a free parameter. We can solve for $`\lambda `$, and then the two unknown colors using:

$`\lambda `$ $`=`$ $`\{\begin{array}{cc}\frac{\mathrm{\Delta }z}{k_z},\hfill & k_z0\hfill \\ 0,\hfill & k_z=0,\hfill \end{array}`$ (B3)
$`\mathrm{\Delta }y`$ $`=`$ $`\lambda k_y,`$
$`\mathrm{\Delta }x`$ $`=`$ $`\lambda k_x.`$
If $`k_z=0`$, then the line down the center of the locus is in the $`x,y`$ plane, so there are many values of $`x`$ and $`y`$ which will be on it. We arbitrarily choose the one on the locus point, since we know that this value is also within the $`k`$ limits of the stellar locus.

The existence of limiting values in $`x`$ and $`y`$ make this a little trickier. First, we calculate the value of $`\mathrm{\Delta }y`$ which places the point exactly on the center of the locus. In the case that this value is not consistent with the $`y`$ limits, we assign $`\mathrm{\Delta }y=y_{lim}y_p`$. Since we now have only one missing color, we can use the procedure outlined above (the case where only the $`x`$ color is unknown) to calculate the optimal value of $`\mathrm{\Delta }x`$. If a limit was not reached, one can verify that the computed $`\mathrm{\Delta }x`$ will be the same as if we had used $`\mathrm{\Delta }x=\lambda k_x`$. If this computed value of $`\mathrm{\Delta }x`$ is within the allowed limits, then we have done the best we can. If it is not, then we set $`\mathrm{\Delta }x=x_{lim}x_p`$ and then compute the optimal value of $`\mathrm{\Delta }y`$ given $`\mathrm{\Delta }x`$ and $`\mathrm{\Delta }z`$. The optimal value of $`\mathrm{\Delta }y`$, given $`\mathrm{\Delta }x`$ and $`\mathrm{\Delta }z`$, can be computed by reassigning the axes ($`xy,yz,zx`$) in the equation that optimizes $`\mathrm{\Delta }x`$ given $`\mathrm{\Delta }y`$ and $`\mathrm{\Delta }z`$.

The above equations and their permutations ($`x,y,zy,z,x`$ and $`x,y,zz,x,y`$) are used to determine the values of $`\mathrm{\Delta }x`$, $`\mathrm{\Delta }y`$, and $`\mathrm{\Delta }z`$ which are most likely to be included in the stellar locus, given the input limits on these quantities. Once we have this coordinate in three dimensions, we can ask whether it is within the parameterized locus. We must have $`r^{}1`$, where

$$r^{}=\{\begin{array}{cc}\sqrt{\left(\frac{l}{a_l}\right)^2+\left(\frac{m}{a_m}\right)^2}\hfill & a_l>0,a_m>0\hfill \\ \frac{l}{a_l}\hfill & a_l>0,a_m=0,m=0\hfill \\ 0\hfill & l=m=0\hfill \\ \mathrm{}\hfill & a_l=0,l0\hfill \\ \mathrm{}\hfill & a_m=0,m0\hfill \end{array}$$

The point must also be within the ellipsoids at the ends of the locus. If $`\mathrm{\Delta }k<0`$, then we already know we are within the red end limit, since the locus point is guaranteed to be within the locus. Similarly, if $`\mathrm{\Delta }k>0`$, we are guaranteed to be within the blue end limit. So, we need only check one of the ellipsoids. We ignore the fact that the locus may curve around in $`x,y,z`$ coordinates, and only look at the $`l,m,k`$ coordinates. We are within the ends of the locus if $`k_{blue\mathrm{\_}limit}(l,m)<k<k_{red\mathrm{\_}limit}(l,m)`$, where:

$$k_{blue\mathrm{\_}limit}=k_{blue}a_{kblue}\sqrt{1r_{blue}^{}{}_{}{}^{2}}$$

$$k_{red\mathrm{\_}limit}=k_{red}+a_{kred}\sqrt{1r_{red}^{}{}_{}{}^{2}}.$$

Here, the values of $`r^{}`$ are computed using $`a_l`$ and $`a_m`$ for the end ellipses, but values of $`l`$ and $`m`$ are calculated from the closest locus point.

### B.5 End Conditions

If the previously calculated optimal values of $`\mathrm{\Delta }x,\mathrm{\Delta }y,`$ and $`\mathrm{\Delta }z`$ put us within the locus, then we are done. If we could not find values for the coordinates that made $`r^{}1`$, then we are done. However, if the values failed only the end conditions, then there is a chance we could still put the datapoint in the locus by minimizing the distance to the center of the end ellipsoid:

$$r^{}=\sqrt{\left(\frac{l^{}}{a_l^{}}\right)^2+\left(\frac{m^{}}{a_m^{}}\right)^2+\left(\frac{k^{}k_{end}^{}}{a_k}\right)^2}$$

rather than the center of the cylinder associated with the closest locus point. Here, $`k_{end}`$ is either $`k_{blue}`$ or $`k_{red}`$, depending on whether $`\mathrm{\Delta }k<0`$ or $`\mathrm{\Delta }k>0`$. The primes indicate that the values are measured with respect to the position in color space of the locus point which is closest to the center of the end ellipsoid. The $`a_l`$ and $`a_m`$ widths are for the end ellipsoid, not the cylinder associated with the closest locus point.

We now calculate for the datapoint a new optimal color which minimizes $`r^{}`$. If only $`x`$ is unknown, we compute $`\mathrm{\Delta }z^{}`$ and $`\mathrm{\Delta }y^{}`$ using the definition $`\mathrm{\Delta }\stackrel{}{𝐫}^{}\stackrel{}{𝐫}\stackrel{}{𝐫}_e(\mathrm{\Delta }x^{},\mathrm{\Delta }y^{},\mathrm{\Delta }z^{}),`$ and $`\stackrel{}{𝐫}_e`$ is the position in color space of the locus point closest to the center of the end ellipsoid (subject to $`k_{blue}<k_e<k_{red}`$). The value of $`\mathrm{\Delta }x^{}`$ which minimizes $`r^{}`$ is

$$\mathrm{\Delta }x^{}=\{\begin{array}{cc}\frac{a_{}^{}{}_{m}{}^{2}a_k^2Al_x^{}+a_{}^{}{}_{l}{}^{2}a_k^2Bm_x^{}+a_{}^{}{}_{l}{}^{2}a_{}^{}{}_{m}{}^{2}Ck_x^{}}{a_{}^{}{}_{m}{}^{2}a_k^2l_{}^{}{}_{x}{}^{2}+a_{}^{}{}_{l}{}^{2}a_k^2m_{}^{}{}_{x}{}^{2}+a_{}^{}{}_{l}{}^{2}a_{}^{}{}_{m}{}^{2}k_{}^{}{}_{x}{}^{2}}\hfill & D_10\hfill \\ \frac{a_k^2Al_x^{}+a_{}^{}{}_{l}{}^{2}Ck_x^{}}{a_k^2l_{}^{}{}_{x}{}^{2}+a_{}^{}{}_{l}{}^{2}k_{}^{}{}_{x}{}^{2}}\hfill & D_1=0,a_{}^{}{}_{m}{}^{2}=0,m_x^{}=0,a_{}^{}{}_{l}{}^{2}0\hfill \\ \frac{B}{m_x^{}}\hfill & D_1=0,a_{}^{}{}_{m}{}^{2}=0,m_x^{}0,a_{}^{}{}_{l}{}^{2}0\hfill \\ \frac{a_m^2Al_x^{}+a_{}^{}{}_{l}{}^{2}Bm_x^{}}{a_m^2l_{}^{}{}_{x}{}^{2}+a_{}^{}{}_{l}{}^{2}m_{}^{}{}_{x}{}^{2}}\hfill & D_1=0,a_{}^{}{}_{m}{}^{2}>0\hfill \\ 0\hfill & D_1=0,a_{}^{}{}_{l}{}^{2}=0,m_x^{}=0,k_x^{}1\hfill \\ 0\hfill & D_1=0,l_x^{}=1\hfill \end{array}$$

where $`A=(l_y^{}\mathrm{\Delta }y^{}+l_z^{}\mathrm{\Delta }z^{})`$, $`B=(m_y^{}\mathrm{\Delta }y^{}+m_z^{}\mathrm{\Delta }z^{})`$, $`C=(k_y^{}\mathrm{\Delta }y^{}+k_z^{}\mathrm{\Delta }z^{}k_{end}^{})`$, and $`D_1a_{}^{}{}_{m}{}^{2}a_k^2l_{}^{}{}_{x}{}^{2}+a_{}^{}{}_{l}{}^{2}a_k^2m_{}^{}{}_{x}{}^{2}+a_{}^{}{}_{l}{}^{2}a_{}^{}{}_{m}{}^{2}k_{}^{}{}_{x}{}^{2}`$. The first case is the formal result of the minimization. The second case is for $`a_m^2=0`$ and $`m_x^{}=0`$; in this case we cannot affect the $`m`$ value, so we might as well find the best position within the $`l,k`$ ellipse. If instead we have $`m_x^{}0`$, we instead put the object on the $`m=0`$ plane. If $`D_1=0`$ but $`a_{}^{}{}_{m}{}^{2}>0`$, then we must have $`a_k^2=kx=0`$, since $`a_{}^{}{}_{l}{}^{2}>=a_{}^{}{}_{m}{}^{2}`$. If $`a_{}^{}{}_{l}{}^{2}=0`$, then the object is either on the line of the locus or not, no change in x will give different results than the previous calculated optimal $`x`$. All cases where $`D_1=0`$ and $`l_x^{}=1`$ reduce to $`\mathrm{\Delta }x^{}=0`$, and this sweeps up all of the cases not covered by the other criteria. Again, if this computed value for $`\mathrm{\Delta }x^{}`$ violates a limit in $`x`$, then we reassign $`x`$ to the limit.

If both $`x`$ and $`y`$ are unknown, then we start by calculating the values which minimize $`r^{}`$. We deal with limits in the identical way as we did when we were minimizing $`r^{}`$. That is, we figure out the optimal value of $`x`$ and $`y`$ together, but only assign the $`y`$ value. Then we figure out the optimal value of $`x`$ given that $`y`$ value and the fixed value of $`z`$. This way we can deal with the limits in a sensible way. The optimal value of $`y`$ is given by:

$$\mathrm{\Delta }y^{}=\{\begin{array}{cc}\frac{(k_y^{}k_z^{}a_k^2+m_y^{}m_z^{}a_{}^{}{}_{m}{}^{2}+l_y^{}l_z^{}a_{}^{}{}_{l}{}^{2})\mathrm{\Delta }z^{}(l_x^{}m_z^{}a_{}^{}{}_{m}{}^{2}m_x^{}l_z^{}a_{}^{}{}_{l}{}^{2})k_{end}^{}}{a_k^2k_{}^{}{}_{z}{}^{2}+a_{}^{}{}_{m}{}^{2}m_{}^{}{}_{z}{}^{2}+a_{}^{}{}_{l}{}^{2}l_{}^{}{}_{z}{}^{2}}\hfill & D_2a_k^2k_{}^{}{}_{z}{}^{2}+a_{}^{}{}_{m}{}^{2}m_{}^{}{}_{z}{}^{2}+a_{}^{}{}_{l}{}^{2}l_{}^{}{}_{z}{}^{2}0\hfill \\ k_y^{}k_{end}^{}\hfill & D_2=0\hfill \end{array}.$$

The first option is the formal minimization of $`r^{}`$. If $`k_z^{}=0`$, then the center of the ellipsoid is in the $`x,y`$ plane. Therefore, we try to place the object on that center (or as close as we can get, given that $`\mathrm{\Delta }z^{}`$ might not be zero). If the denominator is zero, then $`a_{}^{}{}_{m}{}^{2}=0`$. This is true because we cannot have $`k_z^{}=1,l_z^{}=0,m_z^{}=0`$ due to the definition of our system. So, either $`a_{}^{}{}_{l}{}^{2}`$ or $`a_{}^{}{}_{m}{}^{2}`$ must be zero. Either way, $`a_{}^{}{}_{m}{}^{2}=0`$. If $`k_z^{}0`$, we must have $`a_{}^{}{}_{k}{}^{2}=0`$ as well. Additionally, either $`a_{}^{}{}_{l}{}^{2}=0`$ (the endpoint is the only hope) or $`l_z^{}=0`$ ($`\widehat{𝐥}`$ is in the $`x,y`$ plane, so the endpoint is still the best choice, if we can get there).

As before, we then adjust $`\mathrm{\Delta }y^{}`$ if it is outside the allowed limits, then use our equations for only $`\mathrm{\Delta }x^{}`$ missing to find the optimal $`x^{}`$. If the computed value of $`x^{}`$ is outside the limits, then we set $`x^{}`$ to the limit, and recompute the optimal value of $`y^{}`$.

We cannot think of a case in which the new position is in the interior side of the endplane at $`k_{end}`$. So, all we have to do is figure out if the new position satisfies $`r_{}^{}{}_{}{}^{}1`$ and is interior to the $`k`$ limits on the outer surface of the ellipsoid. If it is, then it is consistent with being a star, otherwise it is not.