John Hunter wrote: > On Tue, Nov 11, 2008 at 1:38 PM, Ryan May <[EMAIL PROTECTED]> wrote: > >> 1) Have psd(x) call csd(x,x) >> 2) Have csd() check if y is x, and if so, avoid doing the extra work. >> >> Would this be an acceptable solution to reduce code duplication? > > Sure, that should work fine.
Ok, I noticed that specgram() duplicated much of the same code, so I factored it all out and made a _spectral_helper() function, which pretty much implements a cross-spectrogram. csd() and specgram() use this, and then psd still calls csd(). Now all of the spectral analysis stuff is using the same computational code base. >> On a separate note, once I get done with these tweaks, are there any >> objections to submitting something based on this to scipy? > > No objections here -- if it were put into numpy though, we could > depend on it and avoid the duplication. I would campaign for numpy > first, eg np.fft.psd, etc. I agree it'd be better for us if it went to numpy, but I've gotten the sense that they're not really receptive to adding things like this now. I'll give it a try, but I sense that scipy.signal would end up being a more likely home. That wouldn't help us with duplication, but would help the community at large. It's always bugged me that I can't just grab a psd() function from my general computing packages. (In my opinion, anything in mlab that doesn't involve plotting should really exist in a more general package.) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel