41 if (sample_count >
static_cast<std::size_t
>(std::numeric_limits<unsigned>::max()))
43 throw std::runtime_error(std::format(
"Waveform '{}' has too many samples to load into Signal.", source));
45 return static_cast<unsigned>(sample_count);
51 if (!std::isfinite(sample_count) || sample_count < 0.0 || std::trunc(sample_count) != sample_count)
53 throw std::runtime_error(
"Waveform file '" +
filepath.string() +
"' has an invalid sample count header.");
56 if (sample_count >
static_cast<RealType>(std::numeric_limits<unsigned>::max()))
58 throw std::runtime_error(
"Waveform file '" +
filepath.string() +
59 "' declares more samples than Signal can represent.");
62 return static_cast<unsigned>(sample_count);
79 std::vector<ComplexType>
data;
83 auto signal = std::make_unique<Signal>();
85 return std::make_unique<RadarSignal>(
107 throw std::runtime_error(
"Could not open file '" +
filepath.string() +
"' to read waveform");
115 throw std::runtime_error(
"Could not read waveform header from file '" +
filepath.string() +
"'");
117 if (!std::isfinite(rate) || rate <= 0.0)
120 throw std::runtime_error(
"Waveform file '" +
filepath.string() +
"' has an invalid sample rate");
124 std::vector<ComplexType>
data(length);
131 if (
ifile.fail() ||
data.size() != length)
134 throw std::runtime_error(
"Could not read full waveform from file '" +
filepath.string() +
"'");
137 auto signal = std::make_unique<Signal>();
177 throw std::runtime_error(
"Unrecognized file extension '" +
extension +
"' for file: " +
filename);
Class representing a radar signal with associated properties.
Class for handling radar waveform signal data.
Global configuration file for the project.
double RealType
Type for real numbers.
Header file for HDF5 data export and import functions.
@ FATAL
Fatal level for severe error events.
RealType rate() noexcept
Get the rendering sample rate.
std::unique_ptr< RadarSignal > loadWaveformFromFile(const std::string &name, const std::string &filename, const RealType power, const RealType carrierFreq, const SimId id)
Loads a radar waveform from a file and returns a RadarSignal object.
void readPulseData(const std::string &name, std::vector< ComplexType > &data)
Reads pulse data from an HDF5 file.
Defines the Parameters struct and provides methods for managing simulation parameters.
Classes for handling radar waveforms and signals.
uint64_t SimId
64-bit Unique Simulation ID.