pyfar.utils¶
Functions:
|
Broadcast a signal to a certain cdim. |
|
Broadcast multiple signals to a common cdim. |
|
Broadcast a signal to a certain cshape. |
|
Broadcast multiple signals to a common cshape. |
|
Merge multiple Signal, Timedata or Frequencydata objects along a given caxis. |
- pyfar.utils.broadcast_cdim(signal, cdim)[source]¶
Broadcast a signal to a certain cdim.
The channel dimension (cdim) is the length of the
cshape
of the signal. The signal is broadcasted to cdim by prependingcdim - len(signal.cshape)
dimensions.- Parameters:
signal (Signal, TimeData, FrequencyData) – The signal to be broadcasted.
cdim (int) – The cdim to which signal is broadcasted.
- Returns:
signal – The broadcasted copy input signal
- Return type:
- pyfar.utils.broadcast_cdims(signals, cdim=None)[source]¶
Broadcast multiple signals to a common cdim.
The channel dimension (cdim) is the length of the
cshape
of the signal. The signals are broadcasted to cdim by prependingcdim - len(signal.cshape)
dimensions.- Parameters:
signals (tuple of Signal, TimeData, FrequencyData) – The signals to be broadcasted in a tuple.
cdim (int, optional) – The cdim to which signal is broadcasted. If cdim is
None
the signals are broadcasted to the largest cdim. The default isNone
.
- Returns:
signals – The broadcasted copies of the input signals in a tuple.
- Return type:
tuple of Signal, TimeData, FrequencyData
- pyfar.utils.broadcast_cshape(signal, cshape)[source]¶
Broadcast a signal to a certain cshape.
The
cshape
of the signal is broadcasted following the numpy broadcasting rules- Parameters:
signal (Signal, TimeData, FrequencyData) – The signal to be broadcasted.
cshape (tuple) – The cshape to which signal is broadcasted.
- Returns:
signal – Broadcasted copy of the input signal
- Return type:
- pyfar.utils.broadcast_cshapes(signals, cshape=None)[source]¶
Broadcast multiple signals to a common cshape.
The
cshape
of the signals are broadcasted following the numpy broadcasting rules- Parameters:
signals (tuple of Signal, TimeData, FrequencyData) – The signals to be broadcasted in a tuple.
cshape (tuple, optional) – The cshape to which the signals are broadcasted. If cshape is
None
it is determined from the cshapes of the input signals usingnumpy.broadcast_shapes
. The default isNone
.
- Returns:
signals – The broadcasted copies of the input signals in a tuple.
- Return type:
tuple of Signal, TimeData, FrequencyData
- pyfar.utils.concatenate_channels(signals, caxis=0, broadcasting=False)[source]¶
Merge multiple Signal, Timedata or Frequencydata objects along a given caxis.
- Parameters:
signals (tuple of Signal, TimeData or FrequencyData) – The signals to concatenate. All signals must be of the same object type and either have the same cshape or be broadcastable to the same cshape, except in the dimension corresponding to caxis (the first, by default). If this is the case, set
broadcasting=True
.caxis (int) – The caxis along which the signals are concatenated. More details and background about caxis is given in the concepts of
Audio classes
. The default is0
.broadcasting (bool) –
If this is
True
, the signals will be broadcasted to common cshape, except for the caxis along which the signals are concatenated. Thecshape
of the signals are broadcasted following the numpy broadcasting rules The default isFalse
.
- Returns:
merged – The merged signal object.
- Return type: