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: IfTrue, pads shorter signal to match the longer one.normalized: IfTrue, 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
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cyclic_correlation-0.1.0.tar.gz.
File metadata
- Download URL: cyclic_correlation-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9be65c7156526904b1ff2f4f1ebb12a9e8ee25b22064a7e1531c1568a23f511c
|
|
| MD5 |
1d72d142679cf4c14cf1b61d3f981b6a
|
|
| BLAKE2b-256 |
e41dda5115490c9ee38b5b4cc52d48aee9d04ca243ad85f0fba68bdc683ca481
|
File details
Details for the file cyclic_correlation-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cyclic_correlation-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92d9d13da9ffbff81c6610ad5a9470c53defc2a3e834ac7e76f8e9beb13295d0
|
|
| MD5 |
0733399336b2dd46e7808620768dd671
|
|
| BLAKE2b-256 |
5f032b91e5f0371b1372cb7f3c92230d729b3f5ab47b1f77c541a660ef8a86ee
|