# Algorithms: Image masks

We have defined a special set of imaging masks intended to define those areas in the imaging survey which one may wish to exclude from scientific analysis for a number of reasons. These masks are not themselves a complete description of the window function, which can be found in the sdssPolygons table generated in the resolve process. These also differ from thephoto imaging mask in thefpM files. Finally, they also differ from large scale structure masks used in the spectroscopic large scale structure samples. There are 5 different mask types.

Type
Meaning
0
BLEEDING
1
BRIGHT_STAR
2
TRAIL
3
HOLE
4
SEEING

These masks thus allow one to identify and exclude bright stars and their associated bleeding columns, trails caused by meteors and satellites, a small number of survey "holes" which have unacceptable data, as well as regions with bad seeing. These masks may of course be used in any science analysis to check the effects of excluding/including potentially problematic survey areas, but are likely to be most relevant and useful for studies of large-scale structure. Note that the masks are in the form of convex polygons, and they are generated separately for each of the 5 filters of each survey field. The masks are also solely contained within the PRIMARY survey area. Finally, for those photometric objects inside a BLEEDING, BRIGHT_STAR, HOLE or TRAIL mask, or an area of bad seeing (> 1.7 arcsec), they haveinsideMask set to a nonzero value.

## Accessing the special imaging masks

Within CAS, to identify individual SDSS photometric objects inside a mask, one can check the insideMask value in photoObjAll and its views. For objects inside a BLEEDING, BRIGHT_STAR, HOLE or TRAIL mask, or an area of bad seeing (> 1.7 arcsec), they haveinsideMask set to a nonzero value. The maskedObject table provides a one-to-many link from photometric objects to masks. The masks themselves are described in CAS by the mask table. This table contains a central location and bounding circle, as well as a long string describing the vertices of the convex polygon describing the mask.

There are flat file versions of the mask described in the data model. These have the same information as in the mask table, broken out into one file per photometric field.

## BLEEDING and BRIGHT_STAR masks

These masks are intended to define those imaging areas covered by large saturated stars (approximate radius >= 1 arcmin), with significant bleeding columns, which are expected to cause problems in photometry, target selection, etc. The masks are based on the original masks contained in the fpM files generated by the frames pipeline. Specifically, the fpM files contain masks of saturated pixels as well as masks of detected objects. We look for those saturated pixel masks which overlap with a corresponding detected object mask, but consider only those cases in which the object mask has an approximate radius >= 1 arcmin, so that we are picking out primarily large saturated stars. The radius is approximate, as it's defined simply as the maximum among the distances between the object mask vertices and the unweighted object mask centroid. We also make a further cut that the length of the saturated pixel mask should be at least half the length of the object mask, so that we are selecting those objects with significant bleeding columns. The final BLEEDING column mask used corresponds to the original fpM saturated pixel mask, while the BRIGHT_STAR mask corresponds to the original fpM object mask.

## TRAIL masks

These masks are intended to define those imaging areas covered by trails caused by meteors, satellites, and the like. We start with the detected object masks in the fpM files, and then apply a number of simple criteria to select objects which are long and thin. We first construct a rectangular bounding box around the object mask and check that its diagonal extends over a significant fraction of a field, specifically that the diagonal is > 1361/2 pixels (= 4.5 arcmin), i.e., over half the row extent of a single CCD field. Then we check that the mask is thin, specifically if either the ratio of the long to short side of the bounding rectangle is > 3, or the fraction of the bounding rectangle actually filled by mask pixels is < 0.33. Finally we verify that the object mask doesn't already correspond to a BRIGHT_STAR mask, so that long bleeding columns are excluded. The final TRAIL masks correspond to those fpM object masks which pass these criteria. Note that the above criteria for defining TRAIL masks are somewhat arbitrary and will not be perfect in catching all trails in the imaging data. The precise criteria used may also be further refined in the future. Nonetheless, these TRAIL masks may be used to assess if removing obvious trails in the data would significantly impact a particular science analysis.

## HOLE masks

These masks denote holes in the survey and indicate fields where the data quality is unacceptable, so that the imaging data there should not be used. Fields may be set to hole for a number of reasons, including problems with non-photometricity or with astrometry, as well as software processing problems such as photo frames timeouts, most often caused by the presence of very bright stars in a field.

## SEEING masks

These masks contain a measure of the seeing as a function of position in the survey. SEEING masks are made for each filter in each survey field, or more precisely, on a nominal 3 by 5 subgrid for each CCD field (3 along the scan direction, 5 perpendicular to the scan). Each SEEING mask is thus nominally 1361/3 pixels by 2048/5 pixels, or 3.0 arcmin by 2.7 arcmin, but may be smaller in area once the PRIMARY survey area cuts are applied. We use the psField files to reconstruct the PSF for the appropriate filter, at each of the 3 by 5 subgrid positions in each CCD field. The seeing value, or PSF width, is then determined from

  seeing = 0.663 * 0.400 * sqrt(neff)  arcsec

where neff is the effective area of the PSF, as given by neff = (sum I)^2/sum(I^2), where the sums are over the counts I of the PSF. One may then choose to define a desired threshold for bad seeing, and use the SEEING masks to exclude survey regions that fail the seeing cut. Of course the bad seeing threshold may be varied to assess the effect of the threshold value on the particular science analysis at hand. An example would be to see how a particular large-scale structure statistic is affected by the precise choice of the bad seeing threshold.