sniklaus / pytorch-pwc

a reimplementation of PWC-Net in PyTorch that matches the official Caffe version
GNU General Public License v3.0
616 stars 123 forks source link

ImportError: cannot import name correlation #3

Closed fuxiang87 closed 6 years ago

fuxiang87 commented 6 years ago

What's the solution for "ImportError: cannot import name correlation"? I didn't find the def correlation in correlation.py.

sniklaus commented 6 years ago

Are you using Python 2 by chance? If so, does the problem still persist with Python 3 instead?

sniklaus commented 6 years ago

I just updated the affected code and am hence closing this issue for now. Please feel free to reopen it in case you are still seeing this error with the most recent version of the code. Thank you for bringing this issue to my attention.

mia1601 commented 5 years ago

How to resolve this error, "ImportError: cannot import name 'correlate'"? I am using Python 3.5.

sniklaus commented 5 years ago

Does that error occur when running run.py when executing it from the same directory?

mia1601 commented 5 years ago

I am not sure what you are asking. I new to obspy. But this is what I am doing.

from obspy.signal.cross_correlation import correlate cc = correlate(tr1, tr2, 1000) shift, value = xcorr_max(cc) round(value, 2)

I have my own traces whose correlation I am trying to find. I used xcorr function initially like this "corr=xcorr(tr1, tr2, shift_len=0, full_xcorr=True)" which is giving me this result "(0, 0.9034900314816721, array([0.90349003]))". It always give just one value of correlation and that at the 0th location. I am not sure how correct that correlation is. Figure is attached. figure_1

In the hope of getting the full correlation, I tried using the correlation function but it gives me import error. Further, in the xcorr_max function, I am getting another error, "AttributeError: 'tuple' object has no attribute 'max'".

sniklaus commented 5 years ago

I am afraid that this repository is not related to obspy. You might want to consider asking your question over here: https://github.com/obspy/obspy