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


C++ TimeFrequencyData::GetImaginaryPart方法代码示例

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


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

示例1: ReadAllBeamlets

std::pair<TimeFrequencyData,TimeFrequencyMetaDataPtr> RSPReader::ReadSingleBeamlet(unsigned long timestepStart, unsigned long timestepEnd, unsigned beamletCount, unsigned beamletIndex)
{
	std::pair<TimeFrequencyData,TimeFrequencyMetaDataPtr> data = ReadAllBeamlets(timestepStart, timestepEnd, beamletCount);
	
	const unsigned width = timestepEnd - timestepStart;
	Image2DPtr realX = Image2D::CreateZeroImagePtr(width, 1);
	Image2DPtr imaginaryX = Image2D::CreateZeroImagePtr(width, 1);
	Image2DPtr realY = Image2D::CreateZeroImagePtr(width, 1);
	Image2DPtr imaginaryY = Image2D::CreateZeroImagePtr(width, 1);
	Mask2DPtr mask = Mask2D::CreateUnsetMaskPtr(width, 1);
	
	TimeFrequencyData allX = data.first.Make(Polarization::XX);
	TimeFrequencyData allY = data.first.Make(Polarization::YY);
	Image2DCPtr xr = allX.GetRealPart();
	Image2DCPtr xi = allX.GetImaginaryPart();
	Image2DCPtr yr = allY.GetRealPart();
	Image2DCPtr yi = allY.GetImaginaryPart();
	Mask2DCPtr maskWithBeamlets = data.first.GetSingleMask();
	
	for(unsigned x=0;x<width;++x)
	{
		realX->SetValue(x, 0, xr->Value(x, beamletIndex));
		imaginaryX->SetValue(x, 0, xi->Value(x, beamletIndex));
		realY->SetValue(x, 0, yr->Value(x, beamletIndex));
		imaginaryY->SetValue(x, 0, yi->Value(x, beamletIndex));
		mask->SetValue(x, 0, maskWithBeamlets->Value(x, beamletIndex));
	}
	data.first = TimeFrequencyData(Polarization::XX, realX, imaginaryX, Polarization::YY, realY, imaginaryY);
	data.first.SetGlobalMask(mask);
	BandInfo band = data.second->Band();
	band.channels[0] = data.second->Band().channels[beamletIndex];
	band.channels.resize(1);
	data.second->SetBand(band);
	return data;
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:35,代码来源:rspreader.cpp

示例2: Image

void UVImager::Image(const TimeFrequencyData &data, TimeFrequencyMetaDataCPtr metaData, unsigned frequencyIndex)
{
	if(_uvReal == 0)
		Empty();

	Image2DCPtr
		real = data.GetRealPart(),
		imaginary = data.GetImaginaryPart();
	Mask2DCPtr
		flags = data.GetSingleMask();

	for(unsigned i=0;i<data.ImageWidth();++i) {
		switch(_imageKind) {
			case Homogeneous:
			if(flags->Value(i, frequencyIndex)==0.0L) {
				num_t
					vr = real->Value(i, frequencyIndex),
					vi = imaginary->Value(i, frequencyIndex);
				if(std::isfinite(vr) && std::isfinite(vi))
				{
					num_t u,v;
					GetUVPosition(u, v, i, frequencyIndex, metaData);
					SetUVValue(u, v, vr, vi, 1.0);
					SetUVValue(-u, -v, vr, -vi, 1.0);
				}
			} 
			break;
			case Flagging:
			if((flags->Value(i, frequencyIndex)!=0.0L && !_invertFlagging) ||
					(flags->Value(i, frequencyIndex)==0.0L && _invertFlagging)) {
				num_t u,v;
				GetUVPosition(u, v, i, frequencyIndex, metaData);
				SetUVValue(u, v, 1, 0, 1.0);
				SetUVValue(-u, -v, 1, 0, 1.0);
			}
			break;
		}
	}
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:39,代码来源:uvimager.cpp

示例3: ReadSingleBeamlet

std::pair<TimeFrequencyData,TimeFrequencyMetaDataPtr> RSPReader::ReadChannelBeamlet(unsigned long timestepStart, unsigned long timestepEnd, unsigned beamletCount, unsigned beamletIndex)
{
	const unsigned width = timestepEnd - timestepStart;
	
	std::pair<TimeFrequencyData,TimeFrequencyMetaDataPtr> data = ReadSingleBeamlet(timestepStart*(unsigned long) 256, timestepEnd*(unsigned long) 256, beamletCount, beamletIndex);

	TimeFrequencyData allX = data.first.Make(Polarization::XX);
	TimeFrequencyData allY = data.first.Make(Polarization::YY);
	Image2DCPtr xr = allX.GetRealPart();
	Image2DCPtr xi = allX.GetImaginaryPart();
	Image2DCPtr yr = allY.GetRealPart();
	Image2DCPtr yi = allY.GetImaginaryPart();
	Mask2DCPtr mask = data.first.GetSingleMask();
	
	Image2DPtr
		outXR = Image2D::CreateUnsetImagePtr(width, 256),
		outXI = Image2D::CreateUnsetImagePtr(width, 256),
		outYR = Image2D::CreateUnsetImagePtr(width, 256),
		outYI = Image2D::CreateUnsetImagePtr(width, 256);
	Mask2DPtr
		outMask = Mask2D::CreateUnsetMaskPtr(width, 256);
	
	std::vector<double> observationTimes;
	for(unsigned long timestep = 0;timestep < timestepEnd-timestepStart;++timestep)
	{
		unsigned long timestepIndex = timestep * 256;
		SampleRow
			realX = SampleRow::MakeFromRow(xr.get(), timestepIndex, 256, 0),
			imaginaryX = SampleRow::MakeFromRow(xi.get(), timestepIndex, 256, 0),
			realY = SampleRow::MakeFromRow(yr.get(), timestepIndex, 256, 0),
			imaginaryY = SampleRow::MakeFromRow(yi.get(), timestepIndex, 256, 0);
		
		FFTTools::FFT(realX, imaginaryX);
		FFTTools::FFT(realY, imaginaryY);
		
		realX.SetVerticalImageValues(outXR.get(), timestep);
		imaginaryX.SetVerticalImageValues(outXI.get(), timestep);
		realY.SetVerticalImageValues(outYR.get(), timestep);
		imaginaryY.SetVerticalImageValues(outYI.get(), timestep);
		
		observationTimes.push_back(data.second->ObservationTimes()[timestepIndex + 256/2]);

		size_t validValues = 0;
		for(unsigned y=0;y<256;++y)
		{
			if(!mask->Value(timestepIndex + y, 0))
				++validValues;
		}
		for(unsigned y=0;y<256;++y)
		{
			outMask->SetValue(timestep, y , validValues == 0);
		}
	}
	
	data.first = TimeFrequencyData(Polarization::XX, outXR, outXI, Polarization::YY, outYR, outYI);
	data.first.SetGlobalMask(outMask);
	BandInfo band = data.second->Band();
	band.channels.clear();
	for(unsigned i=0;i<256;++i)
	{
		ChannelInfo channel;
		channel.frequencyHz = i+1;
		channel.frequencyIndex = i;
		band.channels.push_back(channel);
	}
	data.second->SetBand(band);
	data.second->SetObservationTimes(observationTimes);
	return data;
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:69,代码来源:rspreader.cpp


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