示例#1
0
int main (int argc, char* argv[]) {

  Command_line_opts opts;
  Search_settings sett;
  Search_range s_range; 
  Aux_arrays aux_arr;
  double *F; 			  // F-statistic array
  int i; 

#define QUOTE(x) #x
#define STR(macro) QUOTE(macro)
#define CVSTR STR(CODEVER)

  printf("Code version : " CVSTR "\n");

  // Command line options 
  handle_opts(&sett, &opts, argc, argv);  
	
  // Output data handling
  struct stat buffer;

  if (stat(opts.prefix, &buffer) == -1) {
    if (errno == ENOENT) {
      // Output directory apparently does not exist, try to create one
      if(mkdir(opts.prefix, S_IRWXU | S_IRGRP | S_IXGRP 
          | S_IROTH	| S_IXOTH) == -1) {
	      perror (opts.prefix);
	      return 1;
      }
    } else { // can't access output directory
      perror (opts.prefix);
      return 1;
    }
  }
 
  // Grid data 
  read_grid(&sett, &opts);	
	
  // Search settings
  search_settings(&sett); 

  // Detector network settings
  detectors_settings(&sett, &opts); 

  // Array initialization and reading the ephemerids 
  init_arrays(&sett, &opts, &aux_arr, &F);

  // Narrowing-down the band (excluding the edges 
  // according to the opts.narrowdown parameter) 
  if(opts.narrowdown < 0.5*M_PI)
    narrow_down_band(&sett, &opts);

  // Reading known lines data from external files 
  if(opts.veto_flag) { 
    for(i=0; i<sett.nifo; i++) {
      printf("Reading known lines data for %s from %s\n", ifo[i].name, opts.dtaprefix);
      read_lines(&sett, &opts, &ifo[i]);
    }

    // Vetoing known lines in band 
    lines_in_band(&sett, &opts); 
  } 

  // If excluded parts of band, list them
  // and check if the band isn't fully vetoed 
  if(sett.numlines_band) {     

    int k; 
    printf("list of excluded frequencies in band (in radians):\n"); 
    for(k=0; k<sett.numlines_band; k++) 
      printf("%f %f\n", sett.lines[k][0], sett.lines[k][1]);

    check_if_band_is_fully_vetoed(&sett); 

  } 

  // Amplitude modulation functions for each detector  
  for(i=0; i<sett.nifo; i++)   
    rogcvir(&ifo[i]); 

  // Grid search range
  if(strlen(opts.addsig)) { 
    // If addsig switch used, add signal from file, 
    // search around this position (+- gsize)
    add_signal(&sett, &opts, &aux_arr, &s_range); 
  } else 
    // Set search range from range file  
    set_search_range(&sett, &opts, &s_range);

  // FFT plans 
  FFTW_plans fftw_plans;
  FFTW_arrays fftw_arr;
  plan_fftw(&sett, &opts, &fftw_plans, &fftw_arr, &aux_arr);
  if (strlen(opts.getrange)) exit(EXIT_SUCCESS);

  // Checkpointing
  int Fnum=0;			        // candidate signal number
  read_checkpoints(&opts, &s_range, &Fnum);

  // main search job
  search(&sett, &opts, &s_range, 
        &fftw_plans, &fftw_arr, &aux_arr,
	      &Fnum, F);

  // state file zeroed at the end of the run
  FILE *state;
  if(opts.checkp_flag) {
    state = fopen (opts.qname, "w");
    fclose (state);
  }
	
  // Cleanup & memory free 
  cleanup(&sett, &opts, &s_range, 
          &fftw_plans, &fftw_arr, &aux_arr, F);

  return 0; 
	
}
示例#2
0
int main(int argc, char *argv[]) {
	
  int i, numl=0, freq_line_check, c, pm, gsize=2, band=0, reffr; 
  char filename[512], dtaprefix[512], *wd=NULL ; 
  double amp=0, snr=0;
  double freql[32768], linew[32768], sgnlo[8], rrn[2], 
	dvr, fpo_val, be1, be2, fr, lw, freqlp, freqlm, f1, f2,  
	sepsm, cepsm, sinalt, cosalt, sindelt, cosdelt, 
	iota, ph_o, psik, hop, hoc ; 

  FILE *data ;

  Search_settings sett;

  //#mb fftpad value=1 (default for some time now) 
  sett.fftpad = 1; 

  // Default data sampling time (s)  
  sett.dt = 0.5; 

  // Default reference time frame (frame in which the frequency 
  // of the signal is as selected below, not spun-down/up) is 1
  reffr = 1; 

  // Initial value of starting frequency 
  // set to a negative quantity. If this is not 
  // changed by the command line value 
  // fpo is calculated from the band number b.
  fpo_val = -1;

  // Initial value of the number of days is set to 0
  sett.nod = 0; 
  
  while (1) {
    static struct option long_options[] = {
      {"help", no_argument, &help_flag, 1},			
      // GW amplitude 
      {"amp", required_argument, 0, 'a'},
      // SNR
      {"snr", required_argument, 0, 'n'},
      // frequency band number 
      {"band", required_argument, 0, 'b'},
      // change directory parameter
      {"cwd", required_argument, 0, 'c'},
      // input data directory 
      {"data", required_argument, 0, 'd'},
      // fpo value
      {"fpo", required_argument, 0, 'p'},
      // evade lines 
      {"evade-lines", no_argument, &evade_flag, 1},
      // grid search range 
      {"gsize", required_argument, 0, 'g'},
      // data sampling time 
      {"dt", required_argument, 0, 's'},
      // reference frame () 
      {"reffr", required_argument, 0, 'r'},
      // number of days in the time-domain segment 
      {"nod", required_argument, 0, 'y'}, 
      {0, 0, 0, 0}
    };

  if(help_flag) {
	  
     printf("*** Software injection parameters - cont. GW signal ***\n"); 
     printf("Usage: ./sigen -[switch1] <value1> -[switch2] <value2> ...\n") ;
     printf("Switches are:\n\n"); 
     printf("-amp      GW amplitude of the injected (mutually exclusive with -snr)\n"); 
     printf("-snr      SNR of the injected signal (mutually exclusive with -amp)\n"); 
     printf("-band     Band number\n"); 
     printf("-cwd      Change to directory <dir>\n");     
     printf("-data     Data directory in case of lines (default is .)\n"); 
     printf("-fpo      fpo (starting frequency) value\n");
     printf("-gsize    Grid search range (default value: 2)\n");
     printf("-dt       Data sampling time dt (default value: 0.5)\n");
     printf("-nod      Number of days\n");
     printf("-reffr    Reference frame (default value: 1)\n\n");

     printf("--help    This help\n"); 		
     exit (0);
     
  }

    int option_index = 0;
    c = getopt_long_only (argc, argv, "a:n:b:c:d:p:g:s:r:y:", long_options, &option_index);

   if (c == -1)
      break;
    switch (c) {
    case 'a':
      amp  = atof (optarg);
      break; 
    case 'n':
      snr  = atof (optarg);
      break; 
    case 'b':
      band = atoi (optarg);
      break;
    case 'c':
      wd = (char *) malloc (1+strlen(optarg));
      strcpy (wd, optarg);
      break;      
    case 'd':
      strcpy (dtaprefix, optarg);
      break;
    case 'g':
      gsize = atoi (optarg);
      break;
    case 'p':
      fpo_val = atof(optarg);
      break;
    case 's':
      sett.dt = atof(optarg);
      break;
    case 'r':
      reffr = atof(optarg);
      break;
    case 'y':
      sett.nod = atoi(optarg);
      break;
    case '?':
      break;
    default: break ; 

    } /* switch c */
  } /* while 1 */

  // Check if sett->nod was set up, if not, exit
  if(!(sett.nod)) { 
    printf("Number of days not set... Exiting\n"); 
    exit(EXIT_FAILURE); 
  } 


  if (wd) {
    printf ("Changing working directory to %s\n", wd);
    if (chdir(wd)) {
      perror (wd);
      abort ();
    }
  }

  // Check if the options are consistent with each other 
  if(!(amp || snr)) { 
    printf("Options -amp or -snr not given. Exiting...\n"); 
    exit(0); 
  } else if(amp && snr) { 
    printf("Options -amp and -snr are mutually exclusive. Exiting...\n"); 
    exit(0); 
  } 

  // Starting band frequency: 
  // fpo_val is optionally read from the command line
  // Its initial value is set to -1 
  if(fpo_val>=0)
      sett.fpo = fpo_val;
  else
  // The usual definition: 
      sett.fpo = 10. + 0.96875*band*(0.5/sett.dt);

  // Search settings
  search_settings(&sett);

  fprintf(stderr, "Band number is %04d\n", band);
  fprintf(stderr, "The reference frequency fpo is %f\n", sett.fpo);
  fprintf(stderr, "The data sampling time dt is %f\n", sett.dt);
  fprintf(stderr, "The reference time frame is %d\n", reffr);

  // If the -d switch is on giving a non-zero-length path 
  // somewhere, the signal will be generated using the 
  // information about lines there - will avoid known lines, 
  // as well as pole regions 

  //evade_flag = strlen(dtaprefix) ; 

  // Reading of lines data (lines related to a current band) 
  if(evade_flag) {

        fprintf(stderr, "Will evade lines\n") ;

  // Veto files
  // ----------
  // Known lines 

  sprintf (filename, "%s/veto/%03d.kl", dtaprefix, band);
  if ((data=fopen (filename, "r")) != NULL) {

	numl=0 ;   
	while(!feof(data)) {  

		fscanf(data, "%le %le", &fr, &lw) ;

		if(fr >= sett.fpo && fr <= sett.fpo + 1) { 
				
			freql[numl] = fr ;
			// Empirical 1.2 multiplication factor for the width
			linew[numl] = 1.2*lw ; 
			numl++ ; 

		}       	
 	} 

	// Info on stderr 
	fprintf (stderr, "Reading known-lines file %s for vetoing (%d found)\n", filename, numl-1) ;

  } else {
	perror (filename);
	return 1;
  }      

  fclose(data) ;

  // Forbidden declination values 
  // (signal cannot be to close to the poles)

  sprintf (filename, "%s/veto/pole_veto.d", dtaprefix);
  if ((data=fopen (filename, "r")) != NULL) {

	// Declination veto range for a given band 
	// (file pole_veto.d contains these values 
	// sorted by band)
	i=0; 
	while(i<band) {
		fscanf(data, "%le", &dvr) ;
		i++; 
	}	

	// Info on stderr 
	fprintf (stderr, "Near-pole angle veto file %s (%le rad)\n", filename, dvr) ;

	// Allowed range of angles (-dvr on the 2nd hemisphere)
	dvr = M_PI/2. - 3.*dvr ; 

  } else {
	perror (filename);
	return 1;
  }	

  fclose(data) ;  

  } // end of reading line data in case of -d 

  //#mb Changing the limits near the bands border 
  //rrn[0] = (double)(sett.nmin)/sett.nfft ; 
  //rrn[1] = (double)(sett.nmax)/sett.nfft ;  

  //#mb For O2 UL simulation run 
  rrn[0] = M_PI/20.; 
  rrn[1] = M_PI - rrn[0]; 

  // Random signal parameters 
  //------------------------- 

  // Frequency derivative 
  sgnlo[1] = sett.Smin - (sett.Smin + sett.Smax)*get_rand();
  
  if(evade_flag) { 
  // Frequency must not fall into one of know lines 
  do { 

	freq_line_check = 1 ;   

	sgnlo[0] =  get_rand()*(rrn[1] - rrn[0]) + rrn[0] ;   

	// frequency shift range in VSR1 data
	// these values are used to avoid lines
	f1 = sett.fpo + sgnlo[0] ;

  //#mb !!! reference frame !!! Here reffr (VSR1 was 67) 
	f2 = sett.fpo + sgnlo[0] - 2.*sgnlo[1]*(sett.N)*reffr ;

	for(i=0; i<numl; i++) {

		freqlp = freql[i] + linew[i] ; 
		freqlm = freql[i] - linew[i] ;

		// checks if the line is between f1 and f2
		// if so, starts again
		if(!((freqlm > f2) || (freqlp < f1))) {
			freq_line_check = 0 ;
			break; 
		} 

	}	


  } while (!freq_line_check) ; 

  // Frequency in (0, \pi) range  
  //#mb Check if this is consistent with the definition 
  // of rrn[0] and rrn[1]  
  sgnlo[0] *= 2*M_PI ;

  // Lines will not be avoided

  } else { 

	  //sgnlo[0] =  2*M_PI*get_rand()*(rrn[1] - rrn[0]) + rrn[0];	
	  //
	  //#mb this is compatible with the definition of 
	  // rrn[0] = M_PI/20., rrn[1] = M_PI - rrn[0]

	  sgnlo[0] =  get_rand()*(rrn[1] - rrn[0]) + rrn[0];	

  } 

  // Hemisphere 
  pm = round(get_rand()) + 1 ;
 
  // epsma - average inclination of Earth's axis to the ecliptic
  // (see definitions of constants in settings.h) 
  sepsm = sin(C_EPSMA);
  cepsm = cos(C_EPSMA);

  // Random sky position such that the signal is on the grid 
  // (inner loop), but is far enough from the poles (outer loop) 

  // Uniform sphere sampling algorithm 
  double x1, x2, X, Y, Z; 
  do {

    do { 

      x1 = 2*get_rand() - 1;
      x2 = 2*get_rand() - 1;

    } while(x1*x1 + x2*x2 >= 1); 
       

    X = 2*x1*sqrt(1 - x1*x1 - x2*x2);
    Y = 2*x2*sqrt(1 - x1*x1 - x2*x2);
    Z = 1 - 2*(x1*x1 + x2*x2);
  
  	// Sky position: declination
  	sgnlo[2] = M_PI_2 - acos(Z); 

	  // Right ascension
  	sgnlo[3] = atan2(Y, X) + M_PI; 

	// breaks out of the outer loop
	// if there is no -d switch with info about known lines   
	if(!evade_flag) break; 

  } while((sgnlo[2] > dvr) || (sgnlo[2] < -dvr)) ; 

  // Random phase and polarization of the signal
  ph_o = 2.*M_PI*get_rand();    
  psik = 2.*M_PI*get_rand();    
  hoc =  2.*get_rand() - 1.;   
  hop = (1. + hoc*hoc)/2.; 
  iota = acos(hoc);

  sgnlo[4] =  cos(2.*psik)*hop*cos(ph_o) - sin(2.*psik)*hoc*sin(ph_o) ;
  sgnlo[5] =  sin(2.*psik)*hop*cos(ph_o) + cos(2.*psik)*hoc*sin(ph_o) ;
  sgnlo[6] = -cos(2.*psik)*hop*sin(ph_o) - sin(2.*psik)*hoc*cos(ph_o) ;
  sgnlo[7] = -sin(2.*psik)*hop*sin(ph_o) + cos(2.*psik)*hoc*cos(ph_o) ;

  // Output (GW amplitude or signal-to-noise ratio)  
  if(amp) 
    printf("amp %le\n%d\n%d\n", amp, gsize, reffr);   		 
  else if(snr) 
    printf("snr %le\n%d\n%d\n", snr, gsize, reffr);

  printf("%.16le\n%.16le\n%.16le\n%.16le\n%.16le\n%.16le\n%.16le\n%.16le\n", 
			sgnlo[0], sgnlo[1], sgnlo[2], sgnlo[3], 
			sgnlo[4], sgnlo[5], sgnlo[6], sgnlo[7]);
   
  // Testing printouts	
/*
  printf("Random number between 0 and 1: %lf\n", rand1) ; 
  printf("pm, mm, nn, spnd: %d %d %d %d\n", pm, mm, nn, spnd) ;
  printf("%le\n%d\n%d\n", amp, gsize, pm) ;
  printf("rrn[0], rrn[1]: %.16le %.16le\n", rrn[0], rrn[1]) ; 
  
  printf("sgnlo[0]: %.16le\nsgnlo[1]: %.16le\nsgnlo[2]: %.16le\nsgnlo[3]: %.16le\n",
		sgnlo[0], sgnlo[1], sgnlo[2], sgnlo[3]) ;
  printf("sgnlo[4]: %.16le\nsgnlo[5]: %.16le\nsgnlo[6]: %.16le\nsgnlo[7]: %.16le\n",
		sgnlo[4], sgnlo[5], sgnlo[6], sgnlo[7]) ;		
  printf("be1: %.16le\nbe2: %.16le\n", be1, be2) ; 
  
  printf("iota, ph_o, psik: %.8lf %.8lf %.8lf\nhop, hoc: %.8lf %.8lf\n", 
		 iota, ph_o, psik, hop, hoc) ;
 
*/
 		 
//  downtime = clock() / (CLOCKS_PER_SEC / 1000 ) ; 
//  time_in_seconds = (double)(downtime - uptime) / 1000 ;     
//  printf("\nTime [s]: %.3lf\n", time_in_seconds) ; 
  
  return 0;

} // sigen()
示例#3
0
// Main programm
int main (int argc, char *argv[]) {

	Search_settings sett;	
	Command_line_opts opts;
  	Search_range s_range; 
  	Aux_arrays aux_arr;
  	double *F; 			// F-statistic array
  	int i, j, r, c, a, b, g; 	
	int d, o, m, k;
	int bins = 2, ROW, dim = 4;	// neighbourhood of point will be divide into defined number of bins
	double pc[4];			// % define neighbourhood around each parameter for initial grid
	double pc2[4];			// % define neighbourhood around each parameter for direct maximum search (MADS & Simplex)
	double tol = 1e-10;
//	double delta = 1e-5;		// initial step in MADS function
//	double *results;		// Vector with results from Fstatnet function
//	double *maximum;		// True maximum of Fstat
//	double results_max[11];	
	double s1, s2, s3, s4;
	double sgnlo[4]; 		 
	double **arr;		//  arr[ROW][COL], arrg[ROW][COL];
	double nSource[3];
  	double sinalt, cosalt, sindelt, cosdelt;
	double F_min;
	char path[512];
	double x, y;
	ROW = pow((bins+1),4);

#ifdef YEPPP
    yepLibrary_Init();
    Yep64f *results_max = (Yep64f*)malloc(sizeof(Yep64f)*11); 
    Yep64f *results_first = (Yep64f*)malloc(sizeof(Yep64f)*11);
    Yep64f *results = (Yep64f*)malloc(sizeof(Yep64f)*11);
    Yep64f *maximum = (Yep64f*)malloc(sizeof(Yep64f)*11);
//    Yep64f *sgnlo = (Yep64f*)malloc(sizeof(Yep64f)*4);  
//    Yep64f *nSource = (Yep64f*)malloc(sizeof(Yep64f)*3); 
    Yep64f *mean = (Yep64f*)malloc(sizeof(Yep64f)*4); 

    enum YepStatus status;

#endif

	pc[0] = 0.015;
	pc[1] = 0.015;
	pc[2] = 0.015;
	pc[3] = 0.015;

	for (i = 0; i < 4; i++){
		pc2[i] = 2*pc[i]/bins;
	}
// Time tests
	double tdiff;
	clock_t tstart, tend;

// Command line options 
	handle_opts(&sett, &opts, argc, argv); 
// Output data handling
/*  struct stat buffer;

  if (stat(opts.prefix, &buffer) == -1) {
    if (errno == ENOENT) {
      // Output directory apparently does not exist, try to create one
      if(mkdir(opts.prefix, S_IRWXU | S_IRGRP | S_IXGRP 
          | S_IROTH	| S_IXOTH) == -1) {
	      perror (opts.prefix);
	      return 1;
      }
    } else { // can't access output directory
      perror (opts.prefix);
      return 1;
    }
  }
*/
	sprintf(path, "%s/candidates.coi", opts.dtaprefix);

//Glue function
	if(strlen(opts.glue)) {
		glue(&opts);

		sprintf(opts.dtaprefix, "./data_total");
		sprintf(opts.dtaprefix, "%s/followup_total_data", opts.prefix); 
		opts.ident = 000;
	}	
	FILE *coi;
	int z;
	if ((coi = fopen(path, "r")) != NULL) {
//		while(!feof(coi)) {

/*			if(!fread(&w, sizeof(unsigned short int), 1, coi)) { break; } 
		  	fread(&mean, sizeof(float), 5, coi);
		  	fread(&fra, sizeof(unsigned short int), w, coi); 
		  	fread(&ops, sizeof(int), w, coi);

			if((fread(&mean, sizeof(float), 4, coi)) == 4){
*/
			while(fscanf(coi, "%le %le %le %le", &mean[0], &mean[1], &mean[2], &mean[3]) == 4){
//Time test
//			tstart = clock();
				arr = matrix(ROW, 4);

//Function neighbourhood - generating grid around point
				arr = neigh(mean, pc, bins);
// Output data handling
/*  				struct stat buffer;

  				if (stat(opts.prefix, &buffer) == -1) {
    					if (errno == ENOENT) {
// Output directory apparently does not exist, try to create one
      						if(mkdir(opts.prefix, S_IRWXU | S_IRGRP | S_IXGRP 
          						| S_IROTH	| S_IXOTH) == -1) {
	      						perror (opts.prefix);
	      						return 1;
      						}
    					} 
					else { // can't access output directory
			      			perror (opts.prefix);
			      			return 1;
			    		}
  				}
*/
// Grid data
  				if(strlen(opts.addsig)) { 

					read_grid(&sett, &opts);
				}
// Search settings
  				search_settings(&sett); 
// Detector network settings
  				detectors_settings(&sett, &opts); 

// Array initialization
  				init_arrays(&sett, &opts, &aux_arr, &F);
				
// Amplitude modulation functions for each detector  
				for(i=0; i<sett.nifo; i++) rogcvir(&ifo[i]); 
// Adding signal from file
  				if(strlen(opts.addsig)) { 

    					add_signal(&sett, &opts, &aux_arr, &s_range);
  				}

// Setting number of using threads (not required)
omp_set_num_threads(1);

				results_max[5] = 0.;

// ifo zostaje shared
// ifo....shft i ifo....xdatm{a,b] prerobić na lokalne tablice w fstatnet
// w regionie parallel wprowadzić tablice private aa i bb ; alokować i przekazywać je jako argumenty do fstatnet i amoeba

// Main loop - over all parameters + parallelisation
#pragma omp parallel default(shared) private(d, i, sgnlo, sinalt, cosalt, sindelt, cosdelt, nSource, results, maximum)
{

                       		double **sigaa, **sigbb;   // aa[nifo][N]
              			sigaa = matrix(sett.nifo, sett.N);
				sigbb = matrix(sett.nifo, sett.N);

#pragma omp for  
				for (d = 0; d < ROW; ++d){

					for (i = 0; i < 4; i++){
						sgnlo[i] = arr[d][i];
//						sgnlo[i] = mean[i]; 
					}
 
					sinalt = sin(sgnlo[3]);
					cosalt = cos(sgnlo[3]);
					sindelt = sin(sgnlo[2]);
					cosdelt = cos(sgnlo[2]);

					nSource[0] = cosalt*cosdelt;
					nSource[1] = sinalt*cosdelt;
					nSource[2] = sindelt;

					for (i = 0; i < sett.nifo; ++i){
						modvir(sinalt, cosalt, sindelt, cosdelt, 
					   		sett.N, &ifo[i], &aux_arr, sigaa[i], sigbb[i]);  
					}
// F-statistic in given point

					results = Fstatnet(&sett, sgnlo, nSource, sigaa, sigbb);
//printf("Fstatnet: %le %le %le %le %le %le\n", results[6], results[7], results[8], results[9], results[5], results[4]);

#pragma omp critical
					if(results[5] < results_max[5]){
						for (i = 0; i < 11; i++){
							results_max[i] = results[i];
						}
					}

// Maximum search using simplex algorithm
					if(opts.simplex_flag){
//						puts("Simplex");

						maximum = amoeba(&sett, &aux_arr, sgnlo, nSource, results, dim, tol, pc2, sigaa, sigbb);
printf("Amoeba: %le %le %le %le %le %le\n", maximum[6], maximum[7], maximum[8], maximum[9], maximum[5], maximum[4]);
// Maximum value in points searching
#pragma omp critical
						if(maximum[5] < results_max[5]){
							for (i = 0; i < 11; i++){
								results_max[i] = maximum[i];
							}
						}

					} //simplex
				} // d - main outside loop
				free_matrix(sigaa, sett.nifo, sett.N);
				free_matrix(sigbb, sett.nifo, sett.N);

} //pragma

				for(g = 0; g < 11; g++) results_first[g] = results_max[g];

// Maximum search using MADS algorithm
  				if(opts.mads_flag) {
//					puts("MADS");
					maximum = MADS(&sett, &aux_arr, results_max, mean, tol, pc2, bins);

				}

//Time test
//				tend = clock();
//				tdiff = (tend - tstart)/(double)CLOCKS_PER_SEC;
				printf("%le %le %le %le %le %le\n", results_max[6], results_max[7], results_max[8], results_max[9], results_max[5], results_max[4]);



			} // while fread coi
//		}
	} //if coi
	else {
		
		perror (path);
		return 1;
	}

// Output information
/*	puts("**********************************************************************");
	printf("***	Maximum value of F-statistic for grid is : (-)%.8le	***\n", -results_first[5]);
	printf("Sgnlo: %.8le %.8le %.8le %.8le\n", results_first[6], results_first[7], results_first[8], results_first[9]);
	printf("Amplitudes: %.8le %.8le %.8le %.8le\n", results_first[0], results_first[1], results_first[2], results_first[3]);
	printf("Signal-to-noise ratio: %.8le\n", results_first[4]); 
	printf("Signal-to-noise ratio from estimated amplitudes (for h0 = 1): %.8le\n", results_first[10]);
	puts("**********************************************************************");
if((opts.mads_flag)||(opts.simplex_flag)){
	printf("***	True maximum is : (-)%.8le				***\n", -maximum[5]);
	printf("Sgnlo for true maximum: %.8le %.8le %.8le %.8le\n", maximum[6], maximum[7], maximum[8], maximum[9]);
	printf("Amplitudes for true maximum: %.8le %.8le %.8le %.8le\n", maximum[0], maximum[1], maximum[2], maximum[3]);
	printf("Signal-to-noise ratio for true maximum: %.8le\n", maximum[4]); 
	printf("Signal-to-noise ratio from estimated amplitudes (for h0 = 1) for true maximum: %.8le\n", maximum[10]);
	puts("**********************************************************************");
}*/
// Cleanup & memory free 
	free(results_max);
	free(results_first);
	free(results);
	free(maximum);
	free(mean);
	free_matrix(arr, ROW, 4);
  	cleanup_followup(&sett, &opts, &s_range, &aux_arr, F);
	

	return 0;

}