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


C++ Gaussian::setup方法代码示例

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


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

示例1: sizeof

/**
 * Create a time series of input data.
 *
 * Description:\n
 * 	Creates a time series of complex floats representing a signal at
 * 	a given frequency.
 */
ComplexFloat32 *
createTdData(float64_t fMHz, float64_t driftHz, int32_t samples,
		float64_t noise)
{
	size_t size = samples * sizeof(ComplexFloat32);
	ComplexFloat32 *td = static_cast<ComplexFloat32 *> (fftwf_malloc(size));
	float64_t dfMHz = fMHz - centerFreqMHz;
	float64_t widthMHz = subchannels * subchannelWidthMHz;
	Gaussian gen;
	// no noise, just signal
	gen.setup(0, widthMHz, noise);
	gen.addCwSignal(dfMHz, driftHz, 1);
	gen.getSamples(td, samples);
	return (td);
}
开发者ID:Abhishekpatil,项目名称:SonATA,代码行数:22,代码来源:test.cpp

示例2: MCSend

int
main(int argc, char **argv)
{
	parseArgs(argc, argv);

   if (beam)
      channel = 0;
	sndX = new MCSend(channel, mcPortX+channel, mcAddr);
	sndY = new MCSend(channel, mcPortY+channel, mcAddr);

	/**
	* initialize the sample generators
	*/
	genX.setup(seedX, bandwidth, power);
	genY.setup(seedY, bandwidth, power);
	/**
	* if we're writing to output, open the file
	*/
	if (packetFile.length())
		openFile(packetFile);

	if (beam) {
		pkt = new BeamPacket(source, channel);
		xPkt = new BeamPacket(source, channel);
		yPkt = new BeamPacket(source, channel);
		ATADataPacketHeader hdr = pkt->getHeader();
		complex<float> val(1, 1);
		for (uint32_t i = 0; i < hdr.len; ++i) {
			pkt->putSample(i, val);
			xPkt->putSample(i, val);
			yPkt->putSample(i, val);
		}
		/**
		* send packets with no valid bit to reset Channelizer
		*/
		createPackets(genX, genY, *xPkt, *yPkt);
		sendPackets(*xPkt, *yPkt);
	}
	else {
		pkt = new ChannelPacket(source, channel);
		xPkt = new ChannelPacket(source, channel);
		yPkt = new ChannelPacket(source, channel);
		ATADataPacketHeader hdr = pkt->getHeader();
		complex<float> val(1, 1);
		for (uint32_t i = 0; i < hdr.len; ++i) {
			pkt->putSample(i, val);
			xPkt->putSample(i, val);
			yPkt->putSample(i, val);
		}
	}

	//
	// set the valid flag for all remaining packets
	//
	data_valid = ATADataPacketHeader::DATA_VALID;

	//
	// add signals
	//
	for (PacketSigList::iterator p = signals.begin(); p != signals.end(); ++p) {
		PacketSig sig = *p;
		if (sig.tOff == 0.0)
		{
			if (sig.pol == ATADataPacketHeader::XLINEAR ||
					sig.pol ==  ATADataPacketHeader::BOTH )
						genX.addCwSignal(sig.freq, sig.drift, sig.snr);
			if (sig.pol == ATADataPacketHeader::YLINEAR ||
					sig.pol ==  ATADataPacketHeader::BOTH )
						genY.addCwSignal(sig.freq, sig.drift, sig.snr);
		}
		else
		{
			if (sig.pol == ATADataPacketHeader::XLINEAR ||
					sig.pol ==  ATADataPacketHeader::BOTH )
						genX.addPulseSignal(sig.freq, sig.drift, sig.snr,
							sig.tStart, sig.tOn, sig.tOff);
			if (sig.pol == ATADataPacketHeader::YLINEAR ||
					sig.pol ==  ATADataPacketHeader::BOTH )
						genY.addPulseSignal(sig.freq, sig.drift, sig.snr,
							sig.tStart, sig.tOn, sig.tOff);
		}
	}

	gettimeofday(&start, NULL);
	//
	// now create and send packets at an interval or
	// 	continuously
	//
	if (alarmInterval)
		frameAlarm.set(&alarmHandler, alarmInterval, alarmInterval);
	else
		fullThrottle();

	while (1)
		;
}
开发者ID:Abhishekpatil,项目名称:SonATA,代码行数:96,代码来源:packetgen.cpp


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