/**
 * @details
 * Runs the pipeline.
 *
 * This method is run repeatedly by the pipeline application every time
 * data matching the requested remote data is available until either
 * the pipeline application is killed or the method 'stop()' is called.
 */
void UdpBFPipeline::run(QHash<QString, DataBlob*>& remoteData)
{
  timerStart(&_totalTime);
  
    // Get pointer to the remote time series data blob.
    // This is a block of data containing a number of time series of length
    // N for each sub-band and polarisation.
    timeSeries = (TimeSeriesDataSetC32*) remoteData[_streamIdentifier];
    dataOutput( timeSeries, _streamIdentifier);

    // Run the polyphase channeliser.
    // Generates spectra from a blocks of time series indexed by sub-band
    // and polarisation.
    ppfChanneliser->run(timeSeries, spectra);

    // Convert spectra in X, Y polarisation into spectra with stokes parameters.
    stokesGenerator->run(spectra, stokes);
    // Clips RFI and modifies blob in place
    weightedIntStokes->reset(stokes);

    timerStart(&_rfiClipperTime);
    rfiClipper->run(weightedIntStokes);
    timerUpdate(&_rfiClipperTime);
    dataOutput(&(weightedIntStokes->stats()), "RFI_Stats");

    stokesIntegrator->run(stokes, intStokes);

    // Calls output stream managed->send(data, stream) the output stream
    // manager is configured in the xml.
     dataOutput(intStokes, "SpectrumDataSetStokes");

//    stop();
     if (_iteration % 100 == 0)
       cout << "Finished the CV beamforming pipeline, iteration " << _iteration << " out of " << _totalIterations << endl;
     
     _iteration++;

     if (_iteration == _totalIterations) stop();
     #ifdef TIMING_ENABLED
     timerUpdate(&_totalTime);
     if( _iteration % 100 == 0 )
       {
         timerReport(&_rfiClipperTime, "RFI_Clipper");
         timerReport(&_totalTime, "Pipeline Time (excluding adapter)");
         std::cout << std::endl;
       }
#endif


}
// Defines a single iteration of the pipeline.
void SignalProcessingPipeline::run(QHash<QString, DataBlob*>& remoteData)
{
    // Get pointers to the remote data blob(s) from the supplied hash.
    SignalData* inputData = (SignalData*) remoteData["SignalData"];

    // Output the input data.
    dataOutput(inputData, "pre");

    // Run each module as required.
    amplifier->run(inputData, outputData);

    // Output the processed data.
    dataOutput(outputData, "post");
}
void SigprocPipeline::dedispersionAnalysis( DataBlob* blob ) {
    DedispersionDataAnalysis result;
    DedispersionSpectra* data = static_cast<DedispersionSpectra*>(blob);
    if ( _dedispersionAnalyser->analyse(data, &result) )
      {
        std::cout << "Found " << result.eventsFound() << " events" << std::endl;
        std::cout << "Limits: " << _minEventsFound << " " << _maxEventsFound << " events" << std::endl;
        dataOutput( &result, "TriggerInput" );
        if (_minEventsFound >= _maxEventsFound){
            std::cout << "Writing out..." << std::endl;
            if (result.eventsFound() >= _minEventsFound){
              dataOutput( &result, "DedispersionDataAnalysis" );
              foreach( const SpectrumDataSetStokes* d, result.data()->inputDataBlobs()) {
                dataOutput( d, "SignalFoundSpectrum" );
              }
            }
Ejemplo n.º 4
0
// Defines a single iteration of the pipeline.
void K7UdpPipeline::run(QHash<QString, DataBlob*>& remoteData)
{
    // Get pointers to the remote data blob(s) from the supplied hash.
    SpectrumDataSetStokes* stokes = (SpectrumDataSetStokes*) remoteData["SpectrumDataSetStokes"];
    if( !stokes )
    {
        throw(QString("No stokes!"));
    }

    _stokesIntegrator->run(stokes, _intStokes);
    _weightedIntStokes->reset(_intStokes);

    dataOutput(_intStokes, "SpectrumDataSetStokes");
    _rfiClipper->run(_weightedIntStokes);

    if (_iteration % 5 == 0)
    {
        std::cout << "K7UdpPipeline::run(): Finished the beamforming pipeline, iteration " << _iteration << " out of " << _totalIterations << std::endl;
    }
    _iteration++;

    if (_iteration != 0)
    {
        if (_iteration == _totalIterations)
        {
            stop();
        }
    }
}
Ejemplo n.º 5
0
bool CryptoUtil::Base58CheckDecode(const String& input, OTData& output)
{
    std::vector<unsigned char> decodedInput;
    bool decoded = DecodeBase58Check(input.Get(), decodedInput);

    if (decoded) {
        OTData dataOutput(decodedInput);
        output = dataOutput;

        return true;
    } else {

        return false;
    }
}
void StokesOnlyPipeline::run(QHash<QString, DataBlob*>& remoteData)
{
    SpectrumDataSetStokes* stokes = (SpectrumDataSetStokes*) remoteData["SpectrumStokes"];

    // Clips RFI and modifies blob in place
    _weightedIntStokes->reset(stokes);
    rfiClipper->run(_weightedIntStokes);

    stokesIntegrator->run(stokes, _intStokes);

    // Calls output stream managed->send(data, stream) the output stream
    // manager is configured in the xml.
    dataOutput(_intStokes, "SpectrumDataSetStokes");

}
/*****
 * This function is called once all food is collected or the
 * time limit imposed in the XML file has been reached.
 *****/
void iAnt_loop_functions::PostExperiment() {
    size_t time_in_minutes = floor(floor(data.SimTime/data.TicksPerSecond)/60);
    size_t collectedFood = data.FoodItemCount - data.FoodList.size();

    // This variable is set in XML
    if(data.OutputData == 1) {
        // This file is created in the directory where you run ARGoS
        // it is always created or appended to, never overwritten, i.e. ios::app
        ofstream dataOutput("iAntSpiralTagData.txt", ios::app);

        // output to file
        if(dataOutput.tellp() == 0) {
            dataOutput << "tags_collected, time_in_minutes, random_seed\n"; //, levels\n";
        }

        dataOutput << collectedFood << ", ";
        dataOutput << time_in_minutes << ", " << data.RandomSeed << endl; //<< ", " << levels << endl;
        dataOutput.close();
    }

    // output to ARGoS GUI
    if(data.SimCounter == 0) {
        LOG << "\ntags_collected, time_in_minutes, random_seed\n"; //, levels\n";
        LOG << collectedFood << ", ";
        LOG << time_in_minutes << ", " << data.RandomSeed << endl; //<< ", " << levels << endl;
    } else {
        LOG << collectedFood << ", ";
        LOG << time_in_minutes << ", " << data.RandomSeed << endl; // <<", " << levels << endl;

        /*
        ifstream dataInput("iAntTagData.txt");
        string s;

        while(getline(dataInput, s)) {
            LOG << s << endl;
        }

        dataInput.close();
        */

    }

    data.SimCounter++;
}
Ejemplo n.º 8
0
void MainWindow::saveData()
{
    //serial    denom   owner
    QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "", tr("Text Files (*.txt);;C++ Files (*.cpp *.h *.cc)"));

    if (fileName != "")
    {
        QFile file(fileName);
        if (!file.open(QIODevice::WriteOnly))
        {
            QMessageBox::critical(this, tr("Error"), tr("Could not save file"));
            return;
        }//end if

        else
        {
            QTextStream stream(&file);
            stream << dataOutput();
            stream.flush();
            file.close();
        }//end else
    }//end if
}
/**
 * @details
 * Runs the pipeline.
 *
 * This method is run repeatedly by the pipeline application every time
 * data matching the requested remote data is available until either
 * the pipeline application is killed or the method 'stop()' is called.
 */
void EmbraceBFPipeline::run(QHash<QString, DataBlob*>& remoteData)
{
    // Get pointer to the remote time series data blob.
    // This is a block of data containing a number of time series of length
    // N for each sub-band and polarisation.
    timeSeries = (TimeSeriesDataSetC32*) remoteData[_streamIdentifier];
    // dataOutput( timeSeries, _streamIdentifier);

    // Run the polyphase channeliser.
    // Generates spectra from a blocks of time series indexed by sub-band
    // and polarisation.
    ppfChanneliser->run(timeSeries, spectra);

    // Convert voltage spectra in X, Y direction into power spectra
    embracePowerGenerator->run(spectra, stokes);
    // Clips RFI and modifies blob in place
    weightedIntStokes->reset(stokes);

    rfiClipper->run(weightedIntStokes);

    //    dataOutput(&(weightedIntStokes->stats()), "RFI_Stats");

    stokesIntegrator->run(stokes, intStokes);

    // Calls output stream managed->send(data, stream) the output stream
    // manager is configured in the xml.
     dataOutput(intStokes, "SpectrumDataSetStokes");

//    stop();
     if (_iteration % 100 == 0)
       cout << "Finished the CV beamforming pipeline, iteration " << _iteration << " out of " << _totalIterations << endl;
     
     _iteration++;

     if (_iteration == _totalIterations) stop();
}
/**
 * @details
 * Runs the pipeline.
 *
 * This method is run repeatedly by the pipeline application every time
 * data matching the requested remote data is available until either
 * the pipeline application is killed or the method 'stop()' is called.
 */
void TimingPipeline::run(QHash<QString, DataBlob*>& remoteData)
{
  timerStart(&_totalTime);

    // Get pointer to the remote time series data blob.
    // This is a block of data containing a number of time series of length
    // N for each sub-band and polarisation.
    timeSeries = (TimeSeriesDataSetC32*) remoteData["LofarTimeStream1"];

    // Get the total number of samples per chunk.
    _totalSamplesPerChunk =
            timeSeries->nTimesPerBlock() * timeSeries->nTimeBlocks();

    // Run the polyphase channeliser.
    // Generates spectra from a blocks of time series indexed by sub-band
    // and polarisation.
    timerStart(&_ppfTime);
    ppfChanneliser->run(timeSeries, spectra);
    timerUpdate(&_ppfTime);

    // Convert spectra in X, Y polarisation into spectra with stokes parameters.
    timerStart(&_stokesTime);
    stokesGenerator->run(spectra, stokes);
    timerUpdate(&_stokesTime);

    // The RFI clipper

    timerStart(&_rfiClipper);
    weightedIntStokes->reset(stokes);
    rfiClipper->run(weightedIntStokes);
    timerUpdate(&_rfiClipper);

    //    timerStart(&_integratorTime);
    //    stokesIntegrator->run(stokes, intStokes);
    //    timerUpdate(&_integratorTime);

    // Calls output stream managed->send(data, stream) the output stream
    // manager is configured in the xml.
    //dataOutput(spectra, "SpectrumDataSetC32");
    timerStart(&_outputTime);
    dataOutput(stokes, "SpectrumDataSetStokes");
    timerUpdate(&_outputTime);

//    stop();

    if (_iteration % 50 == 0)
        cout << "Finished the UDP beamforming pipeline, iteration " << _iteration << endl;
  timerUpdate(&_totalTime);
    ++_iteration;

//    if (_iteration > 43000) stop();
    if (_iteration * _totalSamplesPerChunk >= 16*16384*5) {
        stop();
    //timerReport(&(adapter->timeData()), "Adapter Time");
    timerReport(&_ppfTime, "Polyphase Filter");
    timerReport(&_stokesTime, "Stokes Generator");
    timerReport(&_rfiClipper, "RFI_Clipper");
    //    	timerReport(&_integratorTime, "Stokes Integrator");
    timerReport(&_outputTime, "Output");
    timerReport(&_totalTime, "Pipeline Time (excluding adapter)");
    cout << endl;
    cout << "Total (average) allowed time per iteration = "
         << _totalSamplesPerChunk * 5.12e-6 << " sec" << endl;
    //cout << "Total (average) actual time per iteration = "
    //     << adapterTime.timeAverage + _totalTime.timeAverage << " sec" << endl;
    cout << "nSubbands = " << timeSeries->nSubbands() << endl;
    cout << "nPols = " << timeSeries->nPolarisations() << endl;
    cout << "nBlocks = " << timeSeries->nTimeBlocks() << endl;
    cout << "nChannels = " << timeSeries->nTimesPerBlock() << endl;
    cout << endl;
    }
}