utils module does not support Coordinates
pyfar.utils.concatenate_channels does not support pyfar.Coordinates. Perhaps we could add support for this; the operation should be performed on the Cartesian coordinates and the weights, if not None.
same for the rest of the utils submodule. somehow related is #831
proposed solution
Proposal for extending the utils module for all pyfar Objekts. First step, include Coordinates:
each class should implement broadcast_cshape and broadcast_cdim then pyfar.utils.broadcast_cshape(object) can call this method for all inserted object.
in this way the class specific logic would stay in the class, which makes it easier to maintain and test.
Example usage
this means that the user can do the following:
signal = pf.Signal(np.ones(10))
pf.utils.broadcast_cshape(signal, (2,2))
signal.broadcast_cshape((2,2))
# same for coordinates
coords = pf.Coordinates(np.ones(10), 1, 1)
pf.utils.broadcast_cshape(coords , (2,2))
coords.broadcast_cshape((2,2))
further ideas
One could also go further and define a abstract parent class for all pyfar classen, this class forces all childs to implement certain methods such as broadcast_cshape, broadcast_cshape and also io releated methods such as _encode and _decode and others. This would also make sure, that all our classes shares common properties, such as the cshape concept.