本文整理汇总了C++中Gaussian::getSamples方法的典型用法代码示例。如果您正苦于以下问题:C++ Gaussian::getSamples方法的具体用法?C++ Gaussian::getSamples怎么用?C++ Gaussian::getSamples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gaussian
的用法示例。
在下文中一共展示了Gaussian::getSamples方法的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);
}
示例2: s
/**
* Create LCP and RCP packets with different noise and signals
*
*/
void
createPackets(Gaussian &xGen, Gaussian &yGen,
ATAPacket &xPkt, ATAPacket &yPkt)
{
//
// we're reusing the packets, so make sure they're in the right order
//
xPkt.putPacket(pkt->getPacket());
yPkt.putPacket(pkt->getPacket());
ATADataPacketHeader& hdr = xPkt.getHeader();
//
// the following converts the timeval unix time into a 64-bit sec.frac
// format; this requires converting tv_usec to a 32-bit fraction
// of the form usec / 1e6, then conve[Brting it back to a 32-bit unsigned
// integer by multiplying by 2^32.
//
timeval tp;
gettimeofday(&tp, NULL);
hdr.absTime = ATADataPacketHeader::timevalToAbsTime(tp);
hdr.chan = channel;
hdr.freq = cfreq;
// hdr.sampleRate = bandwidth;
// hdr.usableFraction = usable;
hdr.seq = sequence++;
hdr.flags |= data_valid;
static ComplexFloat64 *samples = 0;
// Copy the whole packet to get the header
memcpy(&yPkt, &xPkt, xPkt.getSize());
// Now fill in the samples
if (!samples)
samples = new ComplexFloat64[hdr.len];
if (!local) {
//
// Only create samples for the pols to be sent
//
if ( !singlePol || (singlePol && xPol))
{
xGen.getSamples(samples, hdr.len);
//
// store the samples in the X packet
//
for (uint32_t i = 0; i < hdr.len; ++i) {
ComplexFloat32 s(samples[i]);
if (swapri)
s = ComplexFloat32(s.imag(), s.real());
xPkt.putSample(i, s);
}
}
if ( !singlePol || (singlePol && !xPol))
{
yGen.getSamples(samples, hdr.len);
//
// store the samples in the Y packet
//
for (uint32_t i = 0; i < hdr.len; ++i) {
ComplexFloat32 s(samples[i]);
if (swapri)
s = ComplexFloat32(s.imag(), s.real());
yPkt.putSample(i, s);
}
}
}
switch (polarization) {
case ATADataPacketHeader::XLINEAR:
xPkt.getHeader().polCode = ATADataPacketHeader::XLINEAR;
yPkt.getHeader().polCode = ATADataPacketHeader::YLINEAR;
break;
case ATADataPacketHeader::RCIRC:
default:
xPkt.getHeader().polCode = ATADataPacketHeader::RCIRC;
yPkt.getHeader().polCode = ATADataPacketHeader::LCIRC;
}
}