Ejemplo 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);
}
Ejemplo n.º 2
0
void paz::add_options (CommandLine::Menu& menu)
{
  CommandLine::Argument* arg = 0;

  // backward compatibility: -u == -O
  menu.add( new CommandLine::Alias( menu.find("O"), 'u' ) );

  menu.add ("\n" "Manual zapping options:");

  arg = menu.add (zero_intersection, 'I');
  arg->set_help ("Zero weight the intersection of -[wW] and -[zZk]");

  arg = menu.add (killfile, 'k', "filename");
  arg->set_help ("Zero weight chans listed in this kill file");

  arg = menu.add (this, &paz::range_bins_to_zap, 'B', "\"a b\"");
  arg->set_help ("Zap pulse phase bins between a and b inclusive");

  arg = menu.add (this, &paz::add_chans_to_zero, 'z', "\"a b c ...\"");
  arg->set_help ("Zero weight these particular channels");

  arg = menu.add (this, &paz::range_chans_to_zero, 'Z', "\"a b\"");
  arg->set_help ("Zero weight chans between a & b inclusive");

  arg = menu.add (this, &paz::add_freqs_to_zero, 'f', "\"a b c ...\"");
  arg->set_help ("Zero weight channels with these frequencies (MHz)");

  arg = menu.add (this, &paz::range_freqs_to_zero, 'F', "\"a b\"");
  arg->set_help ("Zero weight this frequency range, inclusive (MHz)");

  arg = menu.add (this, &paz::add_subs_no_delete, 'x', "\"a b c ...\"");
  arg->set_help ("Delete all sub-integrations except these");

  arg = menu.add (this, &paz::range_subs_no_delete, 'X', "\"a b\"");
  arg->set_help ("Delete all sub-ints except a to b inclusive");

  arg = menu.add (edge_zap_percent, 'E', "percent");
  arg->set_help ("Zero weight this much of each band edge");

  arg = menu.add (this, &paz::add_subs_to_delete, 's', "\"a b c ...\"");
  arg->set_help ("Delete these sub-integrations");

  arg = menu.add (this, &paz::range_subs_to_delete, 'S', "\"a b\"");
  arg->set_help ("Delete sub-ints between a & b inclusive");

  arg = menu.add (this, &paz::add_subs_to_zero, 'w', "\"a b c ...\"");
  arg->set_help ("Zero weight these sub-integrations");

  arg = menu.add (this, &paz::range_subs_to_zero, 'W', "\"a b\"");
  arg->set_help ("Zero weight sub-ints between a & b inclusive");

  arg = menu.add (this, &paz::parse_periodic_zap, 'p', "\"p i\"");
  arg->set_help ("Interpolate over every p-th phase bin, start at i");

  arg = menu.add (pol_to_delete, "poln", "0/1");
  arg->set_help ("Delete the specified polarization");

  menu.add ("\n" "Automatic zapping algorithms:");

  arg = menu.add (median_zap, 'r');
  arg->set_help ("Zap channels using median smoothed difference");

  arg = menu.add (median_zap_window, 'R', "size");
  arg->set_help ("Set the size of the median smoothing window");

  arg = menu.add (this, &paz::add_subints_to_mow, 'l', "subint");
  arg->set_help ("Mow the lawn of the specified subint");

  arg = menu.add (mow_all_subints, 'L');
  arg->set_help ("Mow the lawn of all subints");

  arg = menu.add (simple, 'd');
  arg->set_help ("Zero weight chans using mean offset rejection");

  arg = menu.add (ston_cutoff, 'C', "cutoff");
  arg->set_help ("Zero weight chans based on S/N (std optional)");

  arg = menu.add (std_filename, 'P', "stdfile");
  arg->set_help ("Use this standard profile");

  arg = menu.add (dropout_sigma, 'o', "cutoff");
  arg->set_help ("Zero weight subints with negative dropouts");

  arg = menu.add (eightBinZap, '8');
  arg->set_help ("Fix ATNF WBCORR 8 bin problem (see also -p)");

  menu.add
    ("\n"
     "The format of the kill file used with the -k option is simply\n"
     "a list of channel numbers, separated by white space\n"
     "\n"
     "The cutoff S/N value used with -C is largely arbitrary. You will\n"
     "need to experiment to find the best value for your archives");
}