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


C++ Observation::GetT4方法代码示例

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


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

示例1: run_sim

void run_sim(Target *target, Array *array, Combiner *combiner, SpectralMode *spec, NoiseModel *noisemodel, vector<Observation *> observation_list, string output_filename)
{
  // Pull up the random number generator.
  static Rand_t random_seed;

  // See if the output file aready exists:
  // TODO: this could be bad/unexpected behavior.
  if (FileExists(output_filename))
  {
    cout << "Warning, output file aready exists!  Overwriting..." << endl;
    output_filename = "!" + output_filename;
  }

  // Open up the OIFITS file.
  fitsfile *fptr;
  int status = 0;
  fits_create_file(&fptr, output_filename.c_str(), &status);
  if (status)
  {
    fits_report_error(stderr, status);
    return;
  }

  {
    oi_array oi_arr = array->GetOIArray();
    write_oi_array(fptr, oi_arr, 1, &status);
    free_oi_array(&oi_arr);
  }
  {
    oi_target oi_targ = target->GetOITarget();
    write_oi_target(fptr, oi_targ, &status);
    free_oi_target(&oi_targ);
  }
  {
    oi_wavelength oi_wave = spec->GetOIWavelength();
    write_oi_wavelength(fptr, oi_wave, 1, &status);
    free_oi_wavelength(&oi_wave);
  }

  vector<double> wavenumbers = spec->GetWavenumbers();

  // Now compute the vis2 records and t3s:
  int n_observations = observation_list.size();

  cout << "N Observations: " << observation_list.size() << endl;

  for (unsigned int i = n_observations; i > 0; i--)
  {
    Observation *observation = observation_list.back();
    // First look up the type of observation
    ObsType type = observation->GetObsType();

    // Do a dymamic cast to get the subclass object back
    if (type == HOUR_ANGLE || type == DESCRIPTIVE)
    {
      Obs_HA *observation = dynamic_cast<Obs_HA *>(observation_list.back());
      //printf("Simulating Observation at HA %f \n", observation->GetHA(target->right_ascension));

    }
    else    //(type == OIFITS)
    {
      Obs_OIFITS *observation = dynamic_cast<Obs_OIFITS *>(observation_list.back());
    }

    {
      oi_vis2 vis2table = observation->GetVis2(array, combiner, spec, target, noisemodel, random_seed);
      write_oi_vis2(fptr, vis2table, 1, &status);
      free_oi_vis2(&vis2table);
    }

    if (observation->HasTriplets())
    {
      oi_t3 t3table = observation->GetT3(array, combiner, spec, target, noisemodel, random_seed);
      write_oi_t3(fptr, t3table, 1, &status);
      free_oi_t3(&t3table);
    }

    if (observation->HasQuadruplets())
    {
      oi_t4 t4table = observation->GetT4(array, combiner, spec, target, noisemodel, random_seed);
      write_oi_t4(fptr, t4table, 1, &status);
      free_oi_t4(&t4table);
    }


    // All done with this observation object.  Pop it off the vector and free memory.
    observation_list.pop_back();
    delete observation;

    cout << "Completed Observation " << (n_observations - i + 1) << endl;
  }

  if (status)
  {
    fits_delete_file(fptr, &status);
    return;
  }
  else
  {
    fits_close_file(fptr, &status);
//.........这里部分代码省略.........
开发者ID:bkloppenborg,项目名称:oifits-sim,代码行数:101,代码来源:oifits-sim.cpp


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