Change default value of always_2d to False #133
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While I'm at suggesting breaking changes (see #132), I thought I might as well suggest another one ...
We discussed this already to quite some length in #16, but while I'm using it, I get the feeling that we may have chosen the wrong pill.
Arguments for
always_2d=True:Arguments for
always_2d=False:I think we should simplify the interactive case, where being concise and the amount of typing matters most.
In the non-interactive case, it would even make the code more explicit and therefore easier to read, if people are forced to explicitly add
always_2d=True.This would be the equivalent to (but of course much simpler than) manually checking for the dimensions of an input array and reshaping it to the expected dimensionality, which is for sure done in many code bases.
There are several functions (like
matplotlib.pyplot.specgram()) which only work on one-dimensional signals.For those it would clearly be more practical to use
always_2d=False.There are other functions (like
numpy.fft.rfft()) which work by default onaxis=-1.This works smoothly with
always_2d=False, but it fails silently (just giving a completely wrong result) withalways_2d=True.For multi-channel files, people will have to explicitly use
axis=0anyway, there is no way around this (and if they forget, they will get unexpected - a.k.a. wrong - results).I would expect to be able to do the simple steps
without having to specify some cryptic argument
always_2d=False.For people working mainly with mono signals (which is probably the majority of people working in audio and especially speech signal processing), it would be much more natural to have
always_2d=Falseas default setting.It would also make things simpler for people learning signal processing with NumPy/SciPy.
Here are 2 examples where I had to explicitly add
always_2d=False:http://nbviewer.jupyter.org/github/mgeier/jupyter-presentation/blob/master/jupyter-presentation.ipynb
http://nbviewer.jupyter.org/github/spatialaudio/communication-acoustics-exercises/blob/master/ir-solutions.ipynb
This makes the following steps much simpler and easier to understand, but of course the explicit argument
always_2d=Falseconfuses the hell out of students and colleagues.