pyyeti.dsp.aligntime

pyyeti.dsp.aligntime(dct, channels=None, mode='truncate', value=0)[source]

Aligns the time vectors for specified channels in dct.

Parameters:
  • dct (dictionary) – Dictionary of channels where each channel is either 2d ndarray or 2-element tuple. If ndarray, it must have 2 columns: [time, signal]. Otherwise, it must be a 2-element tuple or list, eg: (time, signal). See notes below.

  • channels (list or None; optional) – List of names defining which channels to synchronize in time. If None, all channels in dct will be synchronized.

  • mode (string; optional) – Method of aligning:

    mode

    Description

    ‘truncate’

    Keep only data where all channels overlap

    ‘expand’

    Expand all channels to maximum time range of all channels. Channels are expanded by stuffing in value’s.

  • value (scalar; optional) – Used for the ‘expand’ mode.

Returns:

dctout (dictionary) – Dictionary containing only those channels specified in channels. Each channel will be a 1d ndarray. The time vector is also a 1d array and is named ‘t’.

Notes

This routine operates under these assumptions:

  1. The time vector for each channel is perfect (ie, after fixtime())

  2. All the time vectors have the same step size

  3. They would all hit the same time point if they overlapped

The first two assumptions are checked. The third is not checked and could cause indexing failures if it is not true.