Skip to main content

Cyclic cross-correlation utilities and Zadoff-Chu sequence generation

Project description

Cyclic Correlation Module

This module provides functions to compute the cyclic cross-correlation between two 1D signals using either FFT-based or analytic methods, and to generate Zadoff-Chu sequences. It supports automatic input validation, optional zero-padding, and normalization.

Current version: 0.1.12

Features

  • Input validation: Ensures signals are 1D and compatible in length.
  • Flexible methods: Choose between "fft" (fast) and "analytic" (direct computation).
  • Padding/truncation: Automatically pads or truncates signals to match lengths if needed.
  • Normalization: Optionally normalizes the correlation output.
  • Zadoff-Chu sequence generation: Generate ZC sequences for communication applications.

Functions

cyclic_corr(s1, s2, method="fft", wrt="short", normalized=True, ccwindow=0, shift=0)

Computes the cyclic cross-correlation between signals s1 and s2.

Parameters

  • s1, s2: 1D lists or numpy arrays (input signals).
  • method: "fft" (default) or "analytic".
  • wrt: "short" (default) or "long"; specifies the correlation window reference.
  • normalized: If True, normalizes the correlation output.
  • ccwindow: If >0, sets the length of the correlation window (default 0, meaning full).
  • shift: If >0, shifts the window start index.

Returns

  • Z: Cyclic cross-correlation array.
  • max_val: Maximum absolute value of the correlation.
  • t_max: Index of the maximum correlation.
  • min_val: Minimum absolute value of the correlation.

check_inputs_define_limits(s1, s2, method, wrt, normalized=True, ccwindow=0, shift=0)

Validates and prepares input signals for correlation computation.

ZC_sequence(r, q, N)

Generates a discrete Zadoff-Chu (ZC) sequence.

Parameters

  • r (int): Root index of the ZC sequence. Must satisfy 1 <= r <= N.
  • q (int): Cyclic shift of the sequence. Must satisfy q >= 0.
  • N (int): Length of the sequence. Must satisfy N >= 1.

Returns

  • numpy.ndarray: The generated Zadoff-Chu sequence of length N.

Example

from cyclic_correlation import ZC_sequence

zc = ZC_sequence(r=1, q=0, N=13)
print("Zadoff-Chu sequence:", zc)

Example

from cyclic_correlation import cyclic_corr

s1 = [1, 2, 3, 4]
s2 = [4, 3, 2, 1]
Z, max_val, t_max, min_val = cyclic_corr(s1, s2, method="fft", wrt="short", normalized=True)
print("Correlation:", Z)
print("Max value:", max_val)
print("Index of max:", t_max)
print("Min value:", min_val)

Requirements

  • numpy

License

BSD-3-Clause

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cyclic_correlation-0.1.12.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cyclic_correlation-0.1.12-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file cyclic_correlation-0.1.12.tar.gz.

File metadata

  • Download URL: cyclic_correlation-0.1.12.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.67.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for cyclic_correlation-0.1.12.tar.gz
Algorithm Hash digest
SHA256 dafb44e96255dbe05bebad607b82dc974855b1d0e85b2961fccfd49a8b2eaa4f
MD5 8053fea7f6f57a09447ad69325103ec9
BLAKE2b-256 ac16774e5b52f8b177da2fb302143a73b64289212decbb1f5f650607000c8f73

See more details on using hashes here.

File details

Details for the file cyclic_correlation-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: cyclic_correlation-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.28.2 rfc3986/1.5.0 tqdm/4.67.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for cyclic_correlation-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 1de835b3f6826cfb79594d9bf3034c0c517667edecad91c17309417d4599ab19
MD5 e349856fa7b8e617935b602e536a467e
BLAKE2b-256 5dd54304eedd47de300922b62780963057a354cfcb78d6947dd1807a87d095ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page