Skip to content

qiu_signals.integer_axis

Uniformly sampled axes of integer indices.

Classes:

  • IndexOrdering –

    Orderings of the integer indices of the samples of an axis.

  • IntegerAxis –

    A uniformly sampled axis of integer indices.

IndexOrdering

Bases: ExtendedEnum

Orderings of the integer indices of the samples of an axis.

For an axis of N samples, the sample at array position k gets the index:

  • NATURAL: k, i.e. 0, 1, ..., N-1.
  • FFT: the ordering of numpy.fft.fftfreq, i.e. the non-negative indices 0, 1, ..., ceil(N/2)-1 followed by the negative ones -floor(N/2), ..., -1.
  • CENTERED: the FFT ordering after numpy.fft.fftshift, i.e. the ascending indices -floor(N/2), ..., ceil(N/2)-1.

Attributes:

NATURAL class-attribute instance-attribute

NATURAL = 'natural'

FFT class-attribute instance-attribute

FFT = 'fft'

CENTERED class-attribute instance-attribute

CENTERED = 'centered'

IntegerAxis

IntegerAxis(size: int, ordering: IndexOrdering)

A uniformly sampled axis of integer indices.

The sample at array position k has the integer index index[k], given by the ordering of the axis.

Parameters:

  • size (int) –

    Number of samples, at least 1.

  • ordering (IndexOrdering) –

    Ordering of the integer indices of the samples.

Raises:

Attributes:

Source code in packages/qiu-signals/src/qiu_signals/integer_axis.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def __init__(self, size: int, ordering: IndexOrdering) -> None:
    """Initialize an integer axis.

    Args:
        size: Number of samples, at least 1.
        ordering: Ordering of the integer indices of the samples.

    Raises:
        ValueError: If the size is smaller than 1.
    """
    if size < 1:
        raise ValueError(f"The size must be at least 1, got {size}.")

    self.size = size
    self.ordering = IndexOrdering(ordering)

size instance-attribute

size: int = size

Number of samples.

ordering instance-attribute

ordering: IndexOrdering = IndexOrdering(ordering)

Ordering of the integer indices of the samples.

index property

index: NDArray[int_]

Return the integer indices of the samples according to the ordering.