Esempio n. 1
0
void parse_options (int argc, char** argv) try
{
  CommandLine::Menu menu;
  CommandLine::Argument* arg;
  
  menu.set_help_header ("digifits - convert dspsr input to PSRFITS search mode output");
  menu.set_version ("digifits " + tostring(dsp::version) +
		    " <" + FTransform::get_library() + ">");

  config->add_options (menu);

  // Need to rename default threading option due to conflict
  // with original digifil -t (time average) setting.
  arg = menu.find("t");
  arg->set_short_name('\0'); 
  arg->set_long_name("threads");
  arg->set_type("nthread");

  menu.add ("\n" "Source options:");

  arg = menu.add (config->dispersion_measure, 'D', "dm");
  arg->set_help (" set the dispersion measure");

  menu.add ("\n" "Processing options:");

  arg = menu.add (config->block_size, 'B', "MB");
  arg->set_help ("block size in megabytes");

  string ram_limit;
  arg = menu.add (ram_limit, 'U', "MB");
  arg->set_help ("upper limit on RAM usage");
  arg->set_long_help ("specify the floating point number of megabytes; e.g. -U 256 \n");

  arg = menu.add (&config->filterbank, 
      &dsp::Filterbank::Config::set_freq_res, 
      'x', "nfft");
  arg->set_help ("set backward FFT length in voltage filterbank");

  arg = menu.add (config->coherent_dedisp, "do_dedisp", "bool");
  arg->set_help ("enable coherent dedispersion (default: false)");

  arg = menu.add (config->rescale_constant, 'c');
  arg->set_help ("keep offset and scale constant");

  arg = menu.add (config->rescale_seconds, 'I', "secs");
  arg->set_help ("rescale interval in seconds");


  menu.add ("\n" "Output options:");

  arg = menu.add (config->tsamp, 't', "tsamp");
  arg->set_help ("integration time (s) per output sample (default=64mus)");

  arg = menu.add (config->npol, 'p', "npol");
  arg->set_help ("output 1 (Intensity), 2 (AABB), or 4 (Coherence) products");

  arg = menu.add (config->nbits, 'b', "bits");
  arg->set_help ("number of bits per sample output to file [1,2,4,8]");

  arg = menu.add (config->filterbank, 'F', "nchan[:D]");
  arg->set_help ("create a filterbank (voltages only)");
  arg->set_long_help
    ("Specify number of filterbank channels; e.g. -F 256\n"
     "Select coherently dedispersing filterbank with -F 256:D\n"
     "Set leakage reduction factor with -F 256:<N>\n");

  arg = menu.add (config->nsblk, "nsblk", "N");
  arg->set_help ("output block size in samples (default=2048)");

  arg = menu.add (config->integration_length, 'L', "seconds");
  arg->set_help ("set maximum file length");

  arg = menu.add (config->dedisperse, 'K');
  arg->set_help ("remove inter-channel dispersion delays");

  //arg = menu.add (config->fscrunch_factor, 'f', "nchan");
  //arg->set_help ("decimate in frequency");

  arg = menu.add (config->output_filename, 'o', "file");
  arg->set_help ("output filename");

  //bool revert = false;
  //arg = menu.add (revert, 'p');
  //arg->set_help ("revert to FPT order");

  menu.parse (argc, argv);

  if (!ram_limit.empty())
  {
    double MB = fromstring<double> (ram_limit);
    config->set_maximum_RAM (uint64_t( MB * 1024.0 * 1024.0 ));
  }

  //if (revert)
  //  config->order = dsp::TimeSeries::OrderFPT;
}
catch (Error& error)
{
  cerr << error << endl;
  exit (-1);
}
catch (std::exception& error)
{
  cerr << error.what() << endl;
  exit (-1);
}
Esempio n. 2
0
void psrpca::add_options ( CommandLine::Menu& menu )
{
  CommandLine::Argument* arg;

  arg = menu.add ( remove_arch_baseline, "ra" );
  arg->set_help ( "Don't remove the baseline of input archives" );

  arg = menu.add ( remove_std_baseline, "rs" );
  arg->set_help ( "Don't remove the baseline of the template" );

  menu.add ("");
  menu.add ("Fitting options");

  arg = menu.add (this, &psrpca::set_standard, 's', "stdfile");
  arg->set_help ("Location of standard profile");

  arg = menu.add ( apply_shift, "fp" );
  arg->set_help ("Don't fit for phase shift");

  arg = menu.add ( apply_offset, "fb" );
  arg->set_help ("Don't fit for baseline offset");

  arg = menu.add ( apply_scale, "fs" );
  arg->set_help ("Don't fit for scale");

  arg = menu.add ( prof_to_std, "ts" );
  arg->set_help ( "Apply scaling, offset and shift to standard instead of profile");

  menu.add ("");
  menu.add ("Regression and Predictor Options");

  arg = menu.add (residuals_file, 'r', "residuals");
  arg->set_help ("File with residuals");
  arg->set_long_help ("As output by tempo2 in the following format: {sat} {post} {err}\n"
		  "They need to be in the same order as the input archives \n"
		  "When used, corrected residuals are output in a file prefix_residuals \n"
		  "The format of the output is: {sat} {input residual} {output residual} {input error}\n"
		  "Note that the output units are us\n");
  arg = menu.add (consecutive_points, 'c', "consecutive_points");
  arg->set_help ("Choose the number of consecutive points above threshold used during determination of significant eigenvectors");
  arg = menu.add (threshold_sigma,'t',"threshold_sigma");
  arg->set_help ("Choose the threshold in the units of standard deviation");

  menu.add ("");
  menu.add ("Output options:");

  arg = menu.add (save_diffs, "sd");
  arg->set_help ("Don't save the difference profiles");

  arg = menu.add (save_evecs, "se");
  arg->set_help ("Don't save the eigenvectors");

  arg = menu.add (save_evals, "sv");
  arg->set_help ("Don't save the eigenvalues");

  arg = menu.add (save_covariance_matrix, "sc");
  arg->set_help ("Don't save the covariance matrix");

  arg = menu.add (save_decomps, "sD");
  arg->set_help ("Don't save the decompositions");

  arg = menu.add (prefix, 'p', "prefix");
  arg->set_help ("Set prefix for all the output files");
  arg->set_long_help ("Default value: psrpca\n"
		  "The output files for differences profiles, eigenvectors, eigenvalues and covariance matrix\n"
		  "Are: prefix_diffs.ar, prefix_evecs.ar, prefix_evals.dat, prefix_covar.fits, respectively");
}
Esempio n. 3
0
void psrspa::add_options ( CommandLine::Menu& menu )
{
  CommandLine::Argument* arg;

  menu.add ( "" );
  menu.add ( "Common options" );

  arg = menu.add ( log, 'l' );
  arg->set_help ( "Use a logarithmic flux scale" );

  arg = menu.add ( bins, 'b', "bins" );
  arg->set_help ( "Set the number of all bins" );

  arg = menu.add ( dynamic_histogram, 'd' );
  arg->set_help ( "Allow dynamic setting of range of histograms" );

  menu.add ( "" );
  menu.add ( "Scan pulses and find giants - options:" );

  arg = menu.add ( this, &psrspa::set_finder, 'a',"algorithm");
  arg->set_help ( "Set the algorithm used to find pulses" );    
  arg->set_long_help ( "\t\tThis is a different implementation of the pulse searching\n"
		 "\t\tAvailable algorithms (name):\n"
		"\t\t - OnPulseThreshold (above)\n" 
		"\t\t - PeakConsecutive (consecutive)\n"
		"\t\t - PeakCumulative (cumulative)\n" 
		"\t\t - ProfileWeightStatic (set)\n" 
		"\t\t - ExponentialBaseline (exponential)\n"
		"\t\t - GaussianBaseline (normal)\n"
		"\t\t - BaselineWindow (minimum)\n" );

  menu.add ( "" );
  menu.add ( "Phased resolved histograms" );

  arg = menu.add ( this, &psrspa::choose_range, "pr","min,max(,min,max...)" );
  arg->set_help ( "Specify phase range (in turns) for the phase resolved algorithms and max amplitude algorithm" );
  arg->set_long_help ( "Multiple ranges can be provided, e.g., '0.0,0.1,0.3,0.35' will create two ranges 0.0-0.1 and 0.3-0.35" );

  arg = menu.add ( create_flux, "hf");
  arg->set_help ( "Create phase resolved histogram of flux" );

  arg = menu.add ( create_polar_degree, "hd");
  arg->set_help ( "Create phase resolved histogram of polarisation degree" );

  arg = menu.add ( create_polar_angle, "ha");
  arg->set_help ( "Create phase resolved histogram of polarisation angle" );

  arg = menu.add ( find_max_amp_in_range, "fm");
  arg->set_help ( "Find maximum amplitude in the given phase range as provided by -pr" );

  arg = menu.add ( flux_pr_bins, "hfb", "bins" );
  arg->set_help ( "Set the number of phase resolved flux bins" );

  arg = menu.add ( polar_degree_bins, "hdb", "bins" );
  arg->set_help ( "Set the number of polarisation degree bins" );

  arg = menu.add ( polar_angle_bins, "hab", "bins" );
  arg->set_help ( "Set the number of polarisation angle bins" );

  arg = menu.add ( this, &psrspa::choose_bscrunch, "bl", "max_bscrunch" );
  arg->set_help ( "When searching for maximum amplitude in the given phase range, perform calculations\n"
		  "also for bscrunched profiles, with the given maximum bscrunch factor" );

  menu.add ( "" );
  menu.add ( "Output of the histograms" );

  arg = menu.add ( prefix, "pfix","prefix" );
  arg->set_help ( "Write files with this prefix" );

  arg = menu.add ( ext, 'e', "extension" );
  arg->set_help ( "Write files with this extension" );
  
  arg = menu.add ( path, 'O', "path" );
  arg->set_help ( "Write files in this location" ); 

  arg = menu.add ( binary_output, "bo" );
  arg->set_help ( "write the phase resolved histograms in binary format" );
}