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 397 of file StatisticalAnalyzer.hpp.

398 {
399 try {
400 if (name == "method") {
401 try {
402 auto method_str = safe_any_cast_or_throw<std::string>(value);
403 m_method = string_to_method(method_str);
404 } catch (const std::runtime_error&) {
405 auto method_enum = safe_any_cast_or_throw<StatisticalMethod>(value);
406 m_method = method_enum;
407 }
408 } else if (name == "window_size") {
409 auto size = safe_any_cast_or_throw<uint32_t>(value);
412 } else if (name == "hop_size") {
413 auto size = safe_any_cast_or_throw<uint32_t>(value);
416 } else if (name == "classification_enabled") {
417 auto enabled = safe_any_cast_or_throw<bool>(value);
418 m_classification_enabled = enabled;
419 } else if (name == "percentile") {
420 auto percentile = safe_any_cast_or_throw<double>(value);
421 if (percentile < 0.0 || percentile > 100.0) {
422 throw std::invalid_argument("Percentile must be between 0.0 and 100.0, got: " + std::to_string(percentile));
423 }
425 } else if (name == "sample_variance") {
426 auto sample = safe_any_cast_or_throw<bool>(value);
427 m_sample_variance = sample;
428 } else {
429 base_type::set_analysis_parameter(name, std::move(value));
430 }
431 } catch (const std::runtime_error& e) {
432 error_rethrow(Journal::Component::Yantra, Journal::Context::ComputeMatrix, std::source_location::current(), "Failed to set parameter '{}': {}", name, e.what());
433 }
434 }
Range size
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 size.