CTFRs from spectrograms
- ctfr.ctfr_from_specs(specs: Iterable[ndarray], method: str, *, normalize_input: bool = True, normalize_output: bool = True, energy: float | None = None, **kwargs: Any) ndarray
Computes a combined time-frequency representation (CTFR) from input spectrograms.
This function is similar to
ctfr(), but offers more control to the user by allowing them to provide the input spectrograms directly.- Parameters:
specs (Iterable[np.ndarray [shape=(K, M)], values >= 0]) – input spectrograms, assumed to be magnitude-squared time-frequency representations (TFRs) of the same signal and with the same shape and time-frequency alignment.
method (str) – combination method to use, as specified by their id string. See Combination methods. User-defined methods are also supported if they are properly installed (see Adding methods). A list of all available methods can also be obtained with
ctfr.show_methods()orctfr.get_methods_list().normalize_input (bool, default=True) – whether to normalize the input spectrograms to have the same total energy. This is highly recommended for a quality CTFR, though can be skipped if the input spectrograms are already normalized.
normalize_output (bool, default=True) – whether to normalize the output CTFR’s total energy to match the input energy. This is highly recommended for a quality CTFR, though can be skipped for output testing purposes.
energy (float, optional) – energy to normalize the input spectrograms to, if
normalize_inputis True, and the output CTFR to, ifnormalize_outputis True. If not provided, the mean energy of the input spectrograms is used.**kwargs – additional keyword arguments to pass to the combination method function. These are specified in their respective pages in Combination methods.
- Returns:
matrix of dimensions
K * Mcontaining a squared-magnitude CTFR of the input signal, whereKis the number of frequency bins andMis the number of time frames.- Return type:
np.ndarray [shape=(K, M)]
- Raises:
InvalidCombinationMethodError – If the value provided for
methodis not the id of an installed combination method.
See also
- ctfr.methods.mean_from_specs(specs_tensor, **kwargs)
Alias for
ctfr.ctfr_from_specs(specs_tensor, method=mean, **kwargs).
- ctfr.methods.hmean_from_specs(specs_tensor, **kwargs)
Alias for
ctfr.ctfr_from_specs(specs_tensor, method=hmean, **kwargs).
- ctfr.methods.gmean_from_specs(specs_tensor, **kwargs)
Alias for
ctfr.ctfr_from_specs(specs_tensor, method=gmean, **kwargs).
- ctfr.methods.min_from_specs(specs_tensor, **kwargs)
Alias for
ctfr.ctfr_from_specs(specs_tensor, method=min, **kwargs).
- ctfr.methods.swgm_from_specs(specs_tensor, **kwargs)
Alias for
ctfr.ctfr_from_specs(specs_tensor, method=swgm, **kwargs).
- ctfr.methods.lt_from_specs(specs_tensor, **kwargs)
Alias for
ctfr.ctfr_from_specs(specs_tensor, method=lt, **kwargs).
- ctfr.methods.sls_h_from_specs(specs_tensor, **kwargs)
Alias for
ctfr.ctfr_from_specs(specs_tensor, method=sls_h, **kwargs).
- ctfr.methods.sls_i_from_specs(specs_tensor, **kwargs)
Alias for
ctfr.ctfr_from_specs(specs_tensor, method=sls_i, **kwargs).
- ctfr.methods.fls_from_specs(specs_tensor, **kwargs)
Alias for
ctfr.ctfr_from_specs(specs_tensor, method=fls, **kwargs).