original_docstring:  Calculates the Cauchy-Schwarz distance between two spike trains given
      a smoothing filter.
  
      Let :math:`v_a(t)` and :math:`v_b(t)` with :math:`t \\in \\mathcal{T}` be
      the spike trains convolved with some smoothing filter and :math:`V(a, b)
      = \\int_{\\mathcal{T}} v_a(t) v_b(t) dt`. Then, the Cauchy-Schwarz distance
      of the spike trains is defined as :math:`d_{CS}(a, b) = \\arccos \\frac{V(a,
      b)^2}{V(a, a) V(b, b)}`.
  
      The Cauchy-Schwarz distance is closely related to the Schreiber et al.
      similarity measure :math:`S_S` by :math:`d_{CS} = \\arccos S_S^2`
  
      This function numerically convolves the spike trains with the smoothing
      filter which can be quite slow and inaccurate. If the analytical result of
      the autocorrelation of the smoothing filter is known, one can use
      :func:`schreiber_similarity` for a more efficient and precise calculation.
  
      Further information can be found in *Paiva, A. R. C., Park, I., & Principe,
      J. (2010). Inner products for representation and learning in the spike
      train domain. Statistical Signal Processing for Neuroscience and
      Neurotechnology, Academic Press, New York.*
  
      :param sequence trains: Sequence of :class:`neo.core.SpikeTrain` objects of
          which the distance will be calculated pairwise.
      :param smoothing_filter: Smoothing filter to be convolved with the spike
          trains.
      :type smoothing_filter: :class:`.signal_processing.Kernel`
      :param sampling_rate: The sampling rate which will be used to bin
          the spike trains as inverse time scalar.
      :type sampling_rate: Quantity scalar
      :param float filter_area_fraction: A value between 0 and 1 which controls
          the interval over which the smoothing filter will be discretized. At
          least the given fraction of the complete smoothing filter area will be
          covered. Higher values can lead to more accurate results (besides the
          sampling rate).
      :returns: Matrix containing the Cauchy-Schwarz distance of all pairs of
          spike trains
      :rtype: 2-D array
      
docstring: Calculates the Cauchy-Schwarz distance between two spike trains given
  a smoothing filter.
  
  
  
  The Cauchy-Schwarz distance is closely related to the Schreiber et al.
  similarity measure :math:`S_S` by :math:`d_{CS} = \\arccos S_S^2`
  
  This function numerically convolves the spike trains with the smoothing
  filter which can be quite slow and inaccurate. If the analytical result of
  the autocorrelation of the smoothing filter is known, one can use
docstring_tokens: Calculates the Cauchy - Schwarz distance between two spike trains given a smoothing filter . The Cauchy - Schwarz distance is closely related to the Schreiber et al . similarity measure : math : ` S_S ` by : math : ` d_ { CS } = \\ arccos S_S^2 ` This function numerically convolves the spike trains with the smoothing filter which can be quite slow and inaccurate . If the analytical result of the autocorrelation of the smoothing filter is known one can use
code: def cs_dist(
          trains, smoothing_filter, sampling_rate,
          filter_area_fraction=sigproc.default_kernel_area_fraction):
      """ Calculates the Cauchy-Schwarz distance between two spike trains given
      a smoothing filter.
  
      Let :math:`v_a(t)` and :math:`v_b(t)` with :math:`t \\in \\mathcal{T}` be
      the spike trains convolved with some smoothing filter and :math:`V(a, b)
      = \\int_{\\mathcal{T}} v_a(t) v_b(t) dt`. Then, the Cauchy-Schwarz distance
      of the spike trains is defined as :math:`d_{CS}(a, b) = \\arccos \\frac{V(a,
      b)^2}{V(a, a) V(b, b)}`.
  
      The Cauchy-Schwarz distance is closely related to the Schreiber et al.
      similarity measure :math:`S_S` by :math:`d_{CS} = \\arccos S_S^2`
  
      This function numerically convolves the spike trains with the smoothing
      filter which can be quite slow and inaccurate. If the analytical result of
      the autocorrelation of the smoothing filter is known, one can use
      :func:`schreiber_similarity` for a more efficient and precise calculation.
  
      Further information can be found in *Paiva, A. R. C., Park, I., & Principe,
      J. (2010). Inner products for representation and learning in the spike
      train domain. Statistical Signal Processing for Neuroscience and
      Neurotechnology, Academic Press, New York.*
  
      :param sequence trains: Sequence of :class:`neo.core.SpikeTrain` objects of
          which the distance will be calculated pairwise.
      :param smoothing_filter: Smoothing filter to be convolved with the spike
          trains.
      :type smoothing_filter: :class:`.signal_processing.Kernel`
      :param sampling_rate: The sampling rate which will be used to bin
          the spike trains as inverse time scalar.
      :type sampling_rate: Quantity scalar
      :param float filter_area_fraction: A value between 0 and 1 which controls
          the interval over which the smoothing filter will be discretized. At
          least the given fraction of the complete smoothing filter area will be
          covered. Higher values can lead to more accurate results (besides the
          sampling rate).
      :returns: Matrix containing the Cauchy-Schwarz distance of all pairs of
          spike trains
      :rtype: 2-D array
      """
  
      inner = st_inner(
          trains, trains, smoothing_filter, sampling_rate, filter_area_fraction)
      return sp.arccos(
          inner ** 2 / sp.diag(inner) / sp.atleast_2d(sp.diag(inner)).T)
code_tokens: def cs_dist ( trains , smoothing_filter , sampling_rate , filter_area_fraction = sigproc . default_kernel_area_fraction ) : inner = st_inner ( trains , trains , smoothing_filter , sampling_rate , filter_area_fraction ) return sp . arccos ( inner ** 2 / sp . diag ( inner ) / sp . atleast_2d ( sp . diag ( inner ) ) . T )
short_docstring: Calculates the Cauchy-Schwarz distance between two spike trains given
  a smoothing filter.
short_docstring_tokens: Calculates the Cauchy - Schwarz distance between two spike trains given a smoothing filter .
comment: """ Calculates the Cauchy-Schwarz distance between two spike trains given
      a smoothing filter.
  
      Let :math:`v_a(t)` and :math:`v_b(t)` with :math:`t \\in \\mathcal{T}` be
      the spike trains convolved with some smoothing filter and :math:`V(a, b)
      = \\int_{\\mathcal{T}} v_a(t) v_b(t) dt`. Then, the Cauchy-Schwarz distance
      of the spike trains is defined as :math:`d_{CS}(a, b) = \\arccos \\frac{V(a,
      b)^2}{V(a, a) V(b, b)}`.
  
      The Cauchy-Schwarz distance is closely related to the Schreiber et al.
      similarity measure :math:`S_S` by :math:`d_{CS} = \\arccos S_S^2`
  
      This function numerically convolves the spike trains with the smoothing
      filter which can be quite slow and inaccurate. If the analytical result of
      the autocorrelation of the smoothing filter is known, one can use
      :func:`schreiber_similarity` for a more efficient and precise calculation.
  
      Further information can be found in *Paiva, A. R. C., Park, I., & Principe,
      J. (2010). Inner products for representation and learning in the spike
      train domain. Statistical Signal Processing for Neuroscience and
      Neurotechnology, Academic Press, New York.*
  
      :param sequence trains: Sequence of :class:`neo.core.SpikeTrain` objects of
          which the distance will be calculated pairwise.
      :param smoothing_filter: Smoothing filter to be convolved with the spike
          trains.
      :type smoothing_filter: :class:`.signal_processing.Kernel`
      :param sampling_rate: The sampling rate which will be used to bin
          the spike trains as inverse time scalar.
      :type sampling_rate: Quantity scalar
      :param float filter_area_fraction: A value between 0 and 1 which controls
          the interval over which the smoothing filter will be discretized. At
          least the given fraction of the complete smoothing filter area will be
          covered. Higher values can lead to more accurate results (besides the
          sampling rate).
      :returns: Matrix containing the Cauchy-Schwarz distance of all pairs of
          spike trains
      :rtype: 2-D array
      """