From: Todd <tod...@gm...> - 2013-10-22 16:49:00
|
On Tue, Oct 22, 2013 at 5:41 PM, Pierre Haessig <pie...@cr...>wrote: > Hi, > > Le 22/10/2013 12:31, Todd a écrit : > > Currently, both axes.psd and axes.csd return the same thing as > > mlab.psd and mlab.csd, namely the spectrum and frequency points. They > > do NOT return the line object that was plotted. This is different > > than specgram, which returns the AxesImage object that was plotted in > > addition to the mlab.specgram return values. > > > > I think having access to the line object is important, so > > axes.magnitude_spectrum, axes.angle_spectrum, and axes.phase_spectrum > > do return the line object. I know this is inconsistent, but I think > > it is very important and would strongly objefct to removing this. > > > > The question, then, is whether this would be a good opportunity to add > > the line object to the returned values for axes.psd and axes.csd. > > This would be an API break, but would be very easy to fix, and it may > > be beneficial enough to warrant it. What does everyone think? > > I agree that it may be nice to have plt.psd/csd to return lines just > like plt.plot for increased consistency. I guess that returning the > values comes from Matlab style inspiration. > > Maybe breaking the API is too strong. In that case, adding a > transitional keyword (for example `return_line=False`) to psd/csd may > help introduce your new proposed behavior in a softer manner. What do > you think ? > > Of course, for your new functions, there is no API breakage problem. > > best, > Pierre > I considered that solution as well, but it seemed ugly. However, I think having it available is important, so I will add it. The current behavior can probably be deprecated at some point, allowing for a smoother transition. |