ekaestle / amb_noise_tools

Python functions to preprocess and correlate ambient-noise data and extract phase-velocity curves
23 stars 17 forks source link

ipfn on python #2

Open lakromah opened 4 years ago

lakromah commented 4 years ago

Good day I am trying to run the Example with the numpy version of the algorithm for ipfn. Everything went well except for the line: IPF = ipfn.ipfn(m, aggregates, dimensions). It gives the following error:

AttributeError Traceback (most recent call last)

in () ----> 1 IPF = ipfn.ipfn(m, aggregates, dimensions) AttributeError: type object 'ipfn' has no attribute 'ipfn'
lakromah commented 4 years ago

How do I get rid of this error?

ekaestle commented 4 years ago

Dear Linda,

could you send me the complete error output? I do not get the error when I run the script. The ipfn function is not directly a part of my script but is called from one of the python functions internally, so I suspect there is some problem between different versions of python. I am currently running python 3.8.

Best regards, Emanuel

lakromah commented 4 years ago

Good morning Emmanuel,

Thank you for your response.

I found a corrected version of the script where the only one "ipfn" was used instead of "ipfn.ipfn".So it was an error on the developer's side and it works now.

Kind regards Linda

On Mon, 29 Jun 2020, 23:56 ekaestle, notifications@github.com wrote:

Dear Linda,

could you send me the complete error output? I do not get the error when I run the script. The ipfn function is not directly a part of my script but is called from one of the python functions internally, so I suspect there is some problem between different versions of python. I am currently running python 3.8.

Best regards, Emanuel

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ekaestle/amb_noise_tools/issues/2#issuecomment-651390838, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGHKW3VPRDZUWNO4CXQLE3RZEE2PANCNFSM4OLAMDWA .

lakromah commented 4 years ago

Good day,

Please find the error below. I faced the same problem again this morning even though it worked yesterday.

Kind regards

Linda

ln [8]: runfile('/home/linda/Documents/ipfn.py', wdir='/home/linda/Documents')

Traceback (most recent call last):

File "", line 1, in

runfile('/home/linda/Documents/ipfn.py', wdir='/home/linda/Documents')

File "/home/linda/anaconda2/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile

execfile(filename, namespace)

File "/home/linda/anaconda2/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 102, in execfile

builtins.execfile(filename, *where)

File "/home/linda/Documents/ipfn.py", line 9, in

from ipfn import *

File "ipfn.py", line 69, in

IPF = ipfn(df, aggregates, dimensions)

NameError: name 'ipfn' is not defined

On Tue, 30 Jun 2020 at 08:37, Linda Akromah lakromah60@gmail.com wrote:

Good morning Emmanuel,

Thank you for your response.

I found a corrected version of the script where the only one "ipfn" was used instead of "ipfn.ipfn".So it was an error on the developer's side and it works now.

Kind regards Linda

On Mon, 29 Jun 2020, 23:56 ekaestle, notifications@github.com wrote:

Dear Linda,

could you send me the complete error output? I do not get the error when I run the script. The ipfn function is not directly a part of my script but is called from one of the python functions internally, so I suspect there is some problem between different versions of python. I am currently running python 3.8.

Best regards, Emanuel

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ekaestle/amb_noise_tools/issues/2#issuecomment-651390838, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHGHKW3VPRDZUWNO4CXQLE3RZEE2PANCNFSM4OLAMDWA .

ekaestle commented 4 years ago

Hi Linda, I cannot say for sure what the problem is, because the IPFN function is not a direct part of my scripts. It may be a problem of using Windows, IPython and the multiprocessing routines. Some people have reported that this combination can cause trouble (see for example here).

You could try one of the following to solve the issue: (1) run it from a console window, (2) run it from a Linux/Mac system if available or (3) try to update to Python 3.x and see if it solves the problem.

Otherwise, you can just decide to not use the parallel FFT computation. If your dataset is not very large, you won't notice a big difference. Attached, you find the example2.py without parallization. This hopefully solves the problem.

Best regards, Emanuel

example2_sequential.py.zip