本文整理汇总了C++中TimeFrequencyData::SetGlobalMask方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeFrequencyData::SetGlobalMask方法的具体用法?C++ TimeFrequencyData::SetGlobalMask怎么用?C++ TimeFrequencyData::SetGlobalMask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeFrequencyData
的用法示例。
在下文中一共展示了TimeFrequencyData::SetGlobalMask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetData
TimeFrequencyData TimeFrequencyImager::GetData() const
{
TimeFrequencyData data;
if(
_realXX != 0 && _imaginaryXX != 0 &&
_realXY != 0 && _imaginaryXY != 0 &&
_realYX != 0 && _imaginaryYX != 0 &&
_realYY != 0 && _imaginaryYY != 0)
{
data = TimeFrequencyData(_realXX, _imaginaryXX, _realXY, _imaginaryXY, _realYX, _imaginaryYX, _realYY, _imaginaryYY);
} else if(
_realXX != 0 && _imaginaryXX != 0 &&
_realYY != 0 && _imaginaryYY != 0)
{
data = TimeFrequencyData(AutoDipolePolarisation, _realXX, _imaginaryXX, _realYY, _imaginaryYY);
} else if(_realStokesI != 0 && _imaginaryStokesI != 0)
{
data = TimeFrequencyData(StokesIPolarisation, _realStokesI, _imaginaryStokesI);
}
if(_flagXX != 0 && _flagXY != 0 && _flagYX != 0 && _flagYY != 0)
{
if(data.Polarisation() != DipolePolarisation)
throw BadUsageException("Trying to read dipole polarisation masks, but TF data does not have the dipole polarisations");
data.SetIndividualPolarisationMasks(_flagXX, _flagXY, _flagYX, _flagYY);
} else if(_flagXX != 0 && _flagYY != 0)
{
if(data.Polarisation() != AutoDipolePolarisation)
throw BadUsageException("Trying to read auto dipole polarisation masks, but TF data does not have the auto dipole polarisations");
data.SetIndividualPolarisationMasks(_flagXX, _flagYY);
} else if(_flagCombined != 0)
{
data.SetGlobalMask(_flagCombined);
}
return data;
}
示例2: loadImageData
void BHFitsImageSet::loadImageData(TimeFrequencyData &data, const TimeFrequencyMetaDataPtr &metaData, const BHFitsImageSetIndex &index)
{
std::vector<num_t> buffer(_width * _height);
_file->ReadCurrentImageData(0, &buffer[0], _width * _height);
int
rangeStart = _timeRanges[index._imageIndex].start,
rangeEnd = _timeRanges[index._imageIndex].end;
Image2DPtr image = Image2D::CreateZeroImagePtr(rangeEnd-rangeStart, _height);
std::vector<num_t>::const_iterator bufferPtr = buffer.begin() + _height*rangeStart;
for(int x=rangeStart; x!=rangeEnd; ++x)
{
for(int y=0; y!=_height; ++y)
{
image->SetValue(x-rangeStart, y, *bufferPtr);
++bufferPtr;
}
}
data = TimeFrequencyData(TimeFrequencyData::AmplitudePart, SinglePolarisation, image);
try {
FitsFile flagFile(flagFilePath());
flagFile.Open(FitsFile::ReadOnlyMode);
flagFile.ReadCurrentImageData(0, &buffer[0], _width * _height);
bufferPtr = buffer.begin() + _height*rangeStart;
Mask2DPtr mask = Mask2D::CreateUnsetMaskPtr(rangeEnd-rangeStart, _height);
for(int x=rangeStart; x!=rangeEnd; ++x)
{
for(int y=0; y!=_height; ++y)
{
bool flag = false;
if(*bufferPtr == 0.0)
flag = false;
else if(*bufferPtr == 1.0)
flag = true;
else std::runtime_error("Expecting a flag file with only ones and zeros, but this file contained other values.");
mask->SetValue(x-rangeStart, y, flag);
++bufferPtr;
}
}
data.SetGlobalMask(mask);
} catch(std::exception &)
{
// Flag file could not be read; probably does not exist. Ignore this, flags will be initialized to false.
}
double
frequencyDelta = _file->GetDoubleKeywordValue("CDELT1"),
timeDelta = _file->GetDoubleKeywordValue("CDELT2");
BandInfo band;
for(int ch=0; ch!=_height; ++ch)
{
ChannelInfo channel;
channel.frequencyHz = ch * frequencyDelta * 1000000.0;
band.channels.push_back(channel);
}
metaData->SetBand(band);
const int rangeWidth = rangeEnd-rangeStart;
std::vector<double> observationTimes(rangeWidth);
for(int t=0; t!=rangeWidth; ++t)
observationTimes[t] = (t + rangeStart) * timeDelta;
metaData->SetObservationTimes(observationTimes);
AntennaInfo antennaInfo;
antennaInfo.id = 0;
antennaInfo.name = RangeName(index._imageIndex);
antennaInfo.diameter = 0.0;
antennaInfo.mount = "Unknown";
antennaInfo.station = GetTelescopeName();
metaData->SetAntenna1(antennaInfo);
metaData->SetAntenna2(antennaInfo);
}