当前位置: 首页>>代码示例>>C++>>正文


C++ To::get_Profile方法代码示例

本文整理汇总了C++中reference::To::get_Profile方法的典型用法代码示例。如果您正苦于以下问题:C++ To::get_Profile方法的具体用法?C++ To::get_Profile怎么用?C++ To::get_Profile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reference::To的用法示例。


在下文中一共展示了To::get_Profile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setup

  void setup (Integration* subint, unsigned ichan)
  {
    Pulsar::MoreProfiles* more = NULL;

    unsigned npol = subint->get_npol();
    if (auxiliary)
    {
      more = subint->get_Profile (0,ichan)->get<Pulsar::MoreProfiles>();
      npol = more->get_size();
    }

    try {
      vector<unsigned> pols = ::indeces (npol, indeces);
      profiles.resize (pols.size());

      for (unsigned ipol=0; ipol < pols.size(); ipol++)
      {
	if (more)
	  profiles[ipol] = more->get_Profile( pols[ipol] );
	else
	  profiles[ipol] = subint->get_Profile ( pols[ipol],ichan);
      }
    } 
    catch (...)
    {
      // if parsing indeces fails, then assume that letter codes are used
      Reference::To<const PolnProfile> profile = new_Stokes (subint, ichan);
      profiles.resize (indeces.length());
      for (unsigned ipol=0; ipol < indeces.length(); ipol++)
	profiles[ipol] = new_Profile (profile, indeces[ipol]);
    } 
  }
开发者ID:kernsuite-debian,项目名称:psrchive,代码行数:32,代码来源:psrtxt2.C

示例2: append

void psradd::append (Pulsar::Archive* archive) try
{
  if (phase_align)
  {
    Reference::To<Pulsar::Archive> standard;
    standard = total->total();
    Pulsar::Profile* std = standard->get_Profile(0,0,0);
    
    Reference::To<Pulsar::Archive> observation;
    observation = archive->total();
    Pulsar::Profile* obs = observation->get_Profile(0,0,0);
    
    archive->rotate_phase( obs->shift(std).get_value() );
  }

  if (archive->get_state() != total->get_state())
  {
    if (verbose)
      cerr << "psradd: converting state" 
	   << " from " << archive->get_state()
	   << " to " << total->get_state() << endl;
    
    archive->convert_state( total->get_state() );
  }
  
  if (patch)
  {
    if (verbose)
      cerr << "psradd: patching any missing sub-integrations" << endl;
    patch->operate (total, archive);
  }
  
  if (verbose)
    cerr << "psradd: appending " << archive->get_filename() << endl;

  if (time_direction)
    time.append (total, archive);
  else
    frequency.append (total, archive);

  if (log_file)
    fprintf (log_file, " %s", archive->get_filename().c_str());

  if (very_verbose)
    cerr << "psradd: after append, instance count = " 
	 << Reference::Able::get_instance_count() << endl;
}
catch (Error& error)
{
  cerr << "psradd: Archive::append exception:\n" << error << endl;
  if (auto_add)
    reset_total = true;
}
catch (...)
{
  cerr << "psradd: Archive::append exception thrown" << endl;
  if (auto_add)
    reset_total = true;
}
开发者ID:lbaehren,项目名称:lofarsoft,代码行数:59,代码来源:psradd.C

示例3: setup

void paz::setup ()
{
  if (!killfile.empty ())
  {
    FILE *fptr = fopen (killfile.c_str (), "r");

    if (!fptr)
      throw Error (FailedSys, "paz::setup", "fopen " + killfile);

    char *buffer = new char[4096];
    while (fgets (buffer, 4096, fptr))
    {
      char* key = strtok (buffer, whitespace);
      while (key)
      {
	chans_to_zero.push_back (fromstring<unsigned>(key));
	key = strtok (NULL, whitespace);
      }
    }
  }

  zero_channels = chans_to_zero.size()
    || freqs_to_zero.size() || freq_ranges_to_zero.size();

  bool zero_subints = subs_to_zero.size ();

  if (zero_intersection && !(zero_channels && zero_subints))
    throw Error (InvalidState, "paz::setup",
		 "must use -I with both -s|S|k *and* -w|W");
  
  if (mow_all_subints || subints_to_mow.size())
    mower = new Pulsar::LawnMower;
  
  if (median_zap || median_zap_bybin || median_zap_window)
  {
    median_zapper = new Pulsar::ChannelZapMedian;
    median_zapper->set_bybin (median_zap_bybin);
    median_zapper->set_paz_report (true);

    if (median_zap_window)
      median_zapper->set_window_size (median_zap_window);
  }

  if (edge_zap_percent < 0.0 || edge_zap_percent >= 100.0)
    throw Error (InvalidState, "paz::setup",
		 "invalid parameter to option -E");

  if (!std_filename.empty())
  {
    Reference::To<Pulsar::Archive> data = Pulsar::Archive::load (std_filename);
    data->pscrunch ();
    data->fscrunch ();
    data->tscrunch ();
    thestd = data->get_Profile (0, 0, 0);
    
    standard_snr.set_standard (thestd);
    Pulsar::Profile::snr_strategy.get_value().set (&standard_snr,
						   &Pulsar::StandardSNR::get_snr);
  }
}
开发者ID:SkyTian13,项目名称:psrchive,代码行数:60,代码来源:paz.C

示例4: set_standard

void psrflux::set_standard(Archive *arch)
{
  // Convert
  stdarch = arch->total();
  stdarch->convert_state(Signal::Intensity);

  // Set up DS calculation
  Reference::To<StandardFlux> flux = new StandardFlux;
  flux->set_fit_shift(true); // always init with true, choose later
  flux->set_standard(stdarch->get_Profile(0,0,0));
  ds.set_flux_method(flux);
}
开发者ID:kernsuite-debian,项目名称:psrchive,代码行数:12,代码来源:psrflux.C

示例5: process

void psrflux::process (Pulsar::Archive* archive)
{
  // Convert to total intensity
  archive->convert_state(Signal::Intensity);

  // Set self-standard if needed
  if (stdfile=="") set_standard(archive);

  // Test for single-profile data
  bool single_profile = archive->get_nsubint()==1 && archive->get_nchan()==1;

  // Access to the flux computation
  StandardFlux *flux = dynamic_cast<StandardFlux*>(ds.get_flux_method().get());

  // If shifts not fit, need to dedisperse and possibly align total
  // with standard.
  if (noalign) {
    archive->dedisperse();
    flux->set_fit_shift(false);
  } else if (align==false && single_profile==false) {
    archive->dedisperse();
    Reference::To<Archive> arch_tot = archive->total();
    Estimate<double> shift = 
      arch_tot->get_Profile(0,0,0)->shift(stdarch->get_Profile(0,0,0));
    stdarch->get_Profile(0,0,0)->rotate_phase(-1.0*shift.get_value());
    flux->set_fit_shift(false);
  } else {
    flux->set_fit_shift(true);
  }

  // Compute DS
  ds.set_Archive(archive);
  ds.compute();

  // Unload archive with .sm extension
  std::string outf = archive->get_filename() + "." + ext;
  cerr << "psrflux: unloading " << outf << endl;
  ds.unload(outf, command);

}
开发者ID:kernsuite-debian,项目名称:psrchive,代码行数:40,代码来源:psrflux.C

示例6:

string Pulsar::SNRatioInterpreter::standard (const string& args) try
{
  if (!standard_snratio)
    standard_snratio = new StandardSNR;

  if (!standard_functor)
    standard_functor.set( standard_snratio.get(), &StandardSNR::get_snr );

  Reference::To<Archive> archive = Archive::load ( args );
  standard_snratio->set_standard( archive->get_Profile (0,0,0) );

  Profile::snr_strategy = standard_functor;
  return "";
}
catch (Error& error) {
  return error.get_message();
}
开发者ID:SkyTian13,项目名称:psrchive,代码行数:17,代码来源:SNRatioInterpreter.C

示例7: zap_bins

/**
 * Zap a specified range of bins by substituting their values with the
 * baseline mean for each profile.
 */
void zap_bins(Pulsar::Archive* arch, Pulsar::Archive* old_arch,
    const unsigned s, const unsigned start_bin, const unsigned end_bin)
{
  const unsigned npol  = old_arch->get_npol();
  const unsigned nchan = old_arch->get_nchan();

  // Get the baseline region from what is displayed on screen (pscrunched
  // and fscrunched integration).
  Reference::To<Pulsar::Archive> copy = old_arch->clone();
  copy->pscrunch();
  copy->fscrunch();

  Reference::To<Pulsar::PhaseWeight> baseline_weights =
    copy->get_Profile(s,0,0)->baseline();

  vector<float> weights;
  baseline_weights->get_weights(weights);

  for (unsigned ipol = 0; ipol < npol; ++ipol) {
    for (unsigned ichan = 0; ichan < nchan; ++ichan) {
      // Apply the baseline region to each profile and get the mean.
      baseline_weights->set_Profile(old_arch->get_Profile(s,ipol,ichan));
      const double baseline_mean = baseline_weights->get_mean().get_value();
      float* bins = old_arch->get_Profile(s,ipol,ichan)->get_amps();

      // Set all the bins between start_bin and end_bin to the mean of the
      // baseline.
      for (unsigned ibin = start_bin; ibin <= end_bin; ++ibin) {
        bins[ibin] = baseline_mean;
      }
    }
  }

  *arch = *old_arch;
  arch->set_dispersion_measure(0);
  arch->pscrunch();
  arch->fscrunch();
  arch->remove_baseline();
}
开发者ID:kernsuite-debian,项目名称:psrchive,代码行数:43,代码来源:pazi.C

示例8: finalize

void psrpca::finalize ()
{
  arrival->set_observation ( total );
  arrival->get_toas(toas);

  if ( remove_std_baseline )
    std_archive -> remove_baseline ();
  Reference::To<Profile> std_prof = std_archive->get_Profile(0, 0, 0);
  float *s_amps = std_prof->get_amps ();
  const float nbin = std_prof->get_nbin ();

  double scale, offset, snr;

  if ( total_count < nbin )
    cerr << "WARNING: psrpca::finalize - not enough observations provided, "
	    "covariance matrix will not have full rank" << endl;

  //total->remove_baseline();

  gsl_matrix *profiles = gsl_matrix_alloc ( (unsigned)nbin, total_count );

  for (unsigned i_subint = 0; i_subint < total->get_nsubint(); i_subint++ )
  {
    Reference::To<Profile> prof = total->get_Profile ( i_subint, 0, 0 );
    if ( apply_shift )
      prof->rotate_phase ( toas[i_subint].get_phase_shift() );
    snr = prof->snr ();

    //calculate the scale
    float *p_amps = prof->get_amps ();
    scale = 0.0;

    for ( unsigned i_bin = 0; i_bin < nbin; i_bin++ )
    {
      scale += s_amps[i_bin] * p_amps[i_bin];
    }
    scale = (prof->get_nbin()* scale - prof->sum() * std_prof->sum()) /
	    (prof->get_nbin()* std_prof->sumsq() - std_prof->sum() * std_prof->sum());

    // calculate the baseline offset
    offset = (scale * std_prof->sum() - prof->sum()) / nbin;

    if ( prof_to_std )
    {
      //match the profile to standard and subtract the standard
      if ( apply_offset )
	prof->offset  ( offset );
      if ( apply_scale )
	prof->scale ( 1.0/scale );
      prof->diff ( std_prof );

      double* damps;
      damps = new double [ (unsigned)nbin ];
      transform( prof->get_amps(), prof->get_amps() + (unsigned)nbin, damps, CastToDouble() );

      gsl_vector_const_view view = gsl_vector_const_view_array( damps, nbin );
      gsl_matrix_set_col ( profiles, i_subint, &view.vector );
      t_cov->add_Profile ( prof, snr );
    }
    else
    {// prof_to_std is false
      Reference::To<Profile> diff = prof->clone ();
      diff->set_amps ( std_prof->get_amps () );
      if ( apply_offset ) 
	diff->offset( -offset );
      if ( apply_scale ) 
	diff->scale (scale);
      diff->diff ( prof );
      diff->scale (-1);

      double* damps;
      damps = new double [ (unsigned)nbin ];
      transform( diff->get_amps(), diff->get_amps() + (unsigned)nbin, damps, CastToDouble() );

      gsl_vector_const_view view = gsl_vector_const_view_array( damps, nbin );
      gsl_matrix_set_col ( profiles, i_subint, &view.vector );

      t_cov->add_Profile ( diff, snr );
      prof->set_amps ( diff->get_amps() );
    }
  }

  covariance = gsl_matrix_alloc ( (int) nbin, (int) nbin );
  t_cov->get_covariance_matrix_gsl ( covariance );

  // write the covariance matrix and difference profiles
  FILE *out;
  if ( save_covariance_matrix )
  {
    out = fopen ( (prefix+"_covariance.dat").c_str(), "w" );
    gsl_matrix_fprintf(out, covariance, "%g");
    fclose ( out );
  } // save covariance matrix

  if ( save_diffs ) 
    total->unload ( prefix+"_diffs.ar" );

  //solve the eigenproblem
  gsl_matrix_view m = gsl_matrix_submatrix ( covariance, 0, 0, (int)nbin, (int)nbin );
  gsl_vector *eval = gsl_vector_alloc ( (int)nbin );
//.........这里部分代码省略.........
开发者ID:lbaehren,项目名称:lofarsoft,代码行数:101,代码来源:psrpca.C

示例9: main


//.........这里部分代码省略.........
    if (!save)
    {
      cout << "Changes will not be saved. Use -m, -u or -e to write results to disk"
	   << endl;
    }

    if (stokesify && unstokesify)
    {
      cerr << "pam: Both -S and --SS options were given.  Poln state will not be changed!" << endl;
      stokesify = false;
      unstokesify = false;
    }

    int flip_option_count=0;
    if (flipsb) flip_option_count++;
    if (flip_freq) flip_option_count++;
    if (reverse_freqs) flip_option_count++;
    if (flip_option_count > 1) {
      cerr << "pam: More than one band-flip option was given, exiting." << endl;
      exit(-1);
    }

    for (unsigned i = 0; i < filenames.size(); i++) try
    {
      if (verbose)
	cerr << "Loading " << filenames[i] << endl;
      
      arch = Pulsar::Archive::load(filenames[i]);

      if( mult > 0.0 ){
	for( unsigned isub=0; isub<arch->get_nsubint();isub++)
	  for( unsigned ichan=0; ichan<arch->get_nchan();ichan++)
	    for( unsigned ipol=0; ipol<arch->get_npol();ipol++)
	      arch->get_Profile(isub,ipol,ichan)->scale( mult );
      }

      if( new_folding_period > 0.0 ){
	Pulsar::counter_drift( arch, new_folding_period, 0.0);
	for( unsigned isub=0; isub<arch->get_nsubint();isub++)
	  arch->get_Integration(isub)->set_folding_period( new_folding_period );
      }

      if (install_receiver) {
	if (verbose)
	  cerr << "pam: Installing receiver: " << install_receiver->get_name()
	       << " in archive" << endl;

	arch->add_extension (install_receiver);
      }

      if (lin || circ) {
	Pulsar::Receiver* receiver = arch->get<Pulsar::Receiver>();

	if (!receiver)
	  cerr << "No Receiver Extension in " << filenames[i] << endl;
	else {
	  if (lin) {
	    receiver->set_basis (Signal::Linear);
	    cout << "Feed basis set to Linear" << endl;
	  }

	  if (circ) {
	    receiver->set_basis (Signal::Circular);
	    cout << "Feed basis set to Circular" << endl;
	  }
	}
开发者ID:lbaehren,项目名称:lofarsoft,代码行数:67,代码来源:pam.C

示例10:

Pulsar::PhaseWeight* Pulsar::Integration::baseline () const
{
  Reference::To<const Integration> total = this->total();
  return total->get_Profile(0,0)->baseline ();
}
开发者ID:SkyTian13,项目名称:psrchive,代码行数:5,代码来源:Integration_remove_baseline.C

示例11: Error


//.........这里部分代码省略.........
    fits_read_col (fptr, TDOUBLE, colnum, row, 1, 1, &nulldouble,
                   &period, &initflag, &status);

    if (status == 0 && period > 0.0)
    {
      if (verbose > 2)
	cerr << "FITSArchive::load_Integration PERIOD=" << period << endl;
      integ->set_folding_period (period);
    }

    if (integ->get_folding_period() == 0.0)
      throw FITSError (status, "FITSArchive::load_Integration",
                       "folding period unknown: no model, CAL_FREQ or PERIOD");
  }

  status = 0;

  // Load other useful info

  load_Pointing (fptr,row,integ);
  load_Plasma (fptr,row,integ);

  // Set up the data vector, only Pulsar::Archive base class is friend

  resize_Integration (integ);

  const unsigned nchan = get_nchan();

  if (naux_profile)
    for (unsigned ichan=0; ichan < nchan; ichan++)
    {
      FourthMoments* fourth = new FourthMoments;
      fourth->resize (naux_profile, get_nbin());
      integ->get_Profile(0,ichan)->add_extension (fourth);
    }

  // Load the channel centre frequencies
  
  if (verbose > 2)
    cerr << "Pulsar::FITSArchive::load_Integration reading channel freqs" 
	 << endl;
  
  int counter = 1;
  vector < float >  chan_freqs(get_nchan());
  
  colnum = 0;
  fits_get_colnum (fptr, CASEINSEN, "DAT_FREQ", &colnum, &status);
  
  fits_read_col (fptr, TFLOAT, colnum, row, counter, get_nchan(),
		 &nullfloat, &(chan_freqs[0]), &initflag, &status);

  if (status != 0)
    throw FITSError (status, "FITSArchive::load_Integration",
                     "fits_read_col DAT_FREQ");

  // Set the profile channel centre frequencies
  
  if (verbose > 2)
    cerr << "Pulsar::FITSArchive::load_Integration setting frequencies" 
	 << endl;

  bool all_ones = true;
  for (unsigned j = 0; j < get_nchan(); j++)
    if (chan_freqs[j] != 1)
      all_ones = false;
  
开发者ID:lbaehren,项目名称:lofarsoft,代码行数:66,代码来源:load_Integration.C

示例12: Error

void Pulsar::PolnProfileFit::add_observation( const PolnProfile* observation )
{
  if (!standard)
    throw Error (InvalidState, "Pulsar::PolnProfileFit::add_observation",
		 "no standard specified.  call set_standard");

  if (!transformation)
    throw Error (InvalidState, "Pulsar::PolnProfileFit::add_observation",
		 "no transformation specified.  call set_transformation");

  if (!observation)
    throw Error (InvalidState, "Pulsar::PolnProfileFit::add_observation",
		 "no observation supplied as argument");

  // ensure that the PolnProfile class is cleaned up
  Reference::To<const PolnProfile> obs = observation;

  unsigned obs_harmonic = observation->get_nbin() / 2;

  if (obs_harmonic < n_harmonic)
    throw Error (InvalidState, "Pulsar::PolnProfileFit::add_observation",
		 "observation n_harmonic=%d < n_harmonic=%d",
		 obs_harmonic, n_harmonic);

  standard_data->set_profile( observation );

  Reference::To<const PolnProfile> fourier = standard_data->get_fourier();

  float phase_guess = ccf_max_phase (standard_fourier->get_Profile(0),
				     fourier->get_Profile(0));

  if (verbose)
    cerr << "Pulsar::PolnProfileFit::add_observation add gradient" << endl;

  unsigned index = 0;
  bool gradient_added = false;

  if (phases)
  {
    if (!shared_phase || phases->get_ngradient() == 0)
    {
      phases->add_gradient();
      gradient_added = true;
    }

    index = phases->get_igradient();

    phases->set_infit (index, !phase_lock);

    // TO-DO: when sharing phase, retain only the best phase_guess
    phases->set_param (index, phase_guess);
  }

  try
  {
    unsigned nbin_std = standard->get_nbin();
    unsigned nbin_obs = observation->get_nbin();

    /* 
       If the standard (template) and observed profiles have different
       numbers of bins, account for the offset between the centres of
       bin 0 of each profile.
       
       This will likely cause trouble if phases have been removed from
       the model.
       
       A potential fix: multiply the observation by the required phase
       gradient.
    */
    if (phases && nbin_std != nbin_obs)
      phases->set_offset (index, 0.5/nbin_std - 0.5/nbin_obs);
    
    // initialize the measurement sets
    for (unsigned ibin=1; ibin<n_harmonic; ibin++)
    {

      Stokes< complex<double> > val;
      Stokes< complex<double> > var;
      valvar( standard_data->get_stokes(ibin), val, var );
      
      Calibration::TemplateUncertainty* error = uncertainty[ibin-1]->clone();
      error -> set_variance (var);
      
#ifdef _DEBUG
      if (error->get_transformation() != transformation)
	{
	  cerr << "error.xform=" << error->get_transformation() << " != "
	       << transformation.get() << endl;
	}
      else
	cerr << "clone ok!" << endl;
#endif
      
      Calibration::CoherencyMeasurement measurement (ibin-1);
      measurement.set_stokes (val, error);
      
      double phase_shift = -2.0 * M_PI * double(ibin);

      Calibration::CoherencyMeasurementSet measurements (measurement_set);

//.........这里部分代码省略.........
开发者ID:SkyTian13,项目名称:psrchive,代码行数:101,代码来源:PolnProfileFit.C

示例13:

void Pulsar::PolnSpectrumStats::build () try
{
  if (!profile)
    return;

  fourier = fourier_transform (profile, plan);

  // convert to Stokes parameters and drop the Nyquist bin
  fourier->convert_state (Signal::Stokes);
  fourier->resize( profile->get_nbin() );

  // form the power spectral density
  Reference::To<PolnProfile> psd = fourier_to_psd (fourier);

  // separate fourier into real and imaginary components
  Reference::To<PolnProfile> re = psd->clone();
  Reference::To<PolnProfile> im = psd->clone();

  unsigned npol = 4;
  unsigned nbin = psd -> get_nbin();

  for (unsigned ipol=0; ipol < npol; ipol++)
  {
    float* C_ptr = fourier->get_Profile(ipol)->get_amps();
    float* re_ptr = re->get_Profile(ipol)->get_amps();
    float* im_ptr = im->get_Profile(ipol)->get_amps();

    for (unsigned ibin=0; ibin < nbin; ibin++)
    {
      re_ptr[ibin] = C_ptr[ibin*2];
      im_ptr[ibin] = C_ptr[ibin*2+1];
    }
  }

  if (!regions_set)
  {
    LastHarmonic last;
    last.set_Profile( psd->get_Profile(0) );

    last.get_weight (&onpulse);
    last.get_baseline_estimator()->get_weight (&baseline);

    last_harmonic = last.get_last_harmonic();

#ifdef _DEBUG
    cerr << "Pulsar::PolnSpectrumStats::build last harmonic=" 
	 << last_harmonic << " nbin on=" << onpulse.get_weight_sum() << endl;
#endif

    real->set_regions (onpulse, baseline);
    imag->set_regions (onpulse, baseline);
  }

  if (onpulse.get_nbin () != re->get_nbin())
  {
    PhaseWeight on_temp = onpulse;
    PhaseWeight off_temp = baseline;

    on_temp.resize( re->get_nbin() );
    off_temp.resize( re->get_nbin() );

    if (re->get_nbin() > onpulse.get_nbin ())
    {
      copy_pad( on_temp, onpulse, 0 );
      copy_pad( off_temp, baseline, 1 );
    }

    real->set_regions (on_temp, off_temp);
    imag->set_regions (on_temp, off_temp);
  }

  real->set_profile (re.release());
  imag->set_profile (im.release());

}
catch (Error& error)
{
  throw error += "Pulsar::PolnSpectrumStats::build";
}
开发者ID:kernsuite-debian,项目名称:psrchive,代码行数:79,代码来源:PolnSpectrumStats.C

示例14: main

int main(int argc, char* argv[]) try
{
  if (argc < 2) {
    usage();
    return EXIT_SUCCESS;
  }
  
  int gotc = 0;
  while ((gotc = getopt(argc, argv, "hvV")) != -1) {
    switch (gotc) {
    case 'h':
      usage();
      return EXIT_SUCCESS;
    case 'V':
      Pulsar::Archive::set_verbosity(3);
      break;
    case 'v':
      Pulsar::Archive::set_verbosity(2);
      break;
    }
  }
  
  if (optind >= argc)
    {
      cerr << "pazi: please specify filename" << endl;
      return -1;
    }
  
  string filename = argv[optind];
  string extension = filename.substr(filename.length() - 2, 2);
  
  if (extension == "rf")
    extension = "rz";
  else if (extension == "cf")
    extension = "cz";
  else
    extension = "pazi";
  
  string write_filename = filename + ".";
  write_filename += extension;
  
  cerr << "pazi: loading data" << endl;
  base_archive = Archive::load(filename);
  
  if (base_archive->get_npol() == 4)
  {
    original_state = base_archive->get_state();
    base_archive->convert_state( Signal::Stokes );
  }
  
  backup_archive = base_archive->clone();
  
  cerr << "pazi: making fscrunched clone" << endl;
  mod_archive = base_archive->clone();
  mod_archive->pscrunch();
  mod_archive->remove_baseline();
  mod_archive->dedisperse();
  mod_archive->fscrunch();

  scrunched_archive = mod_archive->clone();
  scrunched_archive->tscrunch();

  ranges.second = get_max_value(base_archive, plot_type);
  positive_direction = base_archive->get_bandwidth() < 0.0;

  time_orig_plot = factory.construct("time");
  time_mod_plot = factory.construct("time");
  time_fui = time_mod_plot->get_frame_interface();

  freq_orig_plot = factory.construct("freq");
  freq_mod_plot = factory.construct("freq");
  freq_fui = freq_mod_plot->get_frame_interface();

  total_plot = factory.construct("flux");
  total_plot->configure("info=1");

  subint_orig_plot = new ProfilePlot;
  subint_mod_plot = new ProfilePlot;
  subint_fui = subint_mod_plot->get_frame_interface();

  subint_orig_plot->configure("info=1");
  subint_mod_plot->configure("info=1");

  unsigned window = 0;
  char device [8];

  for (unsigned i=0; i<2; i++) do {
    window ++;
    snprintf (device, 8, "%u/XS", window);
  }
  while ( cpgopen (device) < 0 );

  cpgask(0);

  cerr << endl << "Total S/N = " <<
    scrunched_archive->get_Profile(0,0,0)->snr() << endl << endl;

  total_plot->plot(scrunched_archive);
  cpgslct(1);
  time_orig_plot->plot(mod_archive);
//.........这里部分代码省略.........
开发者ID:kernsuite-debian,项目名称:psrchive,代码行数:101,代码来源:pazi.C

示例15: scan_pulses

int scan_pulses(Reference::To<Pulsar::Archive> arch, vector<pulse>& data, 
		int method, float cphs, float dcyc)
{
  /* Find and store the flux and phase of each pulse in the file
     to the data vector. */
  
  pulse newentry;

  Reference::To<Pulsar::Profile> prof;
  
  newentry.file = arch->get_filename();

  double nm, nv, vm;
  
  int nbin = arch->get_nbin();
  int bwid = int(float(nbin) * dcyc);
  int cbin = 0;

  for (unsigned i = 0; i < arch->get_nsubint(); i++) {

    newentry.intg = i;
    
    prof = arch->get_Profile(i, 0, 0);
    
    prof->stats(prof->find_min_phase(), &nm, &nv, &vm);
    newentry.err = sqrt(nv);

    switch (method) {
      
    case 0: // Method of total flux
      
      newentry.flx = prof->sum();
      newentry.phs = prof->find_max_phase();
      break;
      
    case 1: // Method of maximum amplitude

      if (dcyc == 0.0) {
	newentry.flx = prof->max();
	newentry.phs  = prof->find_max_phase();
      }
      else {
	cbin = int(prof->find_max_phase(dcyc) * float(nbin));
	newentry.flx = prof->sum(cbin - bwid/2, cbin + bwid/2);
	newentry.phs  = prof->find_max_phase(dcyc);
      }
      break;

    case 2: // User-defined phase centre
      
      cbin = int(float(nbin) * cphs);

      if (dcyc == 0.0) {
	newentry.flx = (prof->get_amps())[cbin];
	newentry.phs = cphs;
      }
      else {
	newentry.flx = prof->sum(cbin - bwid/2, cbin + bwid/2);
	newentry.phs = cphs;
      }
      
      break;
      
    default:
      cerr << "No phase selection method chosen!" << endl;
    }
    
    data.push_back(newentry);
  }
  
  return data.size();
}
开发者ID:lbaehren,项目名称:lofarsoft,代码行数:72,代码来源:spa.C


注:本文中的reference::To::get_Profile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。