From: Pierre H. <pie...@cr...> - 2013-10-25 12:57:25
|
Hello, Now that that PR #2522 is merged, I don't know how much futher commenting is useful, but I think there are two API details that I feel could be better : 1) API dissymetry The new pyplot/axes API is now: * 1 function *spectgram* now uses a mode argument to tune this behavior : *mode*: [ 'default' | 'psd' | 'magnitude' | 'angle' | 'phase' ] What sort of spectrum to use. Default is 'psd'. which takes the power spectral density. 'complex' returns the complex-valued frequency spectrum. 'magnitude' returns the magnitude spectrum. 'angle' returns the phase spectrum without unwrapping. 'phase' returns the phase spectrum with unwrapping. * 3 new functions *phase_spectrum, angle_spectrum, magnitude_spectrum* which complement the exising psd/csd -> I think this contributes to overcrowding axes/pyplot API. I like much better what is done with specgram so I would propose to add just one new function, for example *spectrum*(...mode='magnitude/angle/phase'). Using the same /mode /keyword as for specgram would increase the coherence of the API. 2) default NFFT value being hidden from views used to be def specgram(x, NFFT=256, Fs=2, ... now is def specgram(x, NFFT=None, Fs=None I think that NFFT is an important parameter of the spectrum computation. It should not be /hidden from the immediate view of the user/. The fact it is set to 256 is an arbitrary choice and I think it even teaches something to the user (if he doesn't know what it is). Such a fixed value is an "invitation to change it". Now with NFFT=None, it is more likely to imply "a good choice was made for you", which is not true (because there is no such good choice for all datasets). best, Pierre |