Skip to content

Commit

Permalink
autodoc warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AyodeAwe committed Jan 31, 2023
1 parent d6c270b commit f6da163
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Correlate


Modulation/Demodulation
============
=======================

Demodulation
------------
Expand All @@ -34,7 +34,7 @@ Estimation
============

Kalman Filter
------------
-------------

.. automodule:: cusignal.estimation.filters
:members:
Expand Down
4 changes: 4 additions & 0 deletions python/cusignal/convolution/convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ def convolve2d(
Convolve two 2-dimensional arrays.
Convolve `in1` and `in2` with output size determined by `mode`, and
boundary conditions determined by `boundary` and `fillvalue`.
Parameters
----------
in1 : array_like
Expand All @@ -338,6 +339,7 @@ def convolve2d(
Second input. Should have the same number of dimensions as `in1`.
mode : str {'full', 'valid', 'same'}, optional
A string indicating the size of the output:
``full``
The output is the full discrete linear convolution
of the inputs. (Default)
Expand All @@ -350,6 +352,7 @@ def convolve2d(
with respect to the 'full' output.
boundary : str {'fill', 'wrap', 'symm'}, optional
A flag indicating how to handle boundaries:
``fill``
pad input arrays with fillvalue. (default)
``wrap``
Expand Down Expand Up @@ -472,6 +475,7 @@ def choose_conv_method(in1, in2, mode="full", measure=False):
>>> b = cp.random.randn(1000000)
>>> method = cusignal.choose_conv_method(a, b, mode='same')
>>> method
'fft'
This can then be applied to other arrays of the same dtype and shape:
Expand Down
17 changes: 14 additions & 3 deletions python/cusignal/convolution/correlate.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ def correlate(
then
.. math::
z[k] = (x * y)(k - N + 1)
= \sum_{l=0}^{||x||-1}x_l y_{l-k+N-1}^{*}
z[k] = (x * y)(k - N + 1)
= \sum_{l=0}^{||x||-1}x_l y_{l-k+N-1}^{*}
for :math:`k = 0, 1, ..., ||x|| + ||y|| - 2`
Expand Down Expand Up @@ -175,6 +174,7 @@ def correlate2d(
Second input. Should have the same number of dimensions as `in1`.
mode : str {'full', 'valid', 'same'}, optional
A string indicating the size of the output:
``full``
The output is the full discrete linear cross-correlation
of the inputs. (Default)
Expand All @@ -187,6 +187,7 @@ def correlate2d(
with respect to the 'full' output.
boundary : str {'fill', 'wrap', 'symm'}, optional
A flag indicating how to handle boundaries:
``fill``
pad input arrays with fillvalue. (default)
``wrap``
Expand All @@ -206,6 +207,7 @@ def correlate2d(
--------
Use 2D cross-correlation to find the location of a template in a noisy
image:
>>> import cusignal
>>> import cupy as cp
>>> from scipy import misc
Expand Down Expand Up @@ -261,6 +263,7 @@ def correlate2d(
def correlation_lags(in1_len, in2_len, mode="full"):
r"""
Calculates the lag / displacement indices array for 1D cross-correlation.
Parameters
----------
in1_size : int
Expand All @@ -270,34 +273,41 @@ def correlation_lags(in1_len, in2_len, mode="full"):
mode : str {'full', 'valid', 'same'}, optional
A string indicating the size of the output.
See the documentation `correlate` for more information.
See Also
--------
correlate : Compute the N-dimensional cross-correlation.
Returns
-------
lags : array
Returns an array containing cross-correlation lag/displacement indices.
Indices can be indexed with the np.argmax of the correlation to return
the lag/displacement.
Notes
-----
Cross-correlation for continuous functions :math:`f` and :math:`g` is
defined as:
.. math::
\left ( f\star g \right )\left ( \tau \right )
\triangleq \int_{t_0}^{t_0 +T}
\overline{f\left ( t \right )}g\left ( t+\tau \right )dt
Where :math:`\tau` is defined as the displacement, also known as the lag.
Cross correlation for discrete functions :math:`f` and :math:`g` is
defined as:
.. math::
\left ( f\star g \right )\left [ n \right ]
\triangleq \sum_{-\infty}^{\infty}
\overline{f\left [ m \right ]}g\left [ m+n \right ]
Where :math:`n` is the lag.
Examples
--------
Cross-correlation of a signal with its time-delayed self.
>>> import cusignal
>>> import cupy as cp
>>> from cupy.random import default_rng
Expand All @@ -307,6 +317,7 @@ def correlation_lags(in1_len, in2_len, mode="full"):
>>> correlation = cusignal.correlate(x, y, mode="full")
>>> lags = cusignal.correlation_lags(x.size, y.size, mode="full")
>>> lag = lags[cp.argmax(correlation)]
"""

# calculate lag ranges in different modes of operation
Expand Down
2 changes: 2 additions & 0 deletions python/cusignal/estimation/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class KalmanFilter(object):
Define the process noise for all Kalman Filter points:
.. code::
motion_noise = np.eye(dim_x, dtype=dt) * np.array(
[10.0, 10.0, 10.0, 10.0], dtype=dt
)
Expand All @@ -181,6 +182,7 @@ class KalmanFilter(object):
Results are in:
.. code::
kf.x[:, :, :]
References
Expand Down

0 comments on commit f6da163

Please sign in to comment.