57#define MODULE_ID "XSH_XCORREL_GAUSSIANS"
64 {
"debug", required_argument, 0,
DEBUG_OPT},
71 puts (
"Unitary test : Create two Gaussians one shifted to the other of a given quantity, then correlate them to check if correlation returns expected shift");
72 puts(
"Usage : ./tetst_xsh_correl_gaussians [options]");
75 puts(
" --debug=<n> : Level of debug LOW | MEDIUM | HIGH [MEDIUM]" );
76 puts(
" --help : What you see" ) ;
78 puts(
"The input files argument MUST be in this order:" );
79 puts(
" 1. PRE frame");
80 puts(
" 2. SOF a) MODEL : [XSH_MOD_CFG_TAB_UVB]");
81 puts(
" b) POLYNOMIAL: [DISP_TAB, ORDER_TAB_EDGES]");
93 while( (opt = getopt_long( argc, argv,
"debug:help",
97 if ( strcmp( optarg,
"LOW")==0){
100 else if ( strcmp( optarg,
"HIGH")==0){
121 double norm=
sigma*sqrt(2*CPL_MATH_PI);
124 for(i=0;i<
size;i++) {
126 data[i]=a*exp(-(
x-center)*(
x-center)*inv_2_c2);
129 return cpl_error_get_code();
145int main(
int argc,
char** argv)
150 cpl_msg_set_level( CPL_MSG_DEBUG);
156 if ( (argc-optind) >= 2) {
164 double gauss_c=0.5*
size;
166 double* gauss_d1=NULL;
167 double* gauss_d2=NULL;
169 cpl_vector* gauss_v1=cpl_vector_new(
size);
170 cpl_vector* gauss_v2=cpl_vector_new(
size);
172 gauss_d1=cpl_vector_get_data(gauss_v1);
173 gauss_d2=cpl_vector_get_data(gauss_v2);
178 int half_search=(int)(3*gauss_s+1);
185 cpl_vector_save(gauss_v1,
"gauss_v1.fits",CPL_BPP_IEEE_FLOAT,NULL,CPL_IO_DEFAULT);
186 cpl_vector_save(gauss_v2,
"gauss_v2.fits",CPL_BPP_IEEE_FLOAT,NULL,CPL_IO_DEFAULT);
194 if (cpl_error_get_code() != CPL_ERROR_NONE) {
int main()
Unit test of xsh_bspline_interpol.
cpl_error_code xsh_gauss_gen(double *data, const double center, const double sigma, const int size)
static struct option LongOptions[]
#define xsh_error_dump(level)
void xsh_free_vector(cpl_vector **v)
Deallocate a vector and set the pointer to NULL.
int xsh_debug_level_set(int level)
set debug level
double * xsh_function1d_xcorrelate(double *line_i, int width_i, double *line_t, int width_t, int half_search, int normalise, double *xcorr_max, double *delta)
static void HandleOptions(int argc, char **argv)
#define TESTS_CLEAN_WORKSPACE(DRL_ID)
#define TESTS_INIT_WORKSPACE(DRL_ID)
#define TESTS_INIT(DRL_ID)