本文整理汇总了C++中reference::To::find_max_phase方法的典型用法代码示例。如果您正苦于以下问题:C++ To::find_max_phase方法的具体用法?C++ To::find_max_phase怎么用?C++ To::find_max_phase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reference::To
的用法示例。
在下文中一共展示了To::find_max_phase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}