obspy.signal.freqattributes.mper bug??

Hi,
I am having a problem with obspy.signal.freqattributes.welch, I use it as follows,

st = read(…)
st.merge()

Nfft = 1024
L = 600
over = 0.9
win = np.hanning(L)
Px = welch(data=st[0].data, win=win, Nfft=Nfft, L=L, over=over)

and get the following error,

ValueError Traceback (most recent call last)

/home/davcra/ in ()

/usr/lib/python2.6/site-packages/obspy.signal-0.7.0-py2.6-linux-x86_64.egg/obspy/signal/freqattributes.pyc in welch(data, win, Nfft, L, over)
81 Px = 0
82 for _i in xrange(nsect):
—> 83 Px = Px + mper(data, win, Nfft, n1, n2) / nsect
84 n1 = n1 + n0
85 n2 = n2 + n0

/usr/lib/python2.6/site-packages/obspy.signal-0.7.0-py2.6-linux-x86_64.egg/obspy/signal/freqattributes.pyc in mper(data, win, Nfft, n1, n2)
47 n = n2 - n1
48 U = pow(np.linalg.norm([win]), 2) / n
—> 49 xw = data * win
50 Px = pow(abs(fftpack.fft(xw, Nfft)), 2) / (n * U)
51 Px[0] = Px[1]

ValueError: shape mismatch: objects cannot be broadcast to a single shape

it looks like the data limits (n1 and n2) get passed to mper but then are never used.

Best,
David

Hi all,

Is there a way to plot a beachball at text file like this http://www.ldeo.columbia.edu/~mwest/museum/focalmech.gif ?

Thank you,
Nikos

Hi Nikos,

not within ObsPy. But you could use ObsPy to create a picture and then use some service or program to convert it to ASCII (e.g. this one: http://picascii.com/).

Cheers!

Lion