emd.cycles.get_cycle_vector¶
- emd.cycles.get_cycle_vector(phase, return_good=True, mask=None, imf=None, phase_step=4.71238898038469, phase_edge=0.2617993877991494)[source]¶
Identify cycles within a instantaneous phase time-course.
Cycles are identified by large phase jumps and can optionally be tested to remove ‘bad’ cycles by criteria in Notes.
- Parameters
- phasendarray
Input vector of Instantaneous Phase values
- return_goodbool
Boolean indicating whether ‘bad’ cycles should be removed (Default value = True)
- maskndarray
Vector of mask values that should be ignored (Default value = None)
- imfndarray
Optional array of IMFs to used for control point identification when identifying good/bad cycles (Default value = None)
- phase_stepscalar
Minimum value in the differential of the wrapped phase to identify a cycle transition (Default value = 1.5*np.pi)
- phase_edgescalar
Maximum distance from 0 or 2pi for the first and last phase value in a good cycle. Only used when return_good is True (Default value = np.pi/12)
- Returns
- ndarray
Vector of integers indexing the location of each cycle
Notes
Good cycles are those with
A strictly positively increasing phase
A phase starting within phase_step of zero (ie 0 < x < phase_edge)
A phase ending within phase_step of 2pi (is 2pi-phase_edge < x < 2pi)
A set of 4 unique control points (asc-zero, peak, desc-zero & trough)
Good cycles can be idenfied with:
>>> good_cycles = emd.cycles.get_cycle_vector(phase)
The total number of cycles is then
>>> good_cycles.max()
Indices where good cycles is zero do not contain a valid cycle
>>> bad_segments = good_cycles > -1
A single cycle can be isolated by matching its index, eg for the 5th cycle
>>> cycle_5_inds = good_cycles == 5