.. _taxi_readout_corrections: Readout Corrections =================== There are two types of waveform corrections that are applied while reading the binary file. **Capcacitor Corrections:** Each capacitor in each ring buffer has its own characteristic offset and is a property of an individual TAXI board. Because the first time, :math:`t_0`, corresponding to a given waveform is not generally the "first" bin in the ring buffer, the waveforms must be augmented to identify this offset. Using the ROI values (see :ref:`taxi_data_structure`), each waveform is rolled (i.e. `np.roll`) by the roi value such that the waveforms are ordered by buffer-bin rather than time-bin. The median value of each ring-buffer capcacitor is then calculated using all events in the file. This value is then subtracted off of all the waveforms before rolling them back to their original location. **Time-bin Corrections:** Waveforms have an artifact in the baseline such that, starting from the first time bin (:math:`t_0=0`), the recorded waveform amplitude is shifted by :math:`A_{\rm rec}(t_i) = A_{\rm true}(t_i) + B(t_i)` where :math:`B(t_i)` is a property of an individual TAXI board. To correct for this, the value of :math:`B(t_i)` is estimated during readout by taking calculating the median amplitude of each time bin across all events for each ring buffer, :math:`B(t_i) \simeq \hat{B}(t_i) = {\rm Med}[A_{\rm rec}(t_i)]_{\rm events}`. Then the values of each waveform are corrected as :math:`A_{\rm corr} = A_{\rm rec}(t_i) - \hat{B}(t_i)`. For exact implementation of these algorithms, see ``parse_bin_file`` in :py:class:`icecube.taxi_reader.taxi_tools`. The rolling of waveforms is given by ``antenna_tailor_stable`` and ``antenna_untailor_stable`` in the same location.