Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SeisNoise.correlate corr_type arguments #97

Closed
mcardenass opened this issue Nov 19, 2021 · 2 comments
Closed

SeisNoise.correlate corr_type arguments #97

mcardenass opened this issue Nov 19, 2021 · 2 comments

Comments

@mcardenass
Copy link

Hello Timothy,

I'm trying to use arguments in corr_type's correlate function. I am particularly interested in using coherence and PCC. However, these do not work. For example:
C = correlate (FFT [jj], FFT [kk],maxlag, corr_type= "PCC")

I am also interested in using the phase-weighted stack in the next sentence:
stack!(C, allstack = true)
How include the argument?

Thanks for the feedback

@tclements
Copy link
Collaborator

Hello - thanks for pointing this out! Apologies, I believe the documentation is a little unclear here - if you want to use the PCC, you need to use the phase function to create FFTData from RawData. Here is a MWE for using phase:

using SeisNoise, SeisIO
fs = 40. # sampling frequency in Hz
freqmin,freqmax = 0.1,0.2 # min and max frequencies
cc_step, cc_len = 450, 1800 # corrleation step and length in S
maxlag = 60. # maximum lag time in correlation
s = "2019-02-03"
t = "2019-02-04"
S1 = get_data("FDSN","CI.SDD..BHZ",src="SCEDC",s=s,t=t)
S2 = get_data("FDSN","CI.PER..BHZ",src="SCEDC",s=s,t=t)
R = RawData.([S1,S2],cc_len,cc_step)
FFT = phase.(R) # use phase function to get analytic representation 
C = correlate(FFT[1],FFT[2],maxlag, corr_type="PCC") 

I need to make a fix for the phase function, will get that out shortly. I can also have the correlate function automatically check if we should use the ifft or irfft in the correlate function based on the size of the input FFTData.

For the stack and stack! functions you would do:

stack!(C, allstack=true, stacktype=pws)

or you could just use the pws function:

pws(C, pow)

which will do the same thing.

Looks like I need to fix the docstring in stack!. to correctly use stacktype.

@mcardenass
Copy link
Author

Thanks Timothy, functions are working

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

No branches or pull requests

2 participants