(chap:06)=
# Detectors, clocks, and event tables
:::{admonition} Chapter opening
:class: chapter-opening
Intensity interferometry and photon statistics eventually reduce to the same raw material: a sequence of event records. Each event is both a photon candidate accepted by a detector and a measurement shaped by quantum efficiency, optical throughput, electronic readout, and the clock system. The more completely the time stamp, channel labels, and quality flags are preserved, the more freedom one has later to rebin the data, select a passband, redo delay corrections, or project the same observations into a light curve, a power spectrum, a correlation function, or a pulse time of arrival. AquEYE/Iqueye, VERITAS-SII, MAGIC-SII, MKID instruments, and modern TCSPC/White Rabbit systems all point to the same lesson: the time scale, efficiency factors, and noise terms in a correlation function are set by the detectors, electronics, and clocks {cite:p}`2009JMOp...56..261B,2009A&A...508..531N,2015SPIE.9504E..0CZ,2020NatAs...4.1164A,2024MNRAS.529.4387A,2013PASP..125.1348M,2018PASP..130f5001M,2020RScI...91a3108W`.
:::

## How an event table preserves physical information

Equation {eq}`eq:event-row` in Chapter {ref}`chap:01` gave the minimal event row used throughout this book, and Chapter {ref}`chap:02` described which joint probabilities are lost when that row is marginalized into an image, a spectrum, or a light curve. At the instrumental level, a telescope camera can output an image or an event table. An image accumulates photons into pixels over an exposure. An event table keeps the time, detector channel, telescope index, wavelength or filter, polarization channel, weight, and quality flag for every triggered event. For ordinary photometry these two descriptions may be equivalent. For nanosecond-to-picosecond timing, second-order correlations, pulsar folding, or rapid occultations, early accumulation discards information. Iqueye was designed to time tag every photon and then choose offline any time bin from 24.41 ps to minutes. Its observation of $\zeta$ Ori produced about $2\times 10^{10}$ photon events and roughly 78 GB of data, which is already the scale of an event-table data product from a real telescope {cite:p}`2009A&A...508..531N,2019CoSka..49...85Z`.

A raw event can be written as 

```{math}
:label: eq:ch06-raw-event
\mathcal{E}^{\rm raw}_q =
  \left(n_q,\ a_q,\ d_q,\ c_q,\ p_q,\ f_q,\ w_q\right),
  \qquad
  t^{\rm raw}_q=t_0+n_q\,\delta t+\epsilon_{\rm roll}.
```

 The index $q$ labels the event. $n_q$ is the integer clock tick reported by the electronics. The tick size $\delta t$ is measured in seconds. Modern time digitizers can sample at $10^{-11}$--$10^{-10}\,\mathrm{s}$, commercial multichannel TCSPC systems can have an 80 ps basic timing resolution, and the Iqueye TDC quantization step was 24.41 ps {cite:p}`2009A&A...508..531N,2020RScI...91a3108W`. The label $a_q$ identifies the telescope or station, $d_q$ the detector, $c_q$ the wavelength channel or filter, $p_q$ the polarization channel, $f_q$ the quality flag, and $w_q$ the event weight. Counter rollovers, packet loss, saturation, clouds, and pointing problems should all appear in $f_q$; otherwise an anomalous peak in a later correlation function can be very hard to trace.



```{figure} ../_static/figures/generated/chapter_06/ch06_event_table_schema.png
:name: fig:ch06-event-table-schema
:width: 96.0%

Event data flow from raw electronic records to calibrated event tables and then to correlation products. The raw layer stores counter times, channel identifiers, and rollover flags. The calibrated layer maps times onto a common time scale and adds telescope, wavelength, polarization, and weight metadata. Only the product layer stores baselines, delay bins, correlation amplitudes, and noise estimates. If the first layer is reduced to a light curve, later clock, wavelength, and polarization selections cannot be repeated.
```



The calibrated event table turns a hardware counter into a comparable physical time: 

```{math}
:label: eq:ch06-calibrated-time
t^{\rm cal}_q =
  t^{\rm raw}_q
  +\Delta_{\rm clk}(t_q)
  +\Delta_{\rm elec}(a_q,d_q)
  +\Delta_{\rm det}(\lambda_q,d_q)
  -\frac{\mathbf{r}_{a_q}(t_q)\cdot\hat{\mathbf{s}}}{c}.
```

 $\Delta_{\rm clk}$ is the offset of the station clock relative to the adopted time scale. It is measured in seconds. Over short intervals it may be tens of picoseconds to nanoseconds; when nights are combined it also includes transformations among GPS, TAI, UTC, TT, and TDB. $\Delta_{\rm elec}$ is the fixed or slowly drifting delay from cables, amplifiers, discriminators, and ADC/TDC channels. In the laboratory it is usually calibrated with a pulsed source or loopback link to picosecond or sub-nanosecond precision. $\Delta_{\rm det}$ is the detector-internal delay, which can depend on wavelength, bias voltage, temperature, and pulse height. In SNSPDs, the detection delay can even vary with photon energy {cite:p}`2020NaPho..14..250K,2020Optic...7.1649R`. The last term is the geometric delay. $\mathbf{r}_{a_q}$ is the station position relative to the reference point, $\hat{\mathbf{s}}$ is the source direction, and $c$ is the speed of light. A 100 m baseline gives a maximum geometric delay of about 333 ns; a 1 km baseline gives about $3.3\,\mu\mathrm{s}$. Both are far larger than picosecond detector jitter.

The data rate is set by the event rate and the number of bytes carried by each event: 

```{math}
:label: eq:ch06-data-rate
\dot{M}
  \simeq
  N_{\rm tel}\,N_{\rm ch}\,R_{\rm evt}\,N_{\rm byte}.
```

 $\dot M$ is measured in byte s$^{-1}$. If $N_{\rm tel}=4$, each telescope has $N_{\rm ch}=8$ independent channels, each channel records $R_{\rm evt}=10^6\,\mathrm{s^{-1}}$, and each event occupies $N_{\rm byte}=16$ byte, then $\dot M\simeq512\,\mathrm{MB\,s^{-1}}$. Continuous waveform sampling can be heavier. VERITAS-SII continuously digitized the PMT signal from each telescope at 250 MS/s, corresponding to about 250 MB/s per telescope and tens of TB for an observing campaign {cite:p}`2020NatAs...4.1164A`. Event tables, waveform streams, and real-time correlators can coexist. They differ mainly in where compression, selection, and correlation are performed along the data path.

## How detectors turn photons into electronic events

The first job of a detector is to turn an incident photon into an electronic signal. The mean detected rate in one channel can be written as 

```{math}
:label: eq:ch06-detected-rate
R_{\rm det}
  =
  A_{\rm eff}
  \int_{\lambda_1}^{\lambda_2}
  F_\lambda(\lambda)\,
  T_{\rm opt}(\lambda)\,
  \eta_{\rm det}(\lambda)\,
  d\lambda
  +R_{\rm sky}+R_{\rm dark}.
```

 $A_{\rm eff}$ is the effective collecting area in m$^2$. $F_\lambda$ is the source photon spectral flux density, in photons s$^{-1}$ m$^{-2}$ nm$^{-1}$. $T_{\rm opt}$ is the total throughput of mirrors, filters, fibers, collimators, and windows. $\eta_{\rm det}$ is the detector quantum efficiency. $R_{\rm sky}$ is the count rate from sky background and stray light, and $R_{\rm dark}$ is the dark-count rate. The signal-to-noise ratio in intensity interferometry is set by the stellar photon rate and by the background-diluted intensity fluctuations. MAGIC-SII uses the PMT DC current to estimate photon flux and corrects night-sky light with background pixels. VERITAS-SII estimates the background from off-source measurements and multiplies the correlation amplitude back by the stellar-light fraction {cite:p}`2020NatAs...4.1164A,2024MNRAS.529.4387A`.

PMTs are the traditional detectors for intensity interferometry. Their strengths are large active area, high gain, nanosecond-scale pulses, and compatibility with the fast electronics of large atmospheric Cherenkov telescopes. A typical blue quantum efficiency is $20\%$--$40\%$. The PMTs used by VERITAS-SII at 416 nm had a quantum efficiency of about $30\%$, and the MAGIC-SII camera PMTs also have high quantum efficiency in the Cherenkov band {cite:p}`2020NatAs...4.1164A,2024MNRAS.529.4387A`. PMT dark current and gain depend on high voltage, temperature, integrated charge, and bright-light exposure history, so DC monitoring and repeated gain calibration belong in the normal observing procedure.

A SPAD records the avalanche pulse produced after a single photon is absorbed. AquEYE/Iqueye used SPADs and a pupil-splitting optical design to send the incoming light into several diodes, reducing the dead-time burden on each device. Visible-light SPADs can reach quantum efficiencies of $50\%$--$60\%$, single-photon timing resolutions of 30--50 ps, dark-count rates commonly in the 10--100 s$^{-1}$ range, and linear count rates of order MHz per diode. Their drawbacks are small active area, relatively long dead time, and afterpulsing, which produces instrumental features in short-delay correlation functions {cite:p}`1996ApOpt..35.1956C,2009JMOp...56..261B,2009A&A...508..531N,2015SPIE.9504E..0CZ`.

An SNSPD uses the resistive pulse created by a local hot spot in a superconducting nanowire. Its advantages are low dark counts, high near-infrared efficiency, and timing jitter that can reach a few picoseconds. Reported systems have shown $2.7\pm0.2$ ps jitter at 400 nm and $4.6\pm0.2$ ps at 1550 nm, as well as system detection efficiencies above $90\%$ near 1550 nm {cite:p}`2012SuScT..25f3001N,2020NaPho..14..250K,2020Optic...7.1649R`. The costs are cryogenics, fiber coupling, pixel count, and dynamic range. A telescope using SNSPDs must design the detector, cryogenic system, timing chain, and scalable array readout as one instrument.

MKIDs record both photon arrival time and photon energy. A photon breaks Cooper pairs in a superconducting film; the phase pulse of the resonator carries an estimate of the photon energy. Each event can therefore include a wavelength estimate. The processed ARCONS photon list contains time stamp, sky position, wavelength, and quality flags. Its typical spectral resolution was $R\sim8-10$, its timing accuracy was about $2\,\mu\mathrm{s}$, and the ARCONS array had 2024 pixels. DARKNESS advanced the format to an $80\times125$ pixel array operating at 0.8--1.4 $\mu\mathrm{m}$ {cite:p}`2013PASP..125.1348M,2018PASP..130f5001M`. MKIDs are not direct replacements for PMTs or SPADs in nanosecond intensity interferometry, but they show how naturally an event table can carry an energy coordinate.



```{figure} ../_static/figures/generated/chapter_06/ch06_detector_trade_space.png
:name: fig:ch06-detector-trade-space
:width: 70.0%

Typical operating regions for four single-photon detector technologies. The horizontal axis is single-event timing jitter, the vertical axis is a representative dark or background count rate per pixel, and the point area represents a typical quantum efficiency. PMTs are well suited to large apertures, high photon rates, and nanosecond intensity interferometry. SPADs provide tens-of-picoseconds timing but are limited by active area and dead time. SNSPDs have the strongest combination of low dark counts and picosecond timing, but require cryogenic systems. MKIDs trade timing resolution for photon-energy information and array format.
```



Efficiency decides how many photons enter the event table. Dead time and the temporal response decide whether the spacing between recorded events still faithfully represents the incident light field. A nonparalyzable dead-time model gives 

```{math}
:label: eq:ch06-nonparalyzable
R_{\rm obs}=\frac{R_{\rm in}}{1+R_{\rm in}\tau_d},
```

 while a paralyzable model gives 

```{math}
:label: eq:ch06-paralyzable
R_{\rm obs}=R_{\rm in}\exp(-R_{\rm in}\tau_d).
```

 $R_{\rm in}$ and $R_{\rm obs}$ are both measured in s$^{-1}$, and $\tau_d$ is the dead time in seconds. For $\tau_d=20\,\mathrm{ns}$, the nonparalyzable model already underestimates the incident rate by about $17\%$ at $R_{\rm in}=10^7\,\mathrm{s^{-1}}$. At $R_{\rm in}=10^8\,\mathrm{s^{-1}}$, the observed rate is close to saturation. SPAD dead times are often tens to hundreds of ns, MKID recovery times can be of order $100\,\mu\mathrm{s}$, and modern TCSPC electronics can reduce the channel dead time to 650 ps. In practice, detector pulse width and front-end electronics still limit the usable high-flux regime {cite:p}`2009A&A...508..531N,2013PASP..125.1348M,2020RScI...91a3108W`.



```{figure} ../_static/figures/generated/chapter_06/ch06_deadtime_saturation.png
:name: fig:ch06-deadtime-saturation
:width: 70.0%

Recorded count rate departs from the ideal linear relation as the incident count rate rises. The nonparalyzable model approaches saturation, whereas the paralyzable model decreases at very high flux. The curves use <span class="math inline"><em>τ</em><sub><em>d</em></sub> = 20 ns</span>, a representative scale for fast single-photon channels. A real instrument must measure both <span class="math inline"><em>τ</em><sub><em>d</em></sub></span> and the model type with a pulsed or stable optical source.
```



Afterpulsing is another short-delay contaminant. In avalanche devices, trapped carriers can be released after the main pulse and create secondary events that are unrelated to astrophysical photons. If each true event produces an afterpulse with probability $\epsilon_{\rm ap}$, and if the afterpulse delays follow the normalized kernel $k_{\rm ap}(\tau)$, the extra event rate can be written as 

```{math}
:label: eq:ch06-afterpulse
R_{\rm ap}(\tau)=\epsilon_{\rm ap}\,R_{\rm det}\,k_{\rm ap}(\tau),
  \qquad
  \int_0^\infty k_{\rm ap}(\tau)\,d\tau=1.
```

 $\epsilon_{\rm ap}$ is dimensionless and often lies between $10^{-4}$ and $10^{-2}$, depending on the device and gating scheme. The characteristic time scale of $k_{\rm ap}$ can run from ns to $\mu\mathrm{s}$. The autocorrelation of a single detector shows afterpulse peaks directly. The cross-correlation of two independent detectors strongly suppresses them. HBT splitting and multichannel cross-correlation therefore do two things at once: they increase the tolerable count rate and reduce same-channel dead-time and afterpulse contamination {cite:p}`1957RSPSA.242..300B,1996ApOpt..35.1956C,2020RScI...91a3108W`.

Timing jitter convolves a true correlation peak into a broader observed peak. If the two channels have temporal response functions $h_1(t)$ and $h_2(t)$, the observed second-order correlation excess is approximately 

```{math}
:label: eq:ch06-response-convolution
C^{\rm obs}_{12}(\tau)
  =
  \int C^{\rm sky}_{12}(\tau')\,
  h_{12}(\tau-\tau')\,d\tau',
  \qquad
  h_{12}=h_1*h_2.
```

 $C_{12}=g^{(2)}_{12}-1$ is dimensionless, while $\tau$ and $\tau'$ are measured in seconds. If the response functions are approximately Gaussian, then 

```{math}
:label: eq:ch06-jitter-budget
\sigma_{\rm obs}^2
  \simeq
  \sigma_{\rm sky}^2+\sigma_1^2+\sigma_2^2+\sigma_{\rm opt}^2+\sigma_{\rm clk}^2 .
```

 $\sigma_{\rm sky}$ is the source coherence time or pulse width; $\sigma_1$ and $\sigma_2$ are detector and electronic rms jitters; $\sigma_{\rm opt}$ is broadening from optical paths and mirror isochronicity; and $\sigma_{\rm clk}$ is the residual clock mismatch between the two stations. The Davies-Cotton mirrors and PMT pulse widths in VERITAS make the intensity correlation peak well described by a Gaussian with $\sigma_\tau\simeq4\,\mathrm{ns}$. MAGIC-SII correlation peaks have a Gaussian width near $2.2\,\mathrm{ns}$, and their autocorrelations are used to monitor the long-term stability of the electronic bandwidth {cite:p}`2020NatAs...4.1164A,2024MNRAS.529.4387A`.



```{figure} ../_static/figures/generated/chapter_06/ch06_detector_timing_response.png
:name: fig:ch06-detector-timing-response
:width: 70.0%

Finite timing response broadens a narrow correlation peak and reduces its height. The curves keep the peak area approximately fixed while changing the rms timing jitter <span class="math inline"><em>σ</em><sub><em>t</em></sub></span>. When the true coherence time is much shorter than the nanosecond electronic response, the measured peak width is mostly instrumental and the peak height is diluted by the broadening factor. This is why intensity interferometry depends on high electronic bandwidth and a stable response function.
```



## Clocks, geometric delays, and absolute time scales

Event tables from two telescopes can be correlated only after they have been put on a common time axis. Short-baseline intensity interferometry mainly requires a stable relative delay. Pulsar timing, rapid transients, and multi-night combination also require absolute time traceable to standard time scales. AquEYE/Iqueye used a rubidium clock and GPS PPS to reach about 100 ps rms in relative timing and better than $0.5\,\mathrm{ns}$ absolute UTC accuracy. Modern multichannel time taggers can connect to White Rabbit fiber networks; a 5 km fiber-link test found a synchronization contribution of about 39 ps {cite:p}`2009A&A...508..531N,2015SPIE.9504E..0CZ,2013NIMPA.725..187J,2020RScI...91a3108W`.

For a station pair $a,b$, the geometric delay is 

```{math}
:label: eq:ch06-geometric-delay
\Delta t_{\rm geo}(t)
  =
  \frac{\mathbf{B}_{ab}(t)\cdot\hat{\mathbf{s}}}{c},
  \qquad
  \mathbf{B}_{ab}=\mathbf{r}_b-\mathbf{r}_a .
```

 $\mathbf{B}_{ab}$ is measured in meters, $\hat{\mathbf{s}}$ is dimensionless, and $\Delta t_{\rm geo}$ is measured in seconds. Earth rotation changes the projected baseline, so $\Delta t_{\rm geo}$ drifts with time. A 100 m baseline near zenith has a delay drift rate of order $\Omega_\oplus B/c\sim2.4\times10^{-11}\,\mathrm{s\,s^{-1}}$, or tens of picoseconds over 17 minutes. For kilometer baselines or picosecond-wide correlation peaks, this drift cannot be absorbed into a single constant delay. VERITAS-SII shifts the time lag in each correlation frame to correct the geometric path. MAGIC-SII applies a variable time-delay correction after Pearson correlation {cite:p}`2020NatAs...4.1164A,2024MNRAS.529.4387A`.

To fold events at pulsar phase, or to compare photon arrival times across wavelengths and messengers, station times must also be transformed to the Solar System barycenter. Conceptually, 

```{math}
:label: eq:ch06-barycentric-time
t_{\rm SSB}
  =
  t_{\rm site}
  +\Delta_{\rm C}
  +\Delta_{\rm R}
  +\Delta_{\rm E}
  +\Delta_{\rm S}
  +\Delta_{\rm A}.
```

 $\Delta_{\rm C}$ is the correction from the local clock to the adopted atomic and coordinate time scales, including UTC-to-TAI, TT, TDB, or TCB conversions and leap seconds. $\Delta_{\rm R}$ is the Roemer light-travel term; Earth's orbit gives a projection term as large as about $\pm500\,\mathrm{s}$. $\Delta_{\rm E}$ is the Einstein delay from gravitational potential and clock rate, $\Delta_{\rm S}$ is the Shapiro delay from Solar-System bodies, and $\Delta_{\rm A}$ is the atmospheric propagation delay. Tempo2 implements these terms at ns accuracy. barycorrpy and Astropy provide Python workflows for time scale conversion and barycentric velocity or time corrections {cite:p}`2006MNRAS.369..655H,2006MNRAS.372.1549E,2018RNAAS...2....4K,2013A&A...558A..33A,2018AJ....156..123A`.



```{figure} ../_static/figures/generated/chapter_06/ch06_time_budget.png
:name: fig:ch06-time-budget
:width: 82.0%

A single event table contains timing terms that range from picoseconds to nanoseconds, microseconds, and hundreds of seconds. Detector jitter and White Rabbit residuals decide whether a correlation peak stays narrow. Electronic and mirror responses set the nanosecond peak width in intensity interferometry. Geometric delay is set by baseline length and source direction. Solar-System barycentric corrections do not broaden a same-night intensity-correlation peak, but they are essential for pulsar phase, multi-night combination, and multi-messenger timing comparisons.
```



## Spectral channels, polarization channels, and coherence time

Narrow-band filters, dichroics, fiber spectrographs, and MKIDs all add frequency information to the event table. The central wavelength $\lambda$, width $\Delta\lambda$, and profile $S(\lambda)$ of a spectral channel determine the coherence time. For an approximately rectangular channel, 

```{math}
:label: eq:ch06-coherence-time
\tau_c
  \simeq
  \frac{1}{\Delta\nu}
  \simeq
  \frac{\lambda^2}{c\,\Delta\lambda}
  =
  \frac{R\,\lambda}{c},
  \qquad
  R=\frac{\lambda}{\Delta\lambda}.
```

 $\tau_c$ is measured in seconds. At $\lambda=500\,\mathrm{nm}$, $R=100$ gives $\tau_c\simeq0.17\,\mathrm{ps}$, $R=10^4$ gives $\tau_c\simeq17\,\mathrm{ps}$, and $R=10^5$ gives $\tau_c\simeq170\,\mathrm{ps}$. These times are still shorter than the nanosecond response of most PMT/electronic chains, so the observed correlation width is usually instrumental, while the peak height carries the ratio of electronic bandwidth to optical bandwidth. VERITAS used a filter centered at 416 nm with an effective width of 13 nm. MAGIC used a 425 nm, 26 nm interference filter, though the actual passband is modified by incidence angles in the fast beam {cite:p}`2020NatAs...4.1164A,2024MNRAS.529.4387A,1974iiia.book.....H`.



```{figure} ../_static/figures/generated/chapter_06/ch06_spectral_resolution_coherence.png
:name: fig:ch06-spectral-resolution-coherence
:width: 92.0%

Order-of-magnitude relation between spectral resolution and coherence time. The left panel fixes <span class="math inline"><em>λ</em> = 500 nm</span> and shows the linear increase <span class="math inline"><em>τ</em><sub><em>c</em></sub> ≃ <em>R</em><em>λ</em>/<em>c</em></span>. The right panel shows that the photon rate in one channel falls roughly as <span class="math inline">1/<em>R</em></span>, while the coherence time grows as <span class="math inline"><em>R</em></span>. In the ideal intensity-interferometry signal-to-noise ratio these dependencies partly cancel, but real instruments are also limited by filter profiles, detector response, background, and electronic bandwidth.
```



Spectral resolution therefore brings a trade-off. Increasing $R$ lengthens $\tau_c$, but reduces the photon rate in each channel. To keep the total throughput, one must read out more wavelength channels in parallel. Multichannel TCSPC systems can treat different wavelength channels as independent inputs and write one time-ordered stream. MAGIC and VERITAS SII systems instead use a small number of broad filters to retain high photon rate {cite:p}`2020RScI...91a3108W,2020NatAs...4.1164A,2024MNRAS.529.4387A`. For stellar diameter measurements, the broad channel is usually best. For emission lines, absorption lines, rapid rotators, or wind structures, wavelength-resolved correlations can directly measure how spatial information changes with velocity.

Polarization channels record projections of the electric-field direction. If an instrument separates two orthogonal linear polarizations $H$ and $V$, the simplest count-rate estimates are 

```{math}
:label: eq:ch06-stokes-hv
I=R_H+R_V,\qquad Q=R_H-R_V .
```

 With $45^\circ/135^\circ$ and left/right circular channels, one can also estimate $U$ and $V$. Here $R_p$ is the background-subtracted count rate in polarization channel $p$, measured in s$^{-1}$. A real instrument also requires a Mueller matrix $M_{ij}$ to represent mirror reflections, polarizer extinction ratios, wave-plate phase errors, and detector-efficiency differences: 

```{math}
:label: eq:ch06-mueller
\mathbf{S}_{\rm obs}=M\,\mathbf{S}_{\rm sky}+\mathbf{b},
```

 where $\mathbf{S}=(I,Q,U,V)^T$, and $\mathbf{b}$ is the background and bias. Polarization intensity interferometry can compare $HH$ or $VV$ correlations, and it can also form cross-polarization correlations to separate astrophysical polarization structure from instrumental leakage. Once an event table has saved only total intensity, none of these tests can be repeated.

## Calibration, data formats, and reproducible analysis

Detector response has to be fixed both in the laboratory and on sky. Dark frames give $R_{\rm dark}$ and thermal background. A stable continuous source measures linearity and the dead-time curve. A weak pulsed laser measures $h(t)$, fixed channel delays, and time walk. A zero-baseline beam split into two independent detectors separates an electronic correlation peak from afterpulsing. For intensity interferometry, wrong-delay, wrong-polarization, off-source, and far-from-zero-lag correlations should all be used as null tests. VERITAS-SII rejects high-frequency electronic noise in each 1 s correlation frame. MAGIC-SII uses no-light inputs and correlations away from the signal delay to estimate residual electronic correlations, and it tracks electronic bandwidth stability with autocorrelations {cite:p}`2020NatAs...4.1164A,2024MNRAS.529.4387A`.

Flux and background must be recorded with the same care. In Eq. {eq}`eq:ch06-detected-rate`, $R_{\rm sky}$ changes with lunar phase, clouds, field of view, filters, and elevation. For atmospheric Cherenkov telescopes, bright Moon time can be useful for SII because gamma-ray observing is often limited by night-sky light; that same night-sky light still enters the PMTs and dilutes the stellar correlation. If $\beta_i=R_{{\rm bkg},i}/R_{*,i}$, the approximate background-dilution correction for two telescopes is 

```{math}
:label: eq:ch06-background-dilution
|g^{(1)}_*|^2
  \simeq
  |g^{(1)}_{\rm meas}|^2
  (1+\beta_1)(1+\beta_2),
```

 assuming that source-background and background-background fluctuations are not correlated between the two stations. The $R_*$ and $R_{\rm bkg}$ in this equation should come from the same channel, gain state, and nearby time range. Otherwise a background correction can mistake slow gain drift for an astrophysical correlation amplitude {cite:p}`2020NatAs...4.1164A,2024MNRAS.529.4387A`.

Time and coordinate metadata determine whether the calibration can still be reproduced years later. A reproducible event table should at least preserve the geodetic coordinates and altitude of each station; telescope pointing and baselines; raw clock source, frequency standard, leap-second table version, and time scale; electronic delay, detector bias, high voltage, temperature, and dead-time model for each channel; filter or spectral response curves; polarization-module angles and Mueller calibration; quality-flag definitions; and software versions and selection cuts. The FITS standard supports time- tagged photon events in BINTABLE extensions and uses header keywords to describe the meaning of the data. Astropy provides FITS, coordinate, and time handling, which makes it a natural place to combine event tables, time-scale conversion, and barycentric correction in one Python analysis chain {cite:p}`2010A&A...524A..42P,2013A&A...558A..33A,2018AJ....156..123A`.

FITS is well suited to long-term archiving and interoperability with astronomy software. HDF5 or Parquet can be better for high-throughput analysis and column-wise selection. Whatever the format, raw events, calibrated events, and correlation products should be stored as separate layers. The raw layer should not be overwritten by later processing. The calibrated layer records each version of the correction. The product layer records the bin width, delay grid, weights, rejection criteria, and covariance. Then a reader can regenerate a light curve, $g^{(2)}(\tau)$, a spatial visibility, or a pulse time of arrival from the same raw observations without guessing which hidden choices were made by an earlier analysis script.

Detectors decide which photons become events. Electronics decide how event times are quantized. Clock systems decide whether different stations can be placed on one time axis. Data formats and metadata decide whether the same correlation curve can be reproduced years later. The next chapter starts from these event tables and turns to likelihood functions, correlation estimators, error propagation, and model fitting.
