MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ set_analysis_parameter()

template<ComputeData InputType = std::vector<Kakshya::DataVariant>, ComputeData OutputType = Eigen::VectorXd>
void MayaFlux::Yantra::StatisticalAnalyzer< InputType, OutputType >::set_analysis_parameter ( const std::string &  name,
std::any  value 
)
inlineoverrideprotectedvirtual

Handle analysis-specific parameters.

Reimplemented from MayaFlux::Yantra::UniversalAnalyzer< InputType, OutputType >.

Definition at line 396 of file StatisticalAnalyzer.hpp.

397 {
398 try {
399 if (name == "method") {
400 try {
401 auto method_str = safe_any_cast_or_throw<std::string>(value);
402 m_method = string_to_method(method_str);
403 } catch (const std::runtime_error&) {
404 auto method_enum = safe_any_cast_or_throw<StatisticalMethod>(value);
405 m_method = method_enum;
406 }
407 } else if (name == "window_size") {
408 auto size = safe_any_cast_or_throw<uint32_t>(value);
409 m_window_size = size;
411 } else if (name == "hop_size") {
412 auto size = safe_any_cast_or_throw<uint32_t>(value);
413 m_hop_size = size;
415 } else if (name == "classification_enabled") {
416 auto enabled = safe_any_cast_or_throw<bool>(value);
417 m_classification_enabled = enabled;
418 } else if (name == "percentile") {
419 auto percentile = safe_any_cast_or_throw<double>(value);
420 if (percentile < 0.0 || percentile > 100.0) {
421 error<std::invalid_argument>(Journal::Component::Yantra, Journal::Context::ComputeMatrix, std::source_location::current(), "Percentile must be between 0.0 and 100.0, got: {}", percentile);
422 }
424 } else if (name == "sample_variance") {
425 auto sample = safe_any_cast_or_throw<bool>(value);
426 m_sample_variance = sample;
427 } else {
428 base_type::set_analysis_parameter(name, std::move(value));
429 }
430 } catch (const std::runtime_error& e) {
431 error_rethrow(Journal::Component::Yantra, Journal::Context::ComputeMatrix, std::source_location::current(), "Failed to set parameter '{}': {}", name, e.what());
432 }
433 }
void validate_window_parameters() const
Validate window parameters.
static StatisticalMethod string_to_method(const std::string &str)
Convert string to statistical method enum.
virtual void set_analysis_parameter(const std::string &name, std::any value)
Analysis-specific parameter handling (override for custom parameters)
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP)
void error_rethrow(Component component, Context context, std::source_location location=std::source_location::current(), std::string_view additional_context="")
Catch and log an exception, then rethrow it.
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
std::vector< double > percentile(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size, double percentile_value)
Arbitrary percentile per window via linear interpolation.
Definition Analysis.cpp:350

References MayaFlux::Journal::ComputeMatrix, MayaFlux::Yantra::StatisticalAnalyzer< InputType, OutputType >::m_classification_enabled, MayaFlux::Yantra::StatisticalAnalyzer< InputType, OutputType >::m_hop_size, MayaFlux::Yantra::StatisticalAnalyzer< InputType, OutputType >::m_method, MayaFlux::Yantra::StatisticalAnalyzer< InputType, OutputType >::m_percentile_value, MayaFlux::Yantra::StatisticalAnalyzer< InputType, OutputType >::m_sample_variance, MayaFlux::Yantra::StatisticalAnalyzer< InputType, OutputType >::m_window_size, MayaFlux::Yantra::UniversalAnalyzer< InputType, OutputType >::set_analysis_parameter(), MayaFlux::Yantra::StatisticalAnalyzer< InputType, OutputType >::string_to_method(), MayaFlux::Yantra::StatisticalAnalyzer< InputType, OutputType >::validate_window_parameters(), and MayaFlux::Journal::Yantra.

+ Here is the call graph for this function: