本文整理汇总了C++中Model::AddSource方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::AddSource方法的具体用法?C++ Model::AddSource怎么用?C++ Model::AddSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::AddSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetModelFromImage
void DeconvolutionAlgorithm::GetModelFromImage(Model &model, const double* image, size_t width, size_t height, double phaseCentreRA, double phaseCentreDec, double pixelSizeX, double pixelSizeY, double phaseCentreDL, double phaseCentreDM, double spectralIndex, double refFreq, PolarizationEnum polarization)
{
for(size_t y=0; y!=height; ++y)
{
for(size_t x=0; x!=width; ++x)
{
double value = image[y*width + x];
if(value != 0.0 && std::isfinite(value))
{
long double l, m;
ImageCoordinates::XYToLM<long double>(x, y, pixelSizeX, pixelSizeY, width, height, l, m);
l += phaseCentreDL; m += phaseCentreDM;
ModelComponent component;
long double ra, dec;
ImageCoordinates::LMToRaDec<long double>(l, m, phaseCentreRA, phaseCentreDec, ra, dec);
std::stringstream nameStr;
nameStr << "component" << model.SourceCount();
component.SetSED(MeasuredSED(value, refFreq, spectralIndex, polarization));
component.SetPosRA(ra);
component.SetPosDec(dec);
ModelSource source;
source.SetName(nameStr.str());
source.AddComponent(component);
model.AddSource(source);
}
}
}
}
示例2: GetModelFromIQUVImage
void DeconvolutionAlgorithm::GetModelFromIQUVImage(Model &model, const double* images[4], size_t width, size_t height, double phaseCentreRA, double phaseCentreDec, double pixelSizeX, double pixelSizeY, double phaseCentreDL, double phaseCentreDM, double spectralIndex, double refFreq)
{
for(size_t y=0; y!=height; ++y)
{
for(size_t x=0; x!=width; ++x)
{
bool isNonZero = false;
double values[4];
for(size_t p=0; p!=4; ++p)
{
values[p] = images[p][y*width + x];
if(values[p] != 0.0 && std::isfinite(values[p]))
isNonZero = true;
}
if(isNonZero)
{
long double l, m;
ImageCoordinates::XYToLM<long double>(x, y, pixelSizeX, pixelSizeY, width, height, l, m);
l += phaseCentreDL; m += phaseCentreDM;
ModelComponent component;
long double ra, dec;
ImageCoordinates::LMToRaDec<long double>(l, m, phaseCentreRA, phaseCentreDec, ra, dec);
std::stringstream nameStr;
nameStr << "component" << model.SourceCount();
MeasuredSED sed;
component.SetSED(MeasuredSED(values, refFreq));
component.SetPosRA(ra);
component.SetPosDec(dec);
ModelSource source;
source.SetName(nameStr.str());
source.AddComponent(component);
model.AddSource(source);
}
}
}
}