spectral_connectivity.transforms.estimate_n_tapers#

estimate_n_tapers(time_halfbandwidth_product: float) int[source]#

Estimate the number of tapers for a given time-halfbandwidth product.

The number of tapers determines how many independent spectral estimates are averaged together. More tapers provide better variance reduction but also more spectral smoothing.

Parameters:

time_halfbandwidth_product (float) – Time-bandwidth product. Typical values are 2-5.

Returns:

n_tapers – Number of discrete prolate spheroidal sequence (DPSS) tapers that will be used.

Return type:

int

Notes

The number of tapers is calculated as:

\[n_{\text{tapers}} = \lfloor 2 \cdot NW \rfloor - 1\]

where NW is the time-halfbandwidth product.

Note: The actual number of tapers used by Multitaper may be lower if is_low_bias=True (default), which excludes tapers with eigenvalues < MIN_EIGENVALUE_THRESHOLD (0.9).

Typical values: - NW=2 → 3 tapers (minimal averaging) - NW=3 → 5 tapers (balanced, recommended) - NW=4 → 7 tapers (strong averaging) - NW=5 → 9 tapers (very strong averaging)

Examples

>>> n_tapers = estimate_n_tapers(time_halfbandwidth_product=3)
>>> print(f"Number of tapers: {n_tapers}")
Number of tapers: 5
>>> n_tapers = estimate_n_tapers(time_halfbandwidth_product=4)
>>> print(f"Number of tapers: {n_tapers}")
Number of tapers: 7

See also

estimate_frequency_resolution

Estimate frequency resolution

suggest_parameters

Automatically suggest parameters