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


C++ MJD::get_secs方法代码示例

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


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

示例1: from_MJD

//! convert an MJD to long double
long double from_MJD (const MJD& t)
{
  const long double secs_in_day = 86400.0L;

  return 
    (long double) (t.intday()) +
    (long double) (t.get_secs()) / secs_in_day +
    (long double) (t.get_fracsec()) / secs_in_day;
}
开发者ID:lbaehren,项目名称:lofarsoft,代码行数:10,代码来源:T2Predictor.C

示例2:

//! Return the spin frequency, given the epoch
long double Pulsar::SimplePredictor::frequency (const MJD& t) const
{
  if (reference_epoch == MJD::zero)
     const_cast<SimplePredictor*>(this)->reference_epoch = t;

  MJD diff = t - reference_epoch;
  long double seconds = diff.get_secs();
  seconds += diff.get_fracsec();

  long double power_of_t = 1.0;
  long double result = 0;

  for (unsigned i=0; i<coefs.size(); i++)
  {
    result += coefs[i] * (i+1) * power_of_t;
    power_of_t *= seconds;
  }

  return result;
}
开发者ID:kernsuite-debian,项目名称:psrchive,代码行数:21,代码来源:SimplePredictor.C

示例3: Phase

//! Return the phase, given the epoch
Pulsar::Phase Pulsar::SimplePredictor::phase (const MJD& t) const
{
  if (reference_epoch == MJD::zero)
    const_cast<SimplePredictor*>(this)->reference_epoch = t;

  MJD diff = t - reference_epoch;
  long double seconds = diff.get_secs();
  seconds += diff.get_fracsec();

  long double power_of_t = seconds;
  long double result = 0;

  for (unsigned i=0; i<coefs.size(); i++)
  {
    result += coefs[i] * power_of_t;
    power_of_t *= seconds;
  }

  int64_t iphase = int64_t(result);

  return Pulsar::Phase(iphase,result-iphase);
}
开发者ID:kernsuite-debian,项目名称:psrchive,代码行数:23,代码来源:SimplePredictor.C

示例4: Error

std::string dsp::FilenameEpoch::get_filename (const PhaseSeries* data)
{
  MJD epoch = data->get_start_time();

  if (Observation::verbose)
    cerr << "dsp::FilenameEpoch::get_filename epoch=" 
         << epoch.printall() << endl;

  if (integer_seconds)
  {
    // ensure that the epoch is rounded up into the current division
    epoch = data->get_mid_time (false);

    DEBUG("dsp::FilenameEpoch::get_filename mid_time=" << epoch.printall());

    unsigned seconds = epoch.get_secs();
    unsigned divisions = seconds / integer_seconds;
    epoch = MJD (epoch.intday(), divisions * integer_seconds, 0.0);

    if (Observation::verbose)
      cerr << "dsp::FilenameEpoch::get_filename division_start=" 
           << epoch.printall() << endl;
  }

  vector<char> fname (FILENAME_MAX);
  char* filename = &fname[0];

  if (!epoch.datestr( filename, FILENAME_MAX, datestr_pattern.c_str() ))
    throw Error (FailedSys, "dsp::PhaseSeriesUnloader::get_filename",
       "error MJD::datestr(" + datestr_pattern + ")");

  if (report_unload)
    cerr << "unloading " << tostring(data->get_integration_length(),2)
	 << " seconds: " << filename << endl;

  return filename;
}
开发者ID:UCBerkeleySETI,项目名称:dspsr,代码行数:37,代码来源:PhaseSeriesUnloader.C

示例5: second

double second (const MJD& mjd)
{
  return  mjd.get_secs() + mjd.get_fracsec();
}
开发者ID:lbaehren,项目名称:lofarsoft,代码行数:4,代码来源:psradd.C

示例6: Error


//.........这里部分代码省略.........

  // //////////////////////////////////////////////////////////////////////
  //
  // FREQ
  //
  if (ascii_header_set (header, "FREQ", "%lf", get_centre_frequency()) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload FREQ");


  // //////////////////////////////////////////////////////////////////////
  //
  // BW
  //
  if (ascii_header_set (header, "BW", "%lf", get_bandwidth()) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload BW");


  // //////////////////////////////////////////////////////////////////////
  //
  // NCHAN
  //
  if (ascii_header_set (header, "NCHAN", "%d", get_nchan()) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload NCHAN");


  // //////////////////////////////////////////////////////////////////////
  //
  // NPOL
  //
  if (ascii_header_set (header, "NPOL", "%d", get_npol()) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload NPOL");


  // //////////////////////////////////////////////////////////////////////
  //
  // NBIT
  //
  if (ascii_header_set (header, "NBIT", "%d", get_nbit()) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload NBIT");


  // //////////////////////////////////////////////////////////////////////
  //
  // NDIM
  //
  if (ascii_header_set (header, "NDIM", "%d", get_ndim()) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload NDIM");


  // //////////////////////////////////////////////////////////////////////
  //
  // STATE
  //
  std::string state = Signal::State2string( get_state() );
  if (ascii_header_set (header, "STATE", "%s", state.c_str()) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload STATE");

  // //////////////////////////////////////////////////////////////////////
  //
  // TSAMP
  //
  /* IMPORTANT: TSAMP is the sampling period in microseconds */

  double sampling_interval = 1e6 / get_rate();
  if (ascii_header_set (header, "TSAMP", "%lf", sampling_interval)<0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload TSAMP");


  // //////////////////////////////////////////////////////////////////////
  //
  // UTC_START
  //
  MJD epoch = get_start_time();
  MJD integer_second ( epoch.intday(), epoch.get_secs(), 0.0 );

  char datestr [64];
  integer_second.datestr( datestr, 64, "%Y-%m-%d-%H:%M:%S" );

  if (ascii_header_set (header, "UTC_START", "%s", datestr) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload UTC_START");

  // //////////////////////////////////////////////////////////////////////
  //
  // OBS_OFFSET
  //
  double offset_samples = epoch.get_fracsec() * get_rate();
  uint64_t offset_bytes = get_nbytes( (uint64_t)offset_samples );

  if (ascii_header_set (header, "OBS_OFFSET", UI64, offset_bytes) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload OBS_OFFSET");


  // //////////////////////////////////////////////////////////////////////
  //
  // INSTRUMENT
  //
  if (ascii_header_set (header, "INSTRUMENT", "%s", get_machine().c_str()) < 0)
    throw Error (InvalidState, "ASCIIObservation", "failed unload INSTRUMENT");

}
开发者ID:steve-ord,项目名称:dspsr,代码行数:101,代码来源:ASCIIObservation.C


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