Skip to content

Implementation of Chirp-z transform #72

Description

@Besler

I want to see if there is any interest to include an implementation of czt and iczt in this package. I'm happy to do the work so long as we can agree on the interface and you are willing to provide review.

Theory
The DFT computes the spectral components along the unit circle. The Chirp-z transform (czt) computes components along spiral arcs, which are sometimes aligned along the unit circle. The DFT is a sampling along the y = j \omega straight line in the s-plane. The czt is a sampling of arbitrary straight lines in the s-plane.

My specific interest is in radar, where data from vector network analyzers is measured along the unit circle but not starting at the original. We measure data only from, say, 1 GHz to 5 GHz, and assume the components outside this range are all zeros. We can do this because we provide a band limited signal as input. The iczt method is the primary means of recovering the time domain signal.

Implementation
I generally see the czt and iczt implemented from Bluestein's algorithm. The czt breaks down into convolution, which can be implemented efficiently with fft, multiply, ifft. And fft and ifft are already implemented in this crate.

Design Considerations
I can think of three design considerations:

  1. Support arbitrary czt
  2. Support czt aligned on the unit circle
  3. Support signals not sampled at equidistances

I think we can rule out 3) immediately and implement 1) with a simple interface for 2).

Interface
You probably have a way you want this interface to look. In general, I would like to see something along the lines of the following:

/// Compute the Chirp-z transform
fn czt(buffer: &mut [Complex<T>], a: &Complex<T>, w: &Complex<T>);

/// Compute the inverse Chirp-z transform
fn iczt(buffer: &mut [Complex<T>], a: &Complex<T>, w: &Complex<T>);

/// Compute the Chirp-z transform along the unit circle
///
/// Sampling starts at `theta_start` on the unit circle
fn unit_czt(buffer: &mut [Complex<T>], theta_start: &T);

/// Compute the inverse Chirp-z transform along the unit circle
///
/// Sampling starts at `theta_start` on the unit circle
fn unit_iczt(buffer: &mut [Complex<T>], theta_start: &T);

The fft, multiply, and ifft are performed inside czt and izct using FftPlanner. The samples variable are the z-plane spiral samples as defined in the algorithm. Internally, unit_czt and unit_iczt just create samples and call czt and iczt. czt and iczt are "in place" as is done currently.

At a later date, and if needed, the unit_czt and unit_iczt implementations can be specialized for performance. But generally, we'll see decent performance just by using the excellent implementations in the current crate. However, this interface doesn't follow the style of FftPlanner.

Literature

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions