MayaFlux 0.3.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 386 of file StatisticalAnalyzer.hpp.

387 {
388 try {
389 if (name == "method") {
390 try {
391 auto method_str = safe_any_cast_or_throw<std::string>(value);
392 m_method = string_to_method(method_str);
393 } catch (const std::runtime_error&) {
394 auto method_enum = safe_any_cast_or_throw<StatisticalMethod>(value);
395 m_method = method_enum;
396 }
397 } else if (name == "window_size") {
398 auto size = safe_any_cast_or_throw<uint32_t>(value);
399 m_window_size = size;
401 } else if (name == "hop_size") {
402 auto size = safe_any_cast_or_throw<uint32_t>(value);
403 m_hop_size = size;
405 } else if (name == "classification_enabled") {
406 auto enabled = safe_any_cast_or_throw<bool>(value);
407 m_classification_enabled = enabled;
408 } else if (name == "percentile") {
409 auto percentile = safe_any_cast_or_throw<double>(value);
410 if (percentile < 0.0 || percentile > 100.0) {
411 throw std::invalid_argument("Percentile must be between 0.0 and 100.0, got: " + std::to_string(percentile));
412 }
414 } else if (name == "sample_variance") {
415 auto sample = safe_any_cast_or_throw<bool>(value);
416 m_sample_variance = sample;
417 } else {
418 base_type::set_analysis_parameter(name, std::move(value));
419 }
420 } catch (const std::runtime_error& e) {
421 error_rethrow(Journal::Component::Yantra, Journal::Context::ComputeMatrix, std::source_location::current(), "Failed to set parameter '{}': {}", name, e.what());
422 }
423 }
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