===================
Measurement Classes
===================

The Time Tagger library includes several classes that implement various measurements. All measurements are derived from a base class called :class:`IteratorBase` that is described further down. As the name suggests, it uses the `iterator` programming concept.

All measurements provide a set of methods to start and stop the execution and to access the accumulated data. In a typical application, the following steps are performed (see :ref:`example <api-example-crosscorr-measurement>`):

#. Create an instance of a measurement
#. Wait for some time
#. Retrieve the data accumulated by the measurement by calling a :code:`.getData()` method.

.. note::

    In MATLAB, the Measurement names have common prefix ``TT*``. For example: ``Correlation`` is named as ``TTCorrelation``. This prevents possible name collisions with existing MATLAB or user functions.

The available measurements are grouped by the following categories: :doc:`Event counting <event_counting>`, :doc:`Time histograms <time_histograms>`, :doc:`Fluorescence-lifetime imaging (FLIM) <flim>`,
:doc:`Phase & frequency analyses <phase_frequency_analyses>`, :doc:`Time-tag-streaming <time_tag_streaming>`, and :doc:`Helper classes <helper_classes>`.

All the existing classes are listed alphabetically below:

:ref:`Correlation <api.Correlation>`
    Computes auto- and cross-correlations between channels.
:ref:`CorrelationPairs <api.CorrelationPairs>`
    Computes auto- and cross-correlations between all pairs of a list of channels.
:ref:`Counter <api.Counter>`
    Counts events on one or more channels using fixed-width bins and a circular buffer output.
:ref:`Countrate <api.Countrate>`
    Measures the average event rate on one or more channels.
:ref:`CustomMeasurement <api.CustomMeasurement>`
    Implements a custom measurement by processing the raw time-tag stream with minimal overhead.
:ref:`Dump <api-dump>`
    Deprecated - please use :ref:`api-FileWriter` instead. Writes raw time-tags to file in an uncompressed binary format.
:ref:`FileReader <api-FileReader>`
    Reads time-tags from a compressed file written by the :ref:`api-FileWriter` measurement.
:ref:`FileWriter <api-FileWriter>`
    Writes time-tags into a file with a lossless compression. It replaces the :ref:`api-Dump` class.
:ref:`Flim <api.FLIM>`
    Measures time histograms for fluorescence lifetime imaging.
:ref:`FrequencyCounter <api.FrequencyCounter>`
    Measures frequency and phase evolution of periodic signals at periodic sampling intervals.
:ref:`FrequencyStability <api.FrequencyStability>`
    Analyzes the frequency stability of periodic signals at different time scales.
:ref:`GatedCounter <api.GatedCounter>`
    Counts events on one or more channels within gates defined by one or two marker channels.
:ref:`Histogram <api.Histogram>`
    Accumulates a histogram of time differences between two channels.
:ref:`Histogram2D <api.Histogram2D>`
    Accumulates a 2D histogram of correlated time differences.
:ref:`HistogramCustomBins <api.HistogramCustomBins>`
    Accumulates a histogram of time differences using custom binning.
:ref:`HistogramLogBins <api.HistogramLogBins>`
    Accumulates a histogram of time differences using logarithmic binning.
:ref:`HistogramND <api.HistogramND>`
    Accumulates an N-dimensional histogram of time differences.
``IteratorBase``
    Provides a base class for implementing custom measurements.
:ref:`PhaseNoise <api.PhaseNoise>`
    Analyzes the phase stability of a periodic signal in the frequency domain.
:ref:`PulsePerSecondMonitor <api.PulsePerSecondMonitor>`
    Monitors the timing and stability of 1 pulse-per-second (PPS) signals.
:ref:`Sampler <api-sampler>`
    Samples the digital state of channels triggered by another channel.
:ref:`Scope <api-scope>`
    Detects signal edges for visualization, similar to a ultrafast logic analyzer.
:ref:`StartStop <api.StartStop>`
    Accumulates a histogram of start-stop time differences between two channels.
:ref:`SynchronizedMeasurements <api.SynchronizedMeasurements>`
    Synchronizes multiple measurement instances for parallel acquisition and control.
:ref:`TimeDifferences <api.TimeDifferences>`
    Accumulates histograms of time differences between two channels, optionally swept using one or two trigger channels.
:ref:`TimeDifferencesND <api.TimeDifferencesND>`
    Accumulates multi-dimensional histograms of asynchronous time differences.
:ref:`TimeTagStream <api-TimeTagStream>`
    Provides low-level access to the raw time-tag stream for custom processing.
    See :doc:`/InDepthGuides/RawTimeTagStreamAccess` to get on overview about the possibilities for the raw time-tag-stream access.

.. toctree::
    :hidden:
    :maxdepth: 1

    common_methods
    event_counting
    time_histograms
    flim
    phase_frequency_analyses
    time_tag_streaming
    helper_classes
