Skip to content

Pulse CSV File Loading

David Young edited this page Apr 30, 2025 · 1 revision

Description

Loads a pulse waveform from a Comma-Separated Value (.csv) file. This function expects the file to adhere to a specific format: the first line must contain the total number of complex samples and the sample rate (in Hz), separated by a comma. Subsequent lines should each contain one complex data point, parsable by the standard C++ stream extraction operator (operator>>) for ComplexType (likely expecting formats like (real,imag) or real,imag). The loaded data represents the baseband complex envelope of the pulse.

Assumptions

  • Assumes the specified CSV file exists and is readable by the application.
  • Assumes the CSV file strictly follows the required format:
    • Line 1: num_samples,sample_rate
    • Lines 2 to N+1: complex data points (where N = num_samples).
  • Assumes the complex number format on each line is correctly parsable by std::complex<RealType>'s stream extraction operator.
  • Assumes the sample_rate specified within the CSV file accurately reflects the rate at which the complex data points were sampled.
  • Assumes the complex data points represent the desired baseband complex envelope of the pulse waveform.

Limitations

  • Format Rigidity: The loader is highly sensitive to the exact CSV format. Any deviation (e.g., missing first line, incorrect number of samples, different complex number formatting) will likely lead to parsing errors or incorrect behavior.
  • Limited Value Validation: Error checking primarily focuses on the number of samples read matching the count specified in the header. It performs limited validation on the values themselves beyond basic parseability.
  • Parameter Override: The signal duration (RadarSignal::_length) and the signal sample rate (Signal::_rate before potential upsampling) are determined solely by the num_samples and sample_rate values read from the CSV file header. These values may override or conflict with other potentially related simulation parameters (e.g., params::rate() might be intended for something else but doesn't influence the rate read here).
  • File Size: Representing complex waveforms in human-readable CSV format can lead to potentially large file sizes compared to binary formats, impacting storage and loading times.

Related Components

  • pulse_factory.cpp::loadPulseFromCsvFile (The implementing function)
  • RadarSignal (The class holding the loaded signal information)
  • Signal (The class holding the raw complex data vector and rate)
  • Pulse Handling (Overall capability category)
  • Pulse XML Definition (Where the filename is specified)

Validation Status

  • Needs Verification: The robustness of the parser against common CSV formatting errors and the interaction of the CSV-defined sample rate with other system parameters needs thorough testing.
  • Key Areas for Validation:
    • Correct parsing of validly formatted CSV files.
    • Error handling behavior with malformed files (incorrect header, wrong number of samples, unparsable complex numbers).
    • Verification that RadarSignal::_length and Signal::_rate are set correctly based only on the CSV header values.
    • Identify potential conflicts if params::rate() is used elsewhere and has a different value than the rate loaded from the CSV.
    • Performance impact of loading large CSV pulse files.
  • Priority: Medium (Core functionality for custom waveforms, but with known fragility).

Clone this wiki locally