Polarization error message

Dear Obspy users;I am running obspy 1.1.0 for Python 3.6.3 on a MacOsX 10.13.2
Can anybody help me finding out what is the error I am getting when running polarization_analisys. Doesn’t seem to be the parameters I am using as input, but some python coding problem that could be related to the version.

result = polarization.polarization_analysis(stream=s,win_len=‘10.0’,win_frac=0.5,frqlow=0.1,frqhigh=10.,stime=s[0].stats.starttime,etime=s[0].stats.endtime,verbose=True,method=‘flinn’)
stream contains following traces:
3 Trace(s) in Stream:
OV.VTCE.1M.HHE | 2017-08-27T10:38:56.459961Z - 2017-08-27T10:41:16.459961Z | 100.0 Hz, 14001 samples
OV.VTCE.1M.HHN | 2017-08-27T10:38:56.459961Z - 2017-08-27T10:41:16.459961Z | 100.0 Hz, 14001 samples
OV.VTCE.1M.HHZ | 2017-08-27T10:38:56.459961Z - 2017-08-27T10:41:16.459961Z | 100.0 Hz, 14001 samples
stime = 2017-08-27T10:38:56.459961Z, etime = 2017-08-27T10:41:16.459961Z
Traceback (most recent call last):
File “”, line 1, in
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/obspy/signal/polarization.py”, line 494, in polarization_analysis
nsamp = int(win_len * fs)
TypeError: can’t multiply sequence by non-int of type ‘float’

Many thanks;

Hi,

your call includes

win_len=‘10.0’,

which is a “string” in Python, replace by

win_len=10.0,

Cheers,

tom

Hi Javier,

why should the win_len parameter be a string? Just remove the single quotes and it should work.

Best Joachim

Change win_len = 10.0 instead of ’10.0’

polarization.polarization_analysis(stream=s,win_len=10.0,win_frac=0.5,frqlow=0.1,frqhigh=10.,stime=s[0].stats.starttime,etime=s[0].stats.endtime,verbose=True,method=‘flinn’)

Win_len cannot be a string of type sequence, python cannot multiply a string (sequnce; win_len=’10.0’) by a float fs…

7870E4F630DD4FDFA00A2AFCEB0D5B4C.png

Thank you for your answer. That made the trick, sorry I didn’t see the mistake. Although, it is weird, because it works ok with method = ‘vidale’.

Thank you;