Skip to content
Snippets Groups Projects
Commit 3235b990 authored by Jan Thorbecke's avatar Jan Thorbecke
Browse files

added shift=1 option for fw wavelet in makewave

parent 1b2c2586
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@
bin/*
*.su
*.bin
*/.DS*
*/*/.DS*
.DS*
Make_include
fdelmodc_cuda.tgz
......
File deleted
......@@ -33,7 +33,7 @@ void hilbertTrans(float *data, int nsam);
void freqwave(float *wave, int nt, float dt, float fp, float fmin, float flef, float frig, float fmax, float t0, float db, int shift, int cm, int cn, char *w, float scale, int scfft, int inverse, float eps, int verbose)
{
int iof, nfreq, nf, i, j, sign, optn, stored;
int it, iof, nfreq, nf, i, j, sign, optn, stored;
int ifmin1, ifmin2, ifmax1, ifmax2;
float df, fact, alfa, f, max, freq, att, ampl, phase;
float tt, dum;
......@@ -182,6 +182,26 @@ void freqwave(float *wave, int nt, float dt, float fp, float fmin, float flef, f
cwave[j].r = 0.0;
cwave[j].i = 0.0;
}
if (shift == 1) {
sign = 1;
cr1fft(cwave, rwave, optn, sign);
max = rwave[0]*rwave[0];
for (i = 1; i < optn; i++) {
if (rwave[i] < 0.0) { it=i; break;}
}
it = it;
dum = 0.0;
for (j = 0; j < it; j++)
dum += fabs(rwave[j]);
max = dum;
for (i = 1; i < optn/2; i++) {
dum = dum - fabs(rwave[i-1]) + fabs(rwave[i+it-1]);
//fprintf(stderr,"dum=%f i=%d\n", dum, i);
if ((dum)>(0.03*max*att/it)) {
t0 = (float)i*dt;
}
}
}
for (iof = 0; iof < nfreq; iof++) {
f = iof*df;
tmp.r = cwave[iof].r*cos(2.0*M_PI*f*t0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment