Improving ZTF Photometric Calibrations

Systematics in ZTF Photometry.
Photometric magnitude Bias.
Spatial Systematics
Residual Spatial Structure.
Residuals of the full FoV.
Photometric Field Offsets
Photometric offsets between fields
Determining offsets for all ZTF fields
Colour Dependence
Colour dependence of Residuals
Colour dependence across the FoV.
Frame level systematics
ZTF Flatfield Analysis. (New).
ZTF Overscan Analysis. (New).
Photometric variation with Skylevel.
Systematic effects across the full FoV.
Corrections for g-band frame offsets.
Corrections for r-band frame offsets.
ZTF ghost image artifcats
ZTF charge spillage ghosts..
Background image structure
ZTF image background structure..
Uncertainty systematics
Trends in Photometric Uncertainties.
Data Flagging
ZTF DR1 Data Flagging ZTF DR1.
Summary and Comment.

Systematics in ZTF Photometry

Investigate systematics within ZTF photometry with an aim to improving overall quality for all science objectives.

Preliminary tests (as per the figure below), as well as those presented in the ZSDS documents (and noted in the pipeline paper) showed the presence of a slight (but clear) magnitude bias in ZTF stars calibrated to PS1. It was unclear whether this affected all fields, and whether it varied between quadrants.

ZTF median R-band photometry compared with PS1 mags. Crosses are average values for 0.5 mag bins for two different fields. The solid lines is running mean for each to the two fields.

Use new ZTF DR1 matchfiles to select a large set of photometry for high S/N sources. Existing photometric uncertainty distributions suggest that sources fainter than mag 17.5-18 exhibit scatter in their median mags that is larger than the amplitude of the observed effect (0.01 mags). Additionally, based on the ZTF DR1 analysis above, uncertainties in ZP are significant for fields with with either very low density or very high density. Thus, in order to properly quantify the low level systematics with photometry we should generally select bright sources in moderately dense fields with significant numbers of observations.

Note: this calibration requires matching all the bright ZTF sources to PS1. At the time of this intial analysis I had no access to a full copy of PS1 DR1. Thus it was necessary to limit the sample to a few million in order to uses online matching services containing PS1 DR1, such as CDS XMatch.

For each quadrant and filter, select 10 different fields where there are large number of sources mag < 17.5 having nobs > 20. Combined values of X,Y,ZP,clrcoeff, mag_g and mag_r were extract from each matchfiles (i-band was not included due to the overall lack of data).

Magnitude Bias

The initial results suggested that the bright-end magnitude bias within a field (shown above) is consistent for a given quadrant, but varies between each of the 64 CCD quadrants and filters. This seems most likely a detector gain issue. In discussions with R. Smith, he mentioned that the detector gain had been found to actually be significantly non-linear. There was also suggestions of the so called brighter-fatter effect and other detector-based possibilities.

Fits to the ZTF vs PS1 magnitude bias. Left: The fits to the g-band magnitude bias for each quadrant. Right: Fits to the r-band magnitude bias for each quadrant.

When the photometry was combined the magnitude bias was found to extend to faint magnitudes. So the full photometry data sets were extracted for the selected fields (total 12 million sources). However, at the faint end, the magnitude bias becomes dominated by an Eddington bias. Thus the magnitude bias was only fit for ZTF sources brighter than ~19.25 to avoid this. For each quadrant, quadratic fits were used since the bias was evidently not linear.

To properly calibrate ZTF magnitudes to PS1, all ZTF photometry needs to corrected for the clear magnitude bias.

What is the exact origin of this bias?
Is it safe to assume the fits to bias are OK at magnitudes fainter than 19.25?
Is there a way of verifying this?

Spatial Structure within ZTF Photometry

After correcting for the magnitude bias it was clear that the spatial variations in photometric uncertainty within a quadrant (above) were a reflection of the spatial variations in the photometry.

Corrections for this internal residual structure were underway by the Desy group using starflats. That is, observations where a single field(?) is dithered and photometry of sources are remeasured to determine spatial variations. The combined and binned starflat data is shown above. Since this data is taken in sequence on a single night, very similar observing conditions are expected. Thus the result should be largely free of effects due to changes in observing conditions.

A clear way to check the starflat-based determination of the spatial systematics is to use the photometry itself. The advantage of this data is that there are far larger numbers of measurements can be used in the determination. In principal such a dataset could have hundreds of times the amount of photometry in the starflats. Such a large data set makes it possible to limit the selection to the bright stars that have smaller intrinsic uncertainties than the systematics. So, overall the spatial variations can in principal be better sampled since millions of bright sources can be used to determine the structure within each of the 64 quadrants. However, in contrast to starflats, more careful consideration is needed to address any possible biases due to real variations observing conditions.

Desy Group full Camera FoV G-band systematics from starflat data matched to PS1. Left: the structure found with the starflat analysis Right: the residual structure after correcting with starflats.

Full Camera FoV g-band systematics based on photometry data matched to PS1 (c.f. left figure above). Colours range from ~-0.03 to 0.03 mags.

Comparing the systematics from starflat data and those from combined photometry we see that the general structure of the systematic is this same. However, the structure based on the photometry is smoother and clearer due to the higher S/N of this combined photometry results.

Strong structure is seen on edges (due to reflections and possibly charge transfer issue seen in other data?) and discrete lumps (due to dust?). Full ccd show large features that also visible in the flat fields. Suggesting possible problems with them.

Notably, the borders of the CCD quadrants exhibit discontinuities between quadrants. This is most likely due to gradients spanning the full CCDs. Since the data is calibrated at the quadrant level this introduces an offset at the borders. This suggests that structures spanning full CCDs cannot be fit without correcting this.

The corrected starflat data still exhibits some clear spatial structure that is like hard to remove with with either data set.

Fitting the spatial structure

The extent of the structure within individual quadrants is very significant and most likely due to problems with flatfielding and gain corrections. That is to say, systematic uncertainties in the flatfields are propagated into the data and become apparent when the data is combined. This effect may be increased by the fact that different flatfields are constructed and used each night even when no changes have been made to the telescope setup.

Surface plots of the binned spatial distribution of magnitude residuals wrt PS1 for two quadrants. Left: the residuals for CCD 16, quadrant 1, zg. Right: the residuals for CCD 16, quadrant 4, zr. Z is the magnitude offset and X and Y are the CCD coordinates.

Attempts to automatically model the photometric residual surfaces were undertaken with numerous (~100) different types functional fits. These ultimately failed to produce satisfactory results since the dust artifacts and very strong edge effects produce abrupt deviations that is not well modeled by smooth functional fits. Fitting in multiple steps is also not ideal.

G-band magnitude residuals wrt PS1 before and after correcting for structure with the quadrant. The green is the original binned data and the blue are the residuals after subtracting the spline fit.

Attempts to fit splines to the unbinned data were also unsatisfactory (residuals > 0.005 mags, clear systematic variations and spikes) because the raw data was insufficiently constrained. However, since the wasn't any clear significant structure on scales less than a couple of hundred pixels the binned data was used. If localized structure is actually present (that is not accounted for by flatfields, etc), corrections will require far more photometry (than ten fields) to properly constrain it.

As shown in the figure above, quadratic B-spline fits of high order (440 knots) were used to fit the binned data give good fit residuals (sigma of 0.002) magnitudes without spikes due to poor constraint. Although, care is still required to check the fits on image edges where strong gradients are present.

ZTF magnitude residuals relative to PS1. Left: The residuals from data combine from nine fields within the same band, CCD, quadrant (ccd 5, quadrant 1, g-band). Middle: the spline fit model for the data. Right: the residual after subtracting the spline fit. Colours range from ~-0.03 to 0.03 mags.

The figures above show how well the spline fits represent the actual structure in the binned photometry.

Verifying the spatial structure corrections.

In order to verify that the corrections determined with the original photometry data set work for other fields work for both the selected data and other data in general it is necessary to verify the analysis. To do this, for a few quadrants, I selected an additional set of photometry for 8 fields. This photometry was corrected for the magnitude bias and quadrant structure.

Residuals for fields not in the original calibration. Left: Systematic differences between ZTF and PS1 for g-band photometry in CCD 05 Quadrant 1. Right: Photometry minus the spline fit for the new fields.

The sigma of corrected residuals wrt PS1 (for sources with g < 17.5), for both the original set and the new ones, is ~0.008 mags. This suggests that the same structure is seen in multiple fields with a very similar in amplitude and distribution. That is to say, the result from the combined photometry is not strongly affected by variations in the observing conditions. However, see more analysis below.

Correcting structure across the full ZTF FoV

Initial fits to the structure were poorly constrained on edges where few sources are detected. This is due to significant variations in pointing between the reference frames and the individual observations. To improve this situation the photometry sample was increased by a factor of three (so that each quadrant contained photometry from ~30 fields). The resulting residuals were much more clearly defined (c.f. the figures above). The residuals from the binned residuals spline fits were reduced from two milli-mags to one for many fields. Nevertheless, accurate values of residuals on quadrant edges was still not as good as it could be in many cases. Thus, extra care was taken to fit the individual quadrant values by hand. The edge bins with few points were further constrained by adding additional faint sources and by interpolating the values from neighbouring bins.

The g and r-band ZTF magnitude residuals wrt PS1 based on combining the photometry from ~30 well sampled fields in each quadrant.

With the higher S/N of the new combined data some evidence of a large ring is seen that is due to the focal plane pattern. This is what was initially expected from the starflat analysis since it is seen in the DES analysis (Berstein et al. 2018, PASP, 130, Figure 2).

Since rainbow colour maps can exaggerate the presence of structure, additional greyscale images of the same data are given below. However, the variations at the edges of adjacent quadrant becomes less clear in the grayscale images since these differences are slight.

The g and r-band magnitudes residuals wrt PS1. As above but with a continous grayscale colour map to show.

The structure within g and r-bands is very similar with only slight differences in residual amplitude and a few dust spots. This suggests that most of the dust spots are not on the filters, but other optics.

The g and r band magnitudes residuals after subtracting the spline fits to each quadrant.

After fitting the spatial structure in each quadrant and subtracting it, the residual photometric structure is given above. The g-band data has more significant residuals at the top and bottom of quadrants than r-band due to the higher amplitude of differences compared to PS1 data. The amplitude of the residuals of the left and right edges of CCDs and similar in each band.

After applying the corrections to ~3 million sources with 14 < mag < 16.5 from across the full FoV we find residuals of ~7 milli-mags. Thus, overall the uncertainties are generally expected to be less than 1 percent.

The corrected data does exhibit extended tails (compared to a Gaussian fit) due to the remaining edge effects. Hence objects falling near edges will generally be more uncertain. The same edge structure is seen in DES skyflat subtracted residuals. We note that few objects are expect on the edges since such sources were clearly absent from the data.

The residuals for ZTF g-band wrt PS1. Black histogram original ZTF photometry calibrated to PS1 for ~3 million source with 14.0 < g < 16.5 . Blue, the histogram after applying the magnitude corrections. Red, the result after applying magntiude and structure corrections.

The ZTF data exhibits significant structure within CCD quadrants that can cause offsets of up to ~0.04 mags on the edges and at the locations of large dust spots. These features can be corrected to a high degree of accurary. Correcting for these features by fitting the structure brings the photometry into agreement with PS1 to better than 1%.

Systematic offsets between fields

Binned differences between the ZTF g-band and PS1. The black line is the original calibrated data. The blue line is corrected for the magnitude dependence. The red line is corrected for the spatial structure. The green line is after systematic offsets between each field and PS1 are removed.

After correcting for the magnitude dependence and the spatial dependence (as noted above), it became clear that the resulting residuals were not exactly centered on zero. As shown above there was a slight offset (~0.002 mags, red line).

Binned differences between ZTF and PS1 mags for corrected individual fields and bright (g < 17.5) sources.

Closer inspection of the individual fields showed systematic offsets wrt to PS1. This is offset was found to be up to 0.005 mags. Correcting each of the input fields for this offset further reduces the final observed scatter for the corrected photometry.

The sigma of the resulting residuals wrt PS1 (for sources with g < 17.5), after the magnitude and spatial corrections and field offset is ~0.007 mags (c.f. 0.008 without).

Determining systematic offsets for all ZTF fields

To correct for systematic offsets between ZTF and PS1 we obtained photometry for all ~300 million ZTF bright (mag < 18) stars. These data were matched with full PS1 DR1 combined catalog. The ZTF photometry was first corrected for the quadrant level magnitude biases and the median calibration colour coefficents required to match ZTF to PS1. Finally, the offsets between ZTF median mags and PS1 combined mags were calculated for every quadrant in every ZTF field with data.

A histogram g and r-band ZTF magnitude offsets wrt PS1 g and r-band mags on a per quadrant basis. The blue histogram gives the g-band offset mag distribution. The red lines gives the r-band offset mag distribution.

Overall we find that the g-band data exhibits larger offsets than the r-band data. This may simply be reflective of the fact that the residuals are larger in g-band data (as noted above). The field offset distributions have sigificant tails due to some regions having large offsets.

The observed distribution of offsets between g and r-band ZTF magnitude and PS1 for all (regular grid) ZTF field. The left plot gives the g-band offsets and the right gives the r-band offsets. The colour limits of the plot are approximates +/- 0.02 magnitudes. White regions have no offset values as the quadrant photometry is missing from the ZTF data.

The observed plots of photometric offsets compared to PS1 show some significant systematics. These are particularly evident in the Galactic plane. This is most likely linked to crowding effects. The g-band data shows some larger offsets in sparse fields away from Galactic plane. This is probably due to poorer calibration due to a lack of calibrators (as mentioned below). A few isolated groups of quadrants that are far from the Galactic center also show large offsets in both g and r-band (for example near RA=100 deg, Dec=0 deg).

Many ZTF fields show significant offsets at the quadrant level when compared to PS1. The main source is likely to be the number of sources within a field. Too few sources lead to poor calibatration (see below). Too many lead to crowding effects due to difference in the observed resolution. Both PS1 and ZTF likely suffer from this to a different extent.

The colour dependence of photometric residuals

During discussions of correcting the residual structure using photometry or starflats there was mention of the possible colour dependence of the structure. To quantify this more clearly I compared the residuals wrt PS1 in g-band with those in r-band.

The difference between ZTF g and r-band residuals compared to PS1 (CCD 5, quadrant 1).

This figure shows that the structure within a quadrant varies significantly between g and r bands. This figure relates to the same quadrant shown above. Based on the structure within that data we see that the difference between g and r is very likely not simply an offset or scaling between the two bands.

A difference in the g and r-band residual structure implies that there is some spatial variation in the colour response (in addition to possible local differences such as dust spots on filters).

Colour dependence across the full FoV

With the large sample of ZTF photometry used to determine the spatial structure, we investigate the differences between the structure in the g and r-band observations.

Comparison of g and r-band residuals. The red line has slope 1.37 corresponding the average ratio of g to r-band residuals.

Comparing the values in each of the g and r bins we see the the g-band residual structure is approximately 37% larger than the r-band structure. Notably the bulk of the residuals are not centered on zero, but near 0.005 mags in g and r.

The difference in structure between g and r-band data. The left plot is the residuals in g minus those in r, and the the right plot the same but with the r band scale by a factor on 1.37 to account for the amplitude difference.

If we subtract the binned r-band values from those in g we see that that the vertical lines on the edges of CCDs largely disappear, while the dust dot-like features remain. This suggests that the edge effects themselves are not wavelength dependent while the affect of the dust spots is.

To confirm this we multiple the r-band structure by 1.37 (to account for the difference in average offset amplitude) and subtract this from the g-band data we that the dust spot disappear. This suggests that the dust spots follow the same trend as the overall amplitude difference (i.e. they have the same dependency). However, large structures that are centered on each CCD remain. This suggests that the residuals cannot be account for by purely scaling the results between bands. The central and outer circular features of the focal plane become clearer in these figures.

The source of this colour dependence of the observed photometric offsets is most likely variations in sensitivity that are not being taken into account by the flatfields. The lack of clear trend covering the whole focal plane suggests that differences in the offsets between g and r-band are not due to large scale problems, such as non-uniformity of the filters (i.e. filters coatings not going to the edge). However, this may still be present at a low level.

The lines along the edges of CCDs have equal amplitude in g and r-band suggesting that the effect is not wavelength dependent. This suggest the affect originates from behind the filter. In contrast, most of the dust spots exhibit the same scaling as the general background structure and do not vary between filter. The dots are thus generally not located on the filters. A small number of out-of-focus rings are seen in only one filter suggesting these are on the filter itself.

Whatever the cause of the colour dependencies, corrections are required for both g and r separately. Some consideration of how these offsets affect objects of varying colours differently is worthwhile. This effect is equally important regardless of whether starflats or combined photometry is used for spatial corrections.