Skip to content
This repository has been archived by the owner on Feb 14, 2019. It is now read-only.

error on calling .flatness() method #6

Open
dheathar opened this issue Dec 19, 2014 · 2 comments
Open

error on calling .flatness() method #6

dheathar opened this issue Dec 19, 2014 · 2 comments

Comments

@dheathar
Copy link

Hi,
i am using pimyr library and i had the following error

Traceback (most recent call last):
File "/Users/panayiotis/PycharmProjects/MirFramework/mirFramework.py", line 106, in
flatness_SFeat.append(m.flatness())
File "/Library/Python/2.7/site-packages/pymir/Spectrum.py", line 116, in flatness
geometricMean = scipy.stats.mstats.gmean(abs(self),axis=0)
File "/Library/Python/2.7/site-packages/scipy/stats/stats.py", line 508, in gmean
return np.exp(log_a.mean(axis=axis))
TypeError: mean() got an unexpected keyword argument 'axis'

on the following function

    flatness_SFeat = [m.flatness() for m in spectra]                # Spectral Flatness

where spectra is calculated from the following
spectra = [f.spectrum() for f in fixedFrames]

any idea?

@hihell
Copy link

hihell commented May 4, 2015

I have the same problem, fixed by following (in Spectrum.py):

asArray = self.view(numpy.ndarray)
geometricMean = scipy.stats.mstats.gmean(abs(asArray), axis=0)

you need to translate type spectrum back to numpy array to make it work

@dheathar
Copy link
Author

dheathar commented May 4, 2015

I will try it!
Thanks for replying!!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants