neurodsp.timefrequency.robust_hilbert

neurodsp.timefrequency.robust_hilbert(sig, increase_n=False)[source]

Compute the Hilbert transform, ignoring any boundaries that are NaN.

Parameters
sig1d array

Time series.

increase_nbool, optional, default: False

If True, zero pad the signal’s length to the next power of 2 for the Hilbert transform. This is because scipy.signal.hilbert can be very slow for some signal lengths.

Returns
sig_hilb1d array

The analytic signal, of which the imaginary part is the Hilbert transform of the input.

Examples

Compute the analytic signal, using zero padding:

>>> from neurodsp.sim import sim_combined
>>> sig = sim_combined(n_seconds=10, fs=500,
...                    components={'sim_powerlaw': {}, 'sim_oscillation': {'freq': 10}})
>>> sig_hilb = robust_hilbert(sig, increase_n=True)