Commit dd778c01 authored by Florian Wittkamp's avatar Florian Wittkamp

Switched naming of frequency filter variables

I switched the naming of the variables of the frequency filtering to a more clear and easy one.
The change affects the JSON input file and the code itself.
The following renaming is used:
FC_START -> F_LOW_PASS_START
FC_END   -> F_LOW_PASS_END
FC_INCR  -> F_LOW_PASS_INCR
FC_EXT   -> F_LOW_PASS_EXT
FC       -> F_LOW_PASS
F_HP     -> F_HIGH_PASS

However, old JSON files will also work for now. If one of the old variables is not found, IFOS will search for the corresponding old one. This option will be removed in a future release.
parent 879a9627
......@@ -686,10 +686,10 @@ For more information see chapter \ref{cha:STF-Inversion}.
{\color{blue}{\begin{verbatim}
"Frequency filtering during inversion" : "comment",
"TIME_FILT" : "0",
"F_HP" : "1",
"FC_START" : "10.0",
"FC_END" : "75.0",
"FC_INCR" : "10.0",
"F_HIGH_PASS" : "1",
"F_LOW_PASS_START" : "10.0",
"F_LOW_PASS_END" : "75.0",
"F_LOW_PASS_INCR" : "10.0",
"ORDER" : "2",
"ZERO_PHASE" : "0",
"FREQ_FILE" : "frequencies.dat",
......@@ -706,13 +706,13 @@ Default values are:
MIN_ITER=0
\end{verbatim}}}
TIME\_FILT = 1 can be set to use frequency filtering. The parameter FC\_START defines the corner frequency of the Butterworth low pass filter at the beginning of the inversion. The parameter FC\_END defines the maximum corner frequency used in the inversion. The parameter FC\_INCR controls in which steps the bandwidth is increased during the inversion.
TIME\_FILT = 1 can be set to use frequency filtering. The parameter F\_LOW\_PASS\_START defines the corner frequency of the Butterworth low pass filter at the beginning of the inversion. The parameter F\_LOW\_PASS\_END defines the maximum corner frequency used in the inversion. The parameter F\_LOW\_PASS\_INCR controls in which steps the bandwidth is increased during the inversion.
If TIME\_FILT = 2 individual frequencies for each step can be read from FREQ\_FILE. In this file the first entry must be the number of frequencies used for filtering. Each frequency in Hz has to be specified in a row. The example file frequencies.dat can be found in \texttt{trunk/par}.
The parameter ORDER defines the order of the Butterworth low pass filter. If the variable ZERO\_PHASE is set to one a zero phase filter is applied. It is realized by filtering the traces in both forward and reverse direction with the defined Butterworth low pass filter. Therefore, the effective order of the low pass filter is doubled.
With F\_HP an additional high pass filter can be applied, where F\_HP is the corner frequency in Hz.
With F\_HIGH\_PASS an additional high pass filter can be applied, where F\_HIGH\_PASS is the corner frequency in Hz.
With the parameter PRO (see~\ref{json:abort_criterion}) one has to adjust the criterion that defines at which points the bandwidth of the signals are increased.
......
......@@ -164,10 +164,10 @@
"Frequency filtering during inversion" : "comment",
"TIME_FILT" : "0",
"F_HP" : "1",
"FC_START" : "10.0",
"FC_END" : "75.0",
"FC_INCR" : "10.0",
"F_HIGH_PASS" : "1",
"F_LOW_PASS_START" : "10.0",
"F_LOW_PASS_END" : "75.0",
"F_LOW_PASS_INCR" : "10.0",
"ORDER" : "2",
"ZERO_PHASE" : "0",
"FREQ_FILE" : "frequencies.dat",
......
......@@ -127,8 +127,8 @@
"Frequency filtering during inversion" : "comment",
"TIME_FILT" : "1",
"FC_START" : "10.0",
"FC_END" : "70.0",
"FC_INCR" : "10.0",
"F_LOW_PASS_END" : "70.0",
"F_LOW_PASS_INCR" : "10.0",
"ORDER" : "4",
"Minimum number of iteration per frequency" : "comment",
......
......@@ -139,9 +139,9 @@
"Frequency filtering during inversion" : "comment",
"TIME_FILT" : "0",
"FC_START" : "5.0",
"FC_END" : "5.0",
"FC_INCR" : "10.0",
"F_LOW_PASS_START" : "5.0",
"F_LOW_PASS_END" : "5.0",
"F_LOW_PASS_INCR" : "10.0",
"ORDER" : "4",
"Minimum number of iteration per frequency" : "comment",
......
......@@ -136,10 +136,10 @@
"Frequency filtering during inversion" : "comment",
"TIME_FILT" : "0",
"F_HP" : "1",
"FC_START" : "10.0",
"FC_END" : "70.0",
"FC_INCR" : "10.0",
"F_HIGH_PASS" : "1",
"F_LOW_PASS_START" : "10.0",
"F_LOW_PASS_END" : "70.0",
"F_LOW_PASS_INCR" : "10.0",
"ORDER" : "4",
"ZERO_PHASE" : "1",
......
This diff is collapsed.
......@@ -24,7 +24,7 @@
#include "fd.h"
void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, float C_vp, float ** gradp, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float FC){
void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, float C_vp, float ** gradp, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float F_LOW_PASS){
extern int NX, NY, IDX, IDY, SPATFILTER, GRAD_FILTER;
extern int FORWARD_ONLY, SWS_TAPER_GRAD_VERT, SWS_TAPER_GRAD_HOR, SWS_TAPER_GRAD_SOURCES, SWS_TAPER_FILE;
......@@ -99,7 +99,7 @@ void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int
spat_filt(waveconv,iter,1);}
/* apply 2D-Gaussian filter*/
if(GRAD_FILTER==1){smooth(waveconv,1,1,Vs_avg,FC);}
if(GRAD_FILTER==1){smooth(waveconv,1,1,Vs_avg,F_LOW_PASS);}
/* output of the preconditioned gradient */
for (i=1;i<=NX;i=i+IDX){
......@@ -331,7 +331,7 @@ void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int
spat_filt(waveconv_u,iter,2);}
/* apply 2D-Gaussian filter*/
if(GRAD_FILTER==1){smooth(waveconv_u,2,1,Vs_avg,FC);}
if(GRAD_FILTER==1){smooth(waveconv_u,2,1,Vs_avg,F_LOW_PASS);}
/* output of the preconditioned gradient */
for (i=1;i<=NX;i=i+IDX){
......@@ -558,7 +558,7 @@ void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int
spat_filt(waveconv_rho,iter,3);}
/* apply 2D-Gaussian filter*/
if(GRAD_FILTER==1){smooth(waveconv_rho,3,1,Vs_avg,FC);}
if(GRAD_FILTER==1){smooth(waveconv_rho,3,1,Vs_avg,F_LOW_PASS);}
/* output of the preconditioned gradient */
for (i=1;i<=NX;i=i+IDX){
......
......@@ -24,7 +24,7 @@
#include "fd.h"
void PCG_SH(float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float FC){
void PCG_SH(float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float F_LOW_PASS){
extern int NX, NY, IDX, IDY, SPATFILTER, GRAD_FILTER;
extern int FORWARD_ONLY, SWS_TAPER_GRAD_VERT, SWS_TAPER_GRAD_HOR, SWS_TAPER_GRAD_SOURCES, SWS_TAPER_FILE;
......@@ -91,7 +91,7 @@ void PCG_SH(float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int
spat_filt(waveconv_u,iter,2);}
/* apply 2D-Gaussian filter*/
if(GRAD_FILTER==1){smooth(waveconv_u,2,1,Vs_avg,FC);}
if(GRAD_FILTER==1){smooth(waveconv_u,2,1,Vs_avg,F_LOW_PASS);}
/* output of the preconditioned gradient */
for (i=1;i<=NX;i=i+IDX){
......@@ -320,7 +320,7 @@ void PCG_SH(float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int
spat_filt(waveconv_rho,iter,3);}
/* apply 2D-Gaussian filter*/
if(GRAD_FILTER==1){smooth(waveconv_rho,3,1,Vs_avg,FC);}
if(GRAD_FILTER==1){smooth(waveconv_rho,3,1,Vs_avg,F_LOW_PASS);}
/* output of the preconditioned gradient */
for (i=1;i<=NX;i=i+IDX){
......
......@@ -23,7 +23,7 @@
#include "fd.h"
void apply_workflow(float ** workflow,int workflow_lines,char workflow_header[STRING_SIZE],int *iter,float *FC,int wavetype_start, int * change_wavetype_iter, int * LBFGS_iter_start){
void apply_workflow(float ** workflow,int workflow_lines,char workflow_header[STRING_SIZE],int *iter,float *F_LOW_PASS,int wavetype_start, int * change_wavetype_iter, int * LBFGS_iter_start){
/* local variables */
int x;
......@@ -90,12 +90,12 @@ void apply_workflow(float ** workflow,int workflow_lines,char workflow_header[ST
/* Frequency filtering */
if(TIME_FILT==1) {
TIME_FILT=workflow[WORKFLOW_STAGE][6];
if(*FC>workflow[WORKFLOW_STAGE][7]&&(workflow[WORKFLOW_STAGE][6]>0)) {
if(MYID==0)printf("\n Due to the abort criteriom FC is already higher than specified in workflow\n");
if(MYID==0)printf(" therefore instead of %.2f HZ FC=%.2f HZ is used\n",workflow[WORKFLOW_STAGE][7],*FC);
if(*F_LOW_PASS>workflow[WORKFLOW_STAGE][7]&&(workflow[WORKFLOW_STAGE][6]>0)) {
if(MYID==0)printf("\n Due to the abort criteriom F_LOW_PASS is already higher than specified in workflow\n");
if(MYID==0)printf(" therefore instead of %.2f HZ F_LOW_PASS=%.2f HZ is used\n",workflow[WORKFLOW_STAGE][7],*F_LOW_PASS);
} else {
if(*FC!=workflow[WORKFLOW_STAGE][7]) *LBFGS_iter_start=*iter;
*FC=workflow[WORKFLOW_STAGE][7];
if(*F_LOW_PASS!=workflow[WORKFLOW_STAGE][7]) *LBFGS_iter_start=*iter;
*F_LOW_PASS=workflow[WORKFLOW_STAGE][7];
}
} else {
if(MYID==0&&(workflow[WORKFLOW_STAGE][6]>0))printf("\n TIME_FILT cannot be activated due to it is not activated in the JSON File \n");
......
......@@ -26,7 +26,7 @@ double calc_energy(float **sectiondata, int ntr, int ns, float energy, int ntr_g
/* declaration of variables */
extern float DT;
extern int MYID, USE_WORKFLOW, WORKFLOW_STAGE;
extern int TRKILL, NORMALIZE, FC, TIMEWIN;
extern int TRKILL, NORMALIZE, F_LOW_PASS, TIMEWIN;
extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY;
int i, j;
......
......@@ -26,7 +26,7 @@ double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LN
/* declaration of variables */
extern float DT;
extern int MYID, USE_WORKFLOW, WORKFLOW_STAGE;
extern int TRKILL, NORMALIZE, FC, TIMEWIN;
extern int TRKILL, NORMALIZE, F_LOW_PASS, TIMEWIN;
extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY;
......
......@@ -26,7 +26,7 @@ double calc_res(float **sectiondata, float **section, float **sectiondiff, float
/* declaration of variables */
extern float DT, WATERLEVEL_LNORM8;
extern int REC1, REC2, MYID, ACOUSTIC;
extern int TRKILL, NORMALIZE, FC, TIMEWIN;
extern int TRKILL, NORMALIZE, F_LOW_PASS, TIMEWIN;
extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY, USE_WORKFLOW, WORKFLOW_STAGE;
float RMS, signL1;
......
......@@ -60,7 +60,7 @@ void exchange_par(void){
extern int INV_STF, N_STF, N_STF_START;
extern char PARA[STRING_SIZE];
extern int TIME_FILT, ORDER, ZERO_PHASE,WRITE_FILTERED_DATA;
extern float FC_START, FC_END, FC_INCR, F_HP;
extern float F_LOW_PASS_START, F_LOW_PASS_END, F_LOW_PASS_INCR, F_HIGH_PASS;
extern int LNORM, DTINV;
extern int STEPMAX;
extern float EPS_SCALE, SCALEFAC;
......@@ -175,9 +175,9 @@ void exchange_par(void){
fdum[39] = npower;
fdum[40] = k_max_PML;
fdum[42] = FC_START;
fdum[43] = FC_END;
fdum[44] = FC_INCR;
fdum[42] = F_LOW_PASS_START;
fdum[43] = F_LOW_PASS_END;
fdum[44] = F_LOW_PASS_INCR;
fdum[45] = EPS_SCALE;
fdum[46] = SCALEFAC;
......@@ -203,7 +203,7 @@ void exchange_par(void){
fdum[58] = A;
fdum[59] = F_HP;
fdum[59] = F_HIGH_PASS;
fdum[60] = JOINT_INVERSION_PSV_SH_ALPHA_VS;
fdum[61] = JOINT_INVERSION_PSV_SH_ALPHA_RHO;
......@@ -457,9 +457,9 @@ void exchange_par(void){
k_max_PML = fdum[40];
FC_START = fdum[42];
FC_END = fdum[43];
FC_INCR = fdum[44];
F_LOW_PASS_START = fdum[42];
F_LOW_PASS_END = fdum[43];
F_LOW_PASS_INCR = fdum[44];
EPS_SCALE = fdum[45];
SCALEFAC = fdum[46];
......@@ -486,7 +486,7 @@ void exchange_par(void){
A = fdum[58];
F_HP = fdum[59];
F_HIGH_PASS = fdum[59];
JOINT_INVERSION_PSV_SH_ALPHA_VS = fdum[60];
JOINT_INVERSION_PSV_SH_ALPHA_RHO = fdum[61];
......
......@@ -33,7 +33,7 @@ void window_cos(float **win, int npad, int nsrc, float it1, float it2, float it3
void catseis(float **data, float **fulldata, int *recswitch, int ntr_glob, MPI_Comm newcomm_nodentr);
void stf(FILE *fp, float **sectionvy, float ** sectionvy_obs, float ** sectionvy_conv, float * source_time_function, int **recpos, int **recpos_loc,
int ntr_glob,int ntr, float ** srcpos, int ishot, int ns, int iter, int nshots, float FC, int SH,int nsrc_glob);
int ntr_glob,int ntr, float ** srcpos, int ishot, int ns, int iter, int nshots, float F_LOW_PASS, int SH,int nsrc_glob);
int **splitrec(int **recpos,int *ntr_loc, int ntr, int *recswitch);
......@@ -186,9 +186,9 @@ void taper(float *section, int ns, float fc);
void output_source_signal(FILE *fp, float **signals, int ns, int seis_form);
void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, float C_vp, float ** gradp, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float FC);
void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, float C_vp, float ** gradp, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float F_LOW_PASS);
void PCG_SH(float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float FC);
void PCG_SH(float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float F_LOW_PASS);
void PML_pro(float * d_x, float * K_x, float * alpha_prime_x, float * a_x, float * b_x,
float * d_x_half, float * K_x_half, float * alpha_prime_x_half, float * a_x_half, float * b_x_half,
......@@ -426,7 +426,7 @@ void zero_fdveps_visc(int ny1, int ny2, int nx1, int nx2, float ** vx, float **
void FLnode(float ** rho, float ** pi, float ** u, float ** taus, float ** taup, float * eta);
void smooth(float ** mat, int sws, int filter, float Vs_avg, float FC);
void smooth(float ** mat, int sws, int filter, float Vs_avg, float F_LOW_PASS);
/* declaration of functions for parser*/
......@@ -515,7 +515,7 @@ void read_workflow(char file_in[STRING_SIZE],float *** workflow, int *workflow_l
float ** joint_inversion_grad ( float ** gradiant_1,float ** gradiant_2, float alpha, int joint_type);
void snap_SH(FILE *fp,int nt, int nsnap, float ** vz, float **u, float **pi, float *hc,int ishot);
void apply_workflow(float ** workflow,int workflow_lines,char workflow_header[STRING_SIZE],int *iter,float *FC,int wavetype_start, int * change_wavetype_iter, int * LBFGS_iter_start);
void apply_workflow(float ** workflow,int workflow_lines,char workflow_header[STRING_SIZE],int *iter,float *F_LOW_PASS,int wavetype_start, int * change_wavetype_iter, int * LBFGS_iter_start);
void eprecond(float ** W, float ** vx, float ** vy);
void eprecond_SH(float ** W, float ** vz);
......
......@@ -31,7 +31,7 @@ extern FILE *FP;
FILE *freqf;
char cline[256];
int IT=1;
float *FC;
float *F_LOW_PASS;
/*----------------------------------- open FREQ_FILE ------------------------------*/
......@@ -48,8 +48,8 @@ fprintf(FP,"\n Reading frequencies from %s \n",FREQ_FILE);
fscanf(freqf,"%i",nfrq);
/*----------------------------alocate frequency array------------------------------*/
FC=vector(1,*nfrq);
//FC = malloc((*nfrq+1) * sizeof(float));
F_LOW_PASS=vector(1,*nfrq);
//F_LOW_PASS = malloc((*nfrq+1) * sizeof(float));
rewind (freqf);
fprintf(FP," Number of freqencies specified: %d \n",*nfrq);
......@@ -57,16 +57,16 @@ fprintf(FP," Number of freqencies specified: %d \n",*nfrq);
/*----------------------Read frequencies from FREQ_FILE----------------------------*/
for (IT=1;IT<=(*nfrq);IT++){
fgets(cline,255,freqf);
fscanf(freqf,"%f",&FC[IT]);
fscanf(freqf,"%f",&F_LOW_PASS[IT]);
//Read only numbers from FREQ_FILE
if(FC[IT]==0){
if(F_LOW_PASS[IT]==0){
IT=IT-1;}else{
fprintf(FP,"\n %d. %.2f Hz",IT,FC[IT]);
fprintf(FP,"\n %d. %.2f Hz",IT,F_LOW_PASS[IT]);
}
}
fclose(freqf);
return(FC);
return(F_LOW_PASS);
}
......@@ -74,7 +74,7 @@ char PARA[STRING_SIZE];
int TIME_FILT, ORDER, ZERO_PHASE;
int WRITE_FILTERED_DATA;
float FC_START, FC_END, FC_INCR, F_HP;
float F_LOW_PASS_START, F_LOW_PASS_END, F_LOW_PASS_INCR, F_HIGH_PASS;
int LNORM, DTINV;
......
......@@ -63,7 +63,7 @@ void read_par_json(FILE *fp, char *fileinp){
extern char PARA[STRING_SIZE];
extern int TIME_FILT, ORDER, ZERO_PHASE,WRITE_FILTERED_DATA;
extern float FC_START, FC_END, FC_INCR, F_HP;
extern float F_LOW_PASS_START, F_LOW_PASS_END, F_LOW_PASS_INCR, F_HIGH_PASS;
extern int LNORM, DTINV;
......@@ -131,6 +131,12 @@ void read_par_json(FILE *fp, char *fileinp){
/* definition of local variables */
int number_readobjects=0,fserr=0;
/* Support naming of variables */
float FC_START, FC_END, FC_INCR, F_HP;
char errormessage[STRING_SIZE2];
char ** varname_list, ** value_list;
......@@ -813,24 +819,43 @@ void read_par_json(FILE *fp, char *fileinp){
if (get_int_from_objectlist("WRITE_FILTERED_DATA",number_readobjects,&WRITE_FILTERED_DATA,varname_list, value_list)){
WRITE_FILTERED_DATA=0;
}
if (get_float_from_objectlist("F_HP",number_readobjects,&F_HP,varname_list, value_list)){
F_HP=0.0;
fprintf(fp,"Variable F_HP is set to default value %f.\n",F_HP);}
if (get_float_from_objectlist("FC_START",number_readobjects,&FC_START,varname_list, value_list))
if (TIME_FILT==1)declare_error("Variable FC_START could not be retrieved from the json input file!");
if (get_float_from_objectlist("FC_END",number_readobjects,&FC_END,varname_list, value_list))
if (TIME_FILT==1)declare_error("Variable FC_END could not be retrieved from the json input file!");
if (get_float_from_objectlist("FC_INCR",number_readobjects,&FC_INCR,varname_list, value_list))
if (TIME_FILT==1)declare_error("Variable FC_INCR could not be retrieved from the json input file!");
if (get_int_from_objectlist("ORDER",number_readobjects,&ORDER,varname_list, value_list))
if (TIME_FILT==1)declare_error("Variable ORDER could not be retrieved from the json input file!");
if (get_float_from_objectlist("F_HIGH_PASS",number_readobjects,&F_HIGH_PASS,varname_list, value_list)){
/* Support of old variable naming: Test if old variable naming is used */
if (get_float_from_objectlist("F_HP",number_readobjects,&F_HIGH_PASS,varname_list, value_list)){
F_HIGH_PASS=0.0;
fprintf(fp,"Variable F_HIGH_PASS is set to default value %f.\n",F_HIGH_PASS);
}
}
if (TIME_FILT==1) {
if (get_float_from_objectlist("F_LOW_PASS_START",number_readobjects,&F_LOW_PASS_START,varname_list, value_list)){
/* Support of old variable naming: Test if old variable naming is used */
if (get_float_from_objectlist("FC_START",number_readobjects,&F_LOW_PASS_START,varname_list, value_list)){
declare_error("Variable F_LOW_PASS_START could not be retrieved from the json input file!");
}
}
if (get_float_from_objectlist("F_LOW_PASS_END",number_readobjects,&F_LOW_PASS_END,varname_list, value_list)){
/* Support of old variable naming: Test if old variable naming is used */
if (get_float_from_objectlist("FC_END",number_readobjects,&F_LOW_PASS_END,varname_list, value_list)){
declare_error("Variable F_LOW_PASS_END could not be retrieved from the json input file!");
}
}
if (get_float_from_objectlist("F_LOW_PASS_INCR",number_readobjects,&F_LOW_PASS_INCR,varname_list, value_list)){
/* Support of old variable naming: Test if old variable naming is used */
if (get_float_from_objectlist("FC_INCR",number_readobjects,&F_LOW_PASS_INCR,varname_list, value_list)){
declare_error("Variable F_LOW_PASS_INCR could not be retrieved from the json input file!");
}
}
if (get_int_from_objectlist("ORDER",number_readobjects,&ORDER,varname_list, value_list)){
declare_error("Variable ORDER could not be retrieved from the json input file!");
}
}
if (get_int_from_objectlist("ZERO_PHASE",number_readobjects,&ZERO_PHASE,varname_list, value_list)){
ZERO_PHASE=0;
fprintf(fp,"Variable ZERO_PHASE is set to default value %i.\n",ZERO_PHASE);}
if (TIME_FILT==2) {
if (get_float_from_objectlist("F_HP",number_readobjects,&F_HP,varname_list, value_list)){
F_HP=0.0;
fprintf(fp,"Variable F_HP is set to default value %f.\n",F_HP);}
if (get_float_from_objectlist("F_HIGH_PASS",number_readobjects,&F_HIGH_PASS,varname_list, value_list)){
F_HIGH_PASS=0.0;
fprintf(fp,"Variable F_HIGH_PASS is set to default value %f.\n",F_HIGH_PASS);}
if (get_string_from_objectlist("FREQ_FILE",number_readobjects,FREQ_FILE,varname_list, value_list))
declare_error("Variable FREQ_FILE could not be retrieved from the json input file!");
if (get_int_from_objectlist("ORDER",number_readobjects,&ORDER,varname_list, value_list))
......
......@@ -22,7 +22,7 @@
#include "fd.h"
void smooth(float ** mat, int sws, int filter, float Vs_avg, float FC)
void smooth(float ** mat, int sws, int filter, float Vs_avg, float F_LOW_PASS)
{
/* extern variables */
......@@ -68,8 +68,8 @@ void smooth(float ** mat, int sws, int filter, float Vs_avg, float FC)
if((GRAD_FILT_WAVELENGTH==1)&&(TIME_FILT==1)){
if(VERBOSE) printf("\n -------------------------------------------------------------------------- \n");
if(VERBOSE) printf("\n Calculating a wavelength dependent filter size for smoothing the gradient: \n");
FILT_SIZE_GRAD = (int)(Vs_avg/FC*A/DH);
if(VERBOSE) printf("\n FILT_SIZE_GRAD = Vs_avg = %4.2f m/s / FC = %4.2f Hz * weighting factor A = %4.2f / grid spacing DH = %4.2f m \n",Vs_avg,FC,A,DH);
FILT_SIZE_GRAD = (int)(Vs_avg/F_LOW_PASS*A/DH);
if(VERBOSE) printf("\n FILT_SIZE_GRAD = Vs_avg = %4.2f m/s / F_LOW_PASS = %4.2f Hz * weighting factor A = %4.2f / grid spacing DH = %4.2f m \n",Vs_avg,F_LOW_PASS,A,DH);
if(VERBOSE) printf("\n New FILT_SIZE_GRAD = %d (grid points) is used (-> %4.2f m). \n",FILT_SIZE_GRAD,FILT_SIZE_GRAD*DH);
}
if (FILT_SIZE_GRAD==0) return;
......
......@@ -24,7 +24,7 @@
#include "stfinv/stfinv.h"
#include "segy.h"
void stf(FILE *fp, float **sectionvy, float ** sectionvy_obs, float ** sectionvy_conv, float * source_time_function, int **recpos, int **recpos_loc, int ntr_glob,int ntr, float ** srcpos, int ishot, int ns, int iter, int nshots, float FC, int SH,int nsrc_glob){
void stf(FILE *fp, float **sectionvy, float ** sectionvy_obs, float ** sectionvy_conv, float * source_time_function, int **recpos, int **recpos_loc, int ntr_glob,int ntr, float ** srcpos, int ishot, int ns, int iter, int nshots, float F_LOW_PASS, int SH,int nsrc_glob){
/* declaration of global variables */
extern float DT, DH;
......@@ -314,15 +314,15 @@ void stf(FILE *fp, float **sectionvy, float ** sectionvy_obs, float ** sectionvy
if((TIME_FILT==1)||(TIME_FILT==2)){
if(SH==0) {
if(USE_WORKFLOW){
sprintf(qw,"%s.stage%d.shot%d_%dHz.su",SIGNAL_FILE,WORKFLOW_STAGE,ishot,(int)FC);
sprintf(qw,"%s.stage%d.shot%d_%dHz.su",SIGNAL_FILE,WORKFLOW_STAGE,ishot,(int)F_LOW_PASS);
} else {
sprintf(qw,"%s.shot%d_%dHz.su",SIGNAL_FILE,ishot,(int)FC);
sprintf(qw,"%s.shot%d_%dHz.su",SIGNAL_FILE,ishot,(int)F_LOW_PASS);
}
} else {
if(USE_WORKFLOW){
sprintf(qw,"%s.stage%d.shot%d_%dHz.su",SIGNAL_FILE_SH,WORKFLOW_STAGE,ishot,(int)FC);
sprintf(qw,"%s.stage%d.shot%d_%dHz.su",SIGNAL_FILE_SH,WORKFLOW_STAGE,ishot,(int)F_LOW_PASS);
} else {
sprintf(qw,"%s.shot%d_%dHz.su",SIGNAL_FILE_SH,ishot,(int)FC);
sprintf(qw,"%s.shot%d_%dHz.su",SIGNAL_FILE_SH,ishot,(int)F_LOW_PASS);
}
}
printf(" PE %d is writing source time function for shot = %d to\n\t %s \n",MYID,ishot,qw);
......
......@@ -38,7 +38,7 @@ void timedomain_filt(float ** data, float fc, int order, int ntr, int ns, int m
*/
/* declaration of extern variables */
extern float DT, F_HP;
extern float DT, F_HIGH_PASS;
extern int ZERO_PHASE, NT,MYID;
/* declaration of local variables */
......@@ -53,8 +53,8 @@ void timedomain_filt(float ** data, float fc, int order, int ntr, int ns, int m
if (ZERO_PHASE==1) seismogram_reverse_hp = dvector(1,ns);
T0=1.0/(double)fc;
if(F_HP)
T0_hp=1.0/(double)F_HP;
if(F_HIGH_PASS)
T0_hp=1.0/(double)F_HIGH_PASS;
if(method==2)
T0_hp=1.0/(double)fc;
......@@ -84,7 +84,7 @@ void timedomain_filt(float ** data, float fc, int order, int ntr, int ns, int m
}
} /* end of itr<=ntr loop */
if ((method==2)||(F_HP)){ /*highpass filter*/
if ((method==2)||(F_HIGH_PASS)){ /*highpass filter*/
for (itr=1;itr<=ntr;itr++){
for (j=1;j<=ns;j++){
seismogram_hp[j]=(double)data[itr][j];
......
......@@ -38,7 +38,7 @@ void timedomain_filt_vector(float * data, float fc, int order, int ns, int meth
*/
/* declaration of external variables */
extern float DT, F_HP;
extern float DT, F_HIGH_PASS;
extern int ZERO_PHASE, NT,MYID;
/* declaration of local variables */
......@@ -56,8 +56,8 @@ void timedomain_filt_vector(float * data, float fc, int order, int ns, int meth
if (ZERO_PHASE==1) seismogram_reverse_hp = dvector(1,ns);
T0=1.0/(double)fc;
if(F_HP)
T0_hp=1.0/(double)F_HP;
if(F_HIGH_PASS)
T0_hp=1.0/(double)F_HIGH_PASS;
if(method==2)
T0_hp=1.0/(double)fc;
......@@ -85,7 +85,7 @@ void timedomain_filt_vector(float * data, float fc, int order, int ns, int meth
}
}
if ((method==2)||(F_HP)){ /*highpass filter*/
if ((method==2)||(F_HIGH_PASS)){ /*highpass filter*/
for (j=1;j<=ns;j++){
seismogram_hp[j]=(double)data[j];
}
......
......@@ -63,7 +63,7 @@ void write_par(FILE *fp){
extern char PARA[STRING_SIZE];
extern int TIME_FILT, ORDER, ZERO_PHASE;
extern float FC_START, FC_END, FC_INCR;
extern float F_LOW_PASS_START, F_LOW_PASS_END, F_LOW_PASS_INCR;
extern int LNORM, DTINV;
extern int STEPMAX, TRKILL, TRKILL_STF;
......@@ -517,8 +517,8 @@ void write_par(FILE *fp){
if (TIME_FILT){
if(TIME_FILT==1){
fprintf(fp," TIME_FILT=%d: Time domain filtering is applied \n",TIME_FILT);
fprintf(fp," Starting at frequencies of %.2f Hz\n",FC_START);
fprintf(fp," Increasing the bandwidth up to %.2f Hz in steps of %.2f Hz\n",FC_END,FC_INCR);
fprintf(fp," Starting at frequencies of %.2f Hz\n",F_LOW_PASS_START);
fprintf(fp," Increasing the bandwidth up to %.2f Hz in steps of %.2f Hz\n",F_LOW_PASS_END,F_LOW_PASS_INCR);
}
if(TIME_FILT==2){
fprintf(fp," TIME_FILT=%d: Time domain filtering is applied \n Frequencies will be read from file: %s\n",TIME_FILT,FREQ_FILE);}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment