lags#

This module contains the functions for lag time array creation.

Lag time arrays can be used to speed-up the computation of the image structure function (when computed using the differences scheme) or to reduce its size:

import fastddm as fddm

img_seq = ...   # load your images here

# use an array of quasi logspaced int indices
lags = fddm.lags.logspace_int(len(img_seq), num=100)

dqt = fddm.ddm(img_seq, lags)

They can also be used to resample an azimuthal average:

# compute azimuthal average aa
# resample the azimuthal average
# use a fibonacci array of delay times
new_taus = fddm.lags.fibonacci(len(aa)) * aa.tau[0]
aa_res = aa.resample(new_taus)
fastddm.lags.fibonacci(stop: int, endpoint: bool = False) ndarray#

Return fibonacci sequence over a specified interval.

Returns fibonacci samples, calculated over the interval [1, stop].

The endpoint of the interval can optionally be included.

Parameters:
  • stop (int) – The end value of the sequence, unless endpoint is False.

  • endpoint (bool, optional) – If True, stop is the last sample. Otherwise, it is not included. Default is False.

Returns:

Fibonacci samples.

Return type:

numpy.ndarray

Examples

>>> a = fibonacci(13, endpoint=True)
array([1, 2, 3, 5, 8, 13])
>>> a = fibonacci(13)
array([1, 2, 3, 5, 8])
fastddm.lags.logspace_int(stop: int, num: int = 50, endpoint: bool = False) ndarray#

Return quasi-evenly log-spaced integers over a specified interval.

Returns num evenly spaced samples, calculated over the interval [1, stop]. The endpoint of the interval can optionally be included.

Parameters:
  • stop (int) – The end value of the sequence, unless endpoint is False. In that case, the sequence consists of all but the last of num + 1 samples, so that stop is excluded. Note that the step size changes when endpoint is False.

  • num (int, optional) – Number of samples to generate. Default is 50. Must be > 0.

  • endpoint (bool, optional) – If True, stop is the last sample. Otherwise, it is not included. Default is False.

Returns:

The num log-spaced samples.

Return type:

numpy.ndarray

Examples

>>> a = logspace_int(10, num=5, endpoint=True)
array([1, 2, 3, 6, 10])
>>> a = logspace_int(10, num=5)
array([1, 2, 3, 4, 7])