Esempio n. 1
0
void Speed::parseOptions (int argc, char** argv)
{
  CommandLine::Menu menu;
  CommandLine::Argument* arg;

  menu.set_help_header ("filterbank_speed - measure Filterbank speed");
  menu.set_version ("filterbank_speed version 1.0");

  arg = menu.add (real_to_complex, 'r');
  arg->set_help ("real-to-complex FFT");

  arg = menu.add (do_fwd_fft, 'b');
  arg->set_help ("do (batched) backward FFTs only");

  arg = menu.add (nfft, 'n', "nfft");
  arg->set_help ("FFT length");

  arg = menu.add (nchan, 'c', "nchan");
  arg->set_help ("number of channels");

  arg = menu.add (niter, 'N', "niter");
  arg->set_help ("number of iterations");

  menu.parse (argc, argv);
}
Esempio n. 2
0
//! Parse the command line options
void Pulsar::Application::parse (int argc, char** argv)
{
  CommandLine::Menu menu;
  CommandLine::Argument* arg;

  menu.set_help_header
    ("\n" + name + " - " + description + "\n"
     "\n"
     "usage: " + name + " [options] filename[s] \n"
     "\n"
     "where options are:");

  if (has_manual) menu.set_help_footer
    ("\n" "See "PSRCHIVE_HTTP"/manuals/" + name + " for more details \n");

  menu.set_version (version);

  arg = menu.add (this, &Application::set_quiet, 'q');
  arg->set_help ("quiet mode");

  arg = menu.add (this, &Application::set_verbose, 'v');
  arg->set_help ("verbose mode");

  arg = menu.add (this, &Application::set_very_verbose, 'V');
  arg->set_help ("very verbose mode");

  arg = menu.add (metafile, 'M', "metafile");
  arg->set_help ("metafile contains list of archive filenames");

  arg = menu.add (Config::get_configuration(), &Config::set_filename,
		  "config", "file");
  arg->set_help ("configuration file");

  for (unsigned i=0; i<options.size(); i++)
    options[i]->add_options (menu);

  add_options (menu);

  menu.parse (argc, argv);

  dirglob_program = name;

  if ( stow_script && optind < argc )
  {
    script = argv[optind];
    optind ++;
  }

  if (!metafile.empty())
    stringfload (&filenames, metafile);
  else
  {
    for (int i=optind; i<argc; i++)
      dirglob (&filenames, argv[i]);

    if (sort_filenames)
      sort (filenames.begin(), filenames.end());
  }

  if (update_history)
  {
    string separator = " ";

    command += name + separator;

    for (int i=1; i<optind; i++)
      command += argv[i] + separator;

    if (command.length () > 80)
    {
      cerr << "WARNING: ProcHistory command string truncated to 80 characters"
	   << endl;
      command = command.substr (0, 80);
    }
  }
}
Esempio n. 3
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);
}