Commit 719fa4df authored by flechsig's avatar flechsig
Browse files

improved call of subfunctions

parent 17a51913
......@@ -200,11 +200,10 @@ void evalfft_ifft_2d(Matrix *put_in, struct ConfigStruct *cstp, struct Xgi_out *
// main test routine by UF to add functions
void evaluf(Matrix *put_in, struct ConfigStruct *cstp, struct Xgi_out *put_out)
{
int row, col, val4overlay;
int row, col, val4overlay, rows, cols;
double m, y0, r;
FLOATING *data;
int rows, cols;
#ifdef UINT16_OUT
val4overlay= 0xFFFF;
#else
......@@ -213,10 +212,11 @@ void evaluf(Matrix *put_in, struct ConfigStruct *cstp, struct Xgi_out *put_out)
put_in->copy(&put_out->amp); // copy input to output in field amp, address= 1
put_in->copy(&put_out->dphi_wrap);
put_in->copy(&put_out->dphi_unwrap);
rows= put_in->height;
cols= put_in->width;
data= put_out->amp.data; // Array address= 1
data= put_out->amp.data; // Array address= 1
// cstp->direction= COLDIR; // evaluate horizontal cuts
switch (cstp->minor) // minor calculation mode
......@@ -226,33 +226,33 @@ void evaluf(Matrix *put_in, struct ConfigStruct *cstp, struct Xgi_out *put_out)
autorange(data, rows, cols, cstp->logscale);
break;
case 1:
hanning(data, rows, cols, cstp->direction); // hanning filter
hanning(data, rows, cols, cstp->direction); // hanning filter
autorange(data, rows, cols, cstp->logscale); // cstp->logscale
break;
case 2: // fft(-1)
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d(data, rows, cols, cstp); // fft stuff
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d(data, rows, cols, cstp, put_out); // fft stuff
autorange(data, rows, cols, cstp->logscale); // cstp->logscale
overlay(data, rows, cols, cstp->center, cstp->width, (double)val4overlay, cstp->direction); // add a overlay
break;
case 3: // filter
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d(data, rows, cols, cstp); // fft stuff
eval1d(data, rows, cols, cstp, put_out); // fft stuff
autorange(data, rows, cols, cstp->logscale);
break;
case 4: // shift
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d(data, rows, cols, cstp); // fft stuff
eval1d(data, rows, cols, cstp, put_out); // fft stuff
autorange(data, rows, cols, cstp->logscale);
break;
case 5: // FFT(1)
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d(data, rows, cols, cstp);// fft stuff
eval1d(data, rows, cols, cstp, put_out); // fft stuff
autorange(data, rows, cols, cstp->logscale);
break;
case 6: // no scaling
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d(data, rows, cols, cstp); // fft stuff
eval1d(data, rows, cols, cstp, put_out); // fft stuff
break;
default:
cout << "error: undefined minor mode, minor= " << cstp->minor << endl;
......@@ -280,18 +280,13 @@ void evaluf(Matrix *put_in, struct ConfigStruct *cstp, struct Xgi_out *put_out)
put_out->laxis.resize(1, rows);
for (row= 0; row< rows; row++) //
{
//xprof[row]= data[cols/2 + row * cols]; // center
//yprof[row]= row;
put_out->laxis.data[row]= row;
put_out->hp.data[row]= data[cols/2 + row * cols]; // center
}
//r= linreg(rows, yprof, xprof, &m, &y0);
r= linreg(cols, put_out->laxis.data, put_out->hp.data, &m, &y0);
cout << "fit results: (corr, m, y0): " << r << ", " << m << ", " << y0 << endl;
for (row= 0; row< rows; row++) // subtract line
//xprof[row]-= (m* yprof[row]+ y0); //
put_out->hp.data[row]-= (m* put_out->laxis.data[row]+ y0); //
} // end rowdir
......@@ -304,12 +299,10 @@ void evaluf(Matrix *put_in, struct ConfigStruct *cstp, struct Xgi_out *put_out)
// main test routine by UF to add functions with zero padding
void evaluf_zp(Matrix *put_in, struct ConfigStruct *cstp, struct Xgi_out *put_out)
{
int row, col, val4overlay;
int row, col, val4overlay, rows, cols;
double m, y0, r;
FLOATING *data;
int rows, cols;
#ifdef UINT16_OUT
val4overlay= 0xFFFF;
#else
......@@ -337,28 +330,28 @@ void evaluf_zp(Matrix *put_in, struct ConfigStruct *cstp, struct Xgi_out *put_ou
break;
case 2: // fft(-1)
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d_zp(data, rows, cols, cstp); // fft stuff
eval1d_zp(data, rows, cols, cstp, put_out); // fft stuff
autorange(data, rows, cols, cstp->logscale); // logscale
overlay(data, rows, cols, cstp->center, cstp->width, (double)val4overlay, cstp->direction); // add a overlay
break;
case 3: // filter
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d_zp(data, rows, cols, cstp); // fft stuff
eval1d_zp(data, rows, cols, cstp, put_out); // fft stuff
autorange(data, rows, cols, cstp->logscale);
break;
case 4: // shift
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d_zp(data, rows, cols, cstp); // fft stuff
eval1d_zp(data, rows, cols, cstp, put_out); // fft stuff
autorange(data, rows, cols, cstp->logscale);
break;
case 5: // FFT(1)
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d_zp(data, rows, cols, cstp);// fft stuff
eval1d_zp(data, rows, cols, cstp, put_out);// fft stuff
autorange(data, rows, cols, cstp->logscale);
break;
case 6: // no scaling
hanning(data, rows, cols, cstp->direction); // hanning filter
eval1d_zp(data, rows, cols, cstp); // fft stuff
eval1d_zp(data, rows, cols, cstp, put_out); // fft stuff
break;
default:
cout << "error: undefined minor mode, minor= " << cstp->minor << endl;
......@@ -404,7 +397,7 @@ void evaluf_zp(Matrix *put_in, struct ConfigStruct *cstp, struct Xgi_out *put_ou
} // end evaluf_zp()
// makes a 1d fft, default is cols plus other treatment
void eval1d(double *data, int rows, int cols, struct ConfigStruct *cs)
void eval1d(double *data, int rows, int cols, struct ConfigStruct *cs, struct Xgi_out *put_out)
{
fftw_complex *in, *out;
fftw_plan p1, p2;
......@@ -538,7 +531,7 @@ void eval1d(double *data, int rows, int cols, struct ConfigStruct *cs)
// makes a 1d fft, default is cols plus other treatment incl zero padding
void eval1d_zp(double *data, int rows, int cols, struct ConfigStruct *cs)
void eval1d_zp(double *data, int rows, int cols, struct ConfigStruct *cs, struct Xgi_out *put_out)
{
fftw_complex *in, *out;
fftw_plan p1, p2;
......
......@@ -35,8 +35,8 @@ struct ConfigStruct {
bool is_file_exist(const char *);
double linreg(int, double *, double *, double *, double *);
void autorange(double *, int, int, int);
void eval1d(double *, int, int, struct ConfigStruct *);
void eval1d_zp(double *, int, int, struct ConfigStruct *);
void eval1d(double *, int, int, struct ConfigStruct *, struct Xgi_out *);
void eval1d_zp(double *, int, int, struct ConfigStruct *, struct Xgi_out *);
void evalfft2d(Matrix *, struct ConfigStruct *, struct Xgi_out *);
void evalfft_ifft_2d(Matrix *, struct ConfigStruct *, struct Xgi_out *);
void evaluf(Matrix *, struct ConfigStruct *, struct Xgi_out *);
......
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