Skip to main content

Cyclic cross-correlation utilities

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. It supports automatic input validation, optional zero-padding, and normalization.

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.

Functions

cyclic_corr(s1, s2, method="fft", padded=True, normalized=True)

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".
  • padded: If True, pads shorter signal to match the longer one.
  • normalized: If True, normalizes the correlation output.

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, padded)

Validates and prepares input signals for correlation computation.

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", padded=True, 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.2.tar.gz (4.2 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.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cyclic_correlation-0.1.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for cyclic_correlation-0.1.2.tar.gz
Algorithm Hash digest
SHA256 75011d6bbf925492028849dbf3e61680476c72d612bc795cc9cba3954e42517e
MD5 d417ba1bd177233202ed5b83a769edc3
BLAKE2b-256 6896533e3a7cb3d94f83c3c55ab28e1ea4a159803597ef20081001714a3c9915

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cyclic_correlation-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 246934e33d16c2e1e30e6255d88075cf7b4fc372e25bc42a6e36e7781059c2d8
MD5 2652640285059c348854560542798e95
BLAKE2b-256 984939c8f5524f4f19f28b340a561d30cacb92ad053b87a483f713e3440c6a46

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