42 if (sample_count == 0)
44 throw std::runtime_error(std::format(
"Waveform '{}' contains no samples.", source));
46 if (sample_count >
static_cast<std::size_t
>(std::numeric_limits<unsigned>::max()))
48 throw std::runtime_error(std::format(
"Waveform '{}' has too many samples to load into Signal.", source));
50 return static_cast<unsigned>(sample_count);
56 if (!std::isfinite(sample_count) || sample_count < 0.0 || std::trunc(sample_count) != sample_count)
58 throw std::runtime_error(
"Waveform file '" +
filepath.string() +
"' has an invalid sample count header.");
61 if (sample_count >
static_cast<RealType>(std::numeric_limits<unsigned>::max()))
63 throw std::runtime_error(
"Waveform file '" +
filepath.string() +
64 "' declares more samples than Signal can represent.");
67 return static_cast<unsigned>(sample_count);
83 const FileWaveformKind kind)
85 std::vector<ComplexType>
data;
89 auto signal = std::make_unique<FileSignal>(kind);
91 return std::make_unique<RadarSignal>(
107 const SimId id,
const FileWaveformKind kind)
113 throw std::runtime_error(
"Could not open file '" +
filepath.string() +
"' to read waveform");
121 throw std::runtime_error(
"Could not read waveform header from file '" +
filepath.string() +
"'");
123 if (!std::isfinite(rate) || rate <= 0.0)
126 throw std::runtime_error(
"Waveform file '" +
filepath.string() +
"' has an invalid sample rate");
132 throw std::runtime_error(
"Waveform file '" +
filepath.string() +
"' contains no samples.");
134 std::vector<ComplexType>
data(length);
141 if (
ifile.fail() ||
data.size() != length)
144 throw std::runtime_error(
"Could not read full waveform from file '" +
filepath.string() +
"'");
147 auto signal = std::make_unique<FileSignal>(kind);
169 const FileWaveformKind kind)
175 throw std::runtime_error(
"File-backed CW and FMCW waveforms require the pulsed-compatible HDF5 (.h5) "
194 throw std::runtime_error(
"Unrecognized file extension '" +
extension +
"' for file: " +
filename);
File-backed sampled waveform with explicit radar-mode identity.
Class representing a radar signal with associated properties.
Global configuration file for the project.
double RealType
Type for real numbers.
Header file for HDF5 data export and import functions.
FileWaveformKind
Simulation mode assigned to samples loaded from a waveform file.
@ 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, const FileWaveformKind kind)
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.