Exemple #1
0
Tempo::toa Pulsar::ArrivalTime::get_toa (Estimate<double>& shift,
					 const Pulsar::Integration* subint,
					 unsigned ichan)
{
  Tempo::toa toa (format);

  // phase shift in turns
  toa.set_phase_shift (shift.get_value());

  // topocentric folding period
  double period = subint->get_folding_period();

  // epoch of the integration (rise time of bin 0 in each profile)
  MJD epoch = subint->get_epoch ();

  // arrival time 
  toa.set_arrival (epoch + shift.get_value() * period);

  // arrival time error in microseconds
  toa.set_error (shift.get_error() * period * 1e6);

  if (subint->get_dedispersed())
    toa.set_frequency (subint->get_centre_frequency());
  else
    toa.set_frequency (subint->get_centre_frequency(ichan));

  toa.set_channel (ichan);

  // would like to see this go somewhere else
  if (format == Tempo::toa::Parkes || format == Tempo::toa::Psrclock)
    toa.set_auxilliary_text( tostring(ichan) );

  return toa;
}
void FluxCalibrator::VariableGain::compute (unsigned ireceptor,
					    Estimate<double>& S_cal,
					    Estimate<double>& S_sys)
{
  if (calculated)
    return;
 
  if (mean_ratio_on.size() <= ireceptor)
    throw Error (InvalidState, "FluxCalibrator::VariableGain::calculate",
		 "no on-source observations available");

  if (mean_ratio_off.size() <= ireceptor)
    throw Error (InvalidState, "FluxCalibrator::VariableGain::calculate",
		 "no off-source observations available");

  // the flux density of the standard candle in each polarization
  double S_std_i = S_std / 2;

  valid = true;

  Estimate<double> on  = mean_ratio_on[ireceptor].get_Estimate();
  Estimate<double> off = mean_ratio_off[ireceptor].get_Estimate();

  if (on==0 || off==0)
  {
    S_cal = S_sys = 0;
    valid = false;
    return;
  }

  ratio_on.set_value (on);
  ratio_off.set_value (off);

  S_sys = S_std_i * flux_sys.get_Estimate();
  S_cal = S_std_i * flux_cal.get_Estimate();

  if (S_cal.val < S_cal.get_error() ||
      S_sys.val < S_sys.get_error() )
  {
    S_cal = S_sys = 0;
    valid = false;
  }
}