# Lightning Interferometry with the Long Wavelength Array
## 2 Methods
### Calibration  
The LWA antennas are calibrated reasonably well, but there can be small deviations that change day to day in the antennas. For the best results, it is reasonable to calibrate the cable delay for each antenna for each flash to be processed. This also helps to identify individual antennas that are not operating properly, so that they can be removed from the imaging routine. Delay calibration is achieved by identifying one (or several) point sources in the flash to calibrate with. The initiation of the lightning flash is usually well suited for this purpose, since it is always a single source and frequently reasonably bright, but any point source in the flash can be used for calibration. The location of this single source is determined in the typical manner using the deconvolution method described in Section 2.3. A set of linear equations can then be set up in the following form:  
\[\tau_{ij\;measured}-\tau_{ij\;expected}=\sigma_{i}-\sigma_{j} \tag{7}\]  
where \(\sigma_{i}\) and \(\sigma_{j}\) are the delay correction for the \(i\)th and \(j\)th antennas, respectively. \(\tau_{ij\;measured}\) is determined by the lag time of the closest peak in the cross-correlation, and \(\tau_{ij\;expected}\) is calculated based on the location of the source (which is taken as truth):  
\[\tau_{ij\;expected}=\frac{d_{ij}}{c}\alpha\sin(\theta_{ij})-\frac{d_{ij}}{c} \beta\cos(\theta_{ij}) \tag{8}\]  
where \(\alpha\) and \(\beta\) are the direction cosines of the source, and \(d_{ij}\) and \(\theta_{ij}\) are the baseline length and orientation for the antenna pair, respectively. For 256 antennas, each point source results in 32,640 linear equations with 256 unknowns (the \(\sigma_{i}\)s). However, because of the way in which the equations are set up, the unknowns are not fully constrained as we can add an arbitrary constant delay to all antenna corrections and not alter the system of equations. To account for this, a final equation must be satisfied:  
\[\sum_{i}\sigma_{i}=0 \tag{9}\]  
The system of equations can be solved using normal least squares methods [37]. Although the system of equations for even a single source is heavily overdetermined, we still use several sources in the same region for the calibration. Since the initial locations of the calibration sources are assumed to be true, the calibration routine is somewhat iterative. With each iteration, the calibration sources will move, resulting in slightly different corrections on the next pass. This could be accounted for by solving for the location of the source as well as the antenna delay corrections (adding 2 more unknowns for each calibration source). In practice, the corrections converge quickly enough that the added complexity is not required. Figure 4 shows the results of delay calibration based on 46 sources from the flash depicted in Figure 1. These sources are chosen such that each is in a different region of the sky, is relatively bright, and is the only source located at this time. The true location for these 46 point sources is not known; instead, the location determined when imaging with all 249 antennas is assumed as the truth. Then, the difference in the source location in the \(\alpha\) and \(\beta\) directions on the image plane is computed for all other antenna configurations. The red distribution shows the variation of the 46 point source locations before calibration, and the green after. The variation is measured on the image plane and so is unitless; a variation of 0.0025 corresponds to 0.20\({}^{\circ}\) at 45\({}^{\circ}\) elevation. In each distribution, the solid line shows the mean variation, the shaded region the standard deviation, and the dashed line the maximum deviation above and below. Because the 249-antenna solution is assumed to be correct, the variation of both the calibrated and uncalibrated distributions converges to 0 when all 249 antennas are used to locate the source. This also means that the magnitude of the variation seen in Figure 4 cannot be interpreted as an estimate of the location error.