302 {
303 try {
306
307 std::vector<std::span<const double>> channel_spans;
308 for (auto& span : data_span)
309 channel_spans.emplace_back(span.data(), span.size());
310
311 for (const auto& channel_span : channel_spans) {
313 throw std::runtime_error(
"One or more channels in input data are smaller than window size (" + std::to_string(
m_window_size) +
")");
314 }
315 }
316
317 std::vector<std::vector<double>> energy_values;
318 energy_values.reserve(channel_spans.size());
319 for (const auto& channel_span : channel_spans) {
321 }
322
324 energy_values, channel_spans, structure_info);
325
327
329 } catch (const std::exception& e) {
330 std::cerr << "Energy analysis failed: " << e.what() << '\n';
332 error_result.
metadata = input.metadata;
333 error_result.metadata["error"] = std::string("Analysis failed: ") + e.what();
334 return error_result;
335 }
336 }
output_type create_pipeline_output(const input_type &input, const EnergyAnalysis &analysis_result, DataStructureInfo &info)
Create pipeline output from input and energy values.
IO< OutputType > output_type
EnergyAnalysis create_analysis_result(const std::vector< std::vector< double > > &energy_values, std::vector< std::span< const double > > original_data, const DataStructureInfo &) const
Create comprehensive analysis result from energy computation.
std::vector< double > compute_energy_values(std::span< const double > data, EnergyMethod method) const
Compute energy values using span (zero-copy processing)
IO< InputType > input_type
static std::tuple< std::vector< std::span< double > >, DataStructureInfo > extract_structured_double(T &compute_data)
Extract structured double data from IO container or direct ComputeData with automatic container handl...
void store_current_analysis(AnalysisResultType &&result) const
std::unordered_map< std::string, std::any > metadata
Associated metadata.