|
SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
|
Orchestrates execution of source apportionment analysis operations. More...
#include <conductor.h>

Public Member Functions | |
| Conductor (AnalysisHost *host) | |
Constructs a Conductor that reports through host. | |
| bool | Execute (const std::string &command, const std::map< std::string, std::string > &arguments) |
| Executes a specified analysis command with given parameters. | |
| SourceSinkData * | Data () |
| Returns pointer to the current SourceSinkData. | |
| void | SetData (SourceSinkData *_data) |
| Sets the SourceSinkData for analysis. | |
| Results * | GetResults () |
| Creates and returns a heap-allocated copy of current results. | |
| void | SetWorkingFolder (const QString &wf) |
| Sets the working directory for output files. | |
| QString | WorkingFolder () const |
| Returns the current working directory path. | |
| bool | CheckNegativeElements (SourceSinkData *data=nullptr) |
| Validates that all element concentrations are non-negative. | |
| bool | CheckNegativeElements (std::map< std::string, std::vector< std::string > > negative_elements) |
| Validates element concentrations across multiple samples. | |
| void | ReportNegativeContributions (const std::vector< std::string > &offenders) |
| Reports negative source contributions through the AnalysisHost. | |
| void | ReportBoxCoxSkips (SourceSinkData &dataset, const std::string &group, const std::string &consequence) |
| Warns about constituents the Box-Cox transformation leaves untransformed. | |
| SourceSinkData | BoxCoxTransformedWithReport (SourceSinkData &dataset) |
| Box-Cox transforms data with optimal lambdas, reporting skipped constituents. | |
| bool | ResolveRandomSeed (std::map< std::string, std::string > &arguments, std::uint64_t &seed) |
| Resolves the "Random seed" argument of an MCMC analysis. | |
Private Member Functions | |
| bool | ExecuteLevenbergMarquardt (const std::map< std::string, std::string > &arguments) |
| Executes Levenberg-Marquardt nonlinear optimization. | |
| bool | ExecuteLevenbergMarquardtBatch (const std::map< std::string, std::string > &arguments) |
| Executes Levenberg-Marquardt optimization across all target samples. | |
| bool | ExecuteOMSizeCorrect (const std::map< std::string, std::string > &arguments) |
| Executes organic matter and particle size correction. | |
| bool | ExecuteMLR (const std::map< std::string, std::string > &arguments) |
| Executes multiple linear regression versus organic matter and particle size. | |
| bool | ExecuteCovarianceMatrix (const std::map< std::string, std::string > &arguments) |
| Calculates covariance matrix for a source or target group. | |
| bool | ExecuteCorrelationMatrix (const std::map< std::string, std::string > &arguments) |
| Calculates correlation matrix for a source or target group. | |
| bool | ExecuteDFA (const std::map< std::string, std::string > &arguments) |
| Executes Discriminant Function Analysis between two groups. | |
| bool | ExecuteDFAOnevsRest (const std::map< std::string, std::string > &arguments) |
| Executes Discriminant Function Analysis for one group versus all others. | |
| bool | ExecuteDFAM (const std::map< std::string, std::string > &arguments) |
| Executes multi-way Discriminant Function Analysis across all groups. | |
| bool | ExecuteSDFA (const std::map< std::string, std::string > &arguments) |
| Executes Stepwise Discriminant Function Analysis between two groups. | |
| bool | ExecuteSDFAM (const std::map< std::string, std::string > &arguments) |
| Executes multi-way Stepwise Discriminant Function Analysis across all groups. | |
| bool | ExecuteSDFAOnevsRest (const std::map< std::string, std::string > &arguments) |
| Executes Stepwise Discriminant Function Analysis for one group versus all others. | |
| bool | ExecuteKolmogorovSmirnov (const std::map< std::string, std::string > &arguments) |
| Executes Kolmogorov-Smirnov goodness-of-fit test for a source/target group. | |
| bool | ExecuteKolmogorovSmirnovIndividual (const std::map< std::string, std::string > &arguments) |
| Executes Kolmogorov-Smirnov test for a single constituent in a group. | |
| bool | ExecuteCMBBayesian (const std::map< std::string, std::string > &arguments) |
| Executes Bayesian Chemical Mass Balance using MCMC sampling. | |
| bool | ExecuteCMBBayesianBatch (const std::map< std::string, std::string > &arguments) |
| Executes Bayesian Chemical Mass Balance across all target samples. | |
| bool | ExecuteTestCMBBayesian (const std::map< std::string, std::string > &arguments) |
| Executes MCMC test with a simple analytical model. | |
| bool | ExecuteDistributionFitting (const std::map< std::string, std::string > &arguments) |
| Executes distribution fitting analysis for a constituent. | |
| bool | ExecuteBracketingAnalysis (const std::map< std::string, std::string > &arguments) |
| Executes bracketing analysis for a single target sample. | |
| bool | ExecuteBracketingAnalysisBatch (const std::map< std::string, std::string > &arguments) |
| Executes bracketing analysis across all target samples. | |
| bool | ExecuteBoxCox (const std::map< std::string, std::string > &arguments) |
| Calculates optimal Box-Cox transformation parameters. | |
| bool | ExecuteOutlierAnalysis (const std::map< std::string, std::string > &arguments) |
| Executes outlier detection analysis for a source/target group. | |
| bool | ExecuteEDP (const std::map< std::string, std::string > &arguments) |
| Calculates two-way element discriminant power between two groups. | |
| bool | ExecuteEDPM (const std::map< std::string, std::string > &arguments) |
| Calculates multi-way element discriminant power across all groups. | |
| bool | ExecuteANOVA (const std::map< std::string, std::string > &arguments) |
| Executes Analysis of Variance (ANOVA) for element discrimination. | |
| bool | ExecuteErrorAnalysis (const std::map< std::string, std::string > &given_arguments) |
| Executes bootstrap error analysis for uncertainty quantification. | |
| bool | ExecuteSourceVerify (const std::map< std::string, std::string > &arguments) |
| Executes source verification analysis. | |
| bool | ExecuteAutoSelect (const std::map< std::string, std::string > &arguments) |
| Executes automatic element selection based on discriminant power. | |
Private Attributes | |
| SourceSinkData * | data |
| Non-owning pointer to analysis data. | |
| std::unique_ptr< CMCMC< SourceSinkData > > | MCMC |
| MCMC sampler (owned). | |
| Results | results |
| Current analysis results (cleared each Execute). | |
| QString | workingfolder |
| Output directory path. | |
| AnalysisHost * | host |
| Non-owning pointer to the running environment. | |
Orchestrates execution of source apportionment analysis operations.
The Conductor class serves as a command dispatcher and coordinator for various source apportionment algorithms including Genetic Algorithms (GA), Markov Chain Monte Carlo (MCMC), Levenberg-Marquardt optimization, and statistical analyses. It manages the lifecycle of optimization algorithms, maintains analysis results, and provides an interface between the GUI (MainWindow) and the computational backend (SourceSinkData).
Key responsibilities:
Definition at line 43 of file conductor.h.
|
explicit |
| SourceSinkData Conductor::BoxCoxTransformedWithReport | ( | SourceSinkData & | dataset | ) |
Box-Cox transforms data with optimal lambdas, reporting skipped constituents.
Definition at line 320 of file conductor.cpp.
References SourceSinkData::BoxCoxTransformed(), and ReportBoxCoxSkips().
Referenced by ExecuteANOVA(), ExecuteDFA(), ExecuteDFAM(), ExecuteDFAOnevsRest(), ExecuteDistributionFitting(), ExecuteEDP(), ExecuteEDPM(), ExecuteSDFA(), ExecuteSDFAM(), and ExecuteSDFAOnevsRest().
| bool Conductor::CheckNegativeElements | ( | SourceSinkData * | data = nullptr | ) |
Validates that all element concentrations are non-negative.
Checks the specified SourceSinkData for negative element concentrations, which are physically invalid for most source apportionment analyses (except isotope delta values). Displays a warning dialog if negative values are found.
| data | Pointer to SourceSinkData to check (uses this->data if nullptr) |
Definition at line 201 of file conductor.cpp.
References Data(), host, and SourceSinkData::NegativeValueCheck().
Referenced by Execute(), ExecuteANOVA(), ExecuteAutoSelect(), ExecuteBracketingAnalysis(), ExecuteBracketingAnalysisBatch(), ExecuteDFAM(), ExecuteDistributionFitting(), ExecuteEDP(), ExecuteEDPM(), ExecuteErrorAnalysis(), ExecuteLevenbergMarquardt(), ExecuteLevenbergMarquardtBatch(), ExecuteOutlierAnalysis(), ExecuteSDFA(), ExecuteSDFAM(), ExecuteSDFAOnevsRest(), and ExecuteSourceVerify().
| bool Conductor::CheckNegativeElements | ( | std::map< std::string, std::vector< std::string > > | negative_elements | ) |
Validates element concentrations across multiple samples.
Checks for negative concentrations in a collection of samples, where each map entry represents a sample and its list of problematic elements.
| negative_elements | Map from sample names to lists of elements with negative values |
Definition at line 232 of file conductor.cpp.
References host.
|
inline |
Returns pointer to the current SourceSinkData.
Definition at line 80 of file conductor.h.
References data.
Referenced by CheckNegativeElements(), Execute(), ExecuteANOVA(), ExecuteAutoSelect(), ExecuteBoxCox(), ExecuteBracketingAnalysis(), ExecuteBracketingAnalysisBatch(), ExecuteCMBBayesian(), ExecuteCMBBayesianBatch(), ExecuteCorrelationMatrix(), ExecuteCovarianceMatrix(), ExecuteDFA(), ExecuteDFAM(), ExecuteDFAOnevsRest(), ExecuteDistributionFitting(), ExecuteEDP(), ExecuteEDPM(), ExecuteErrorAnalysis(), ExecuteKolmogorovSmirnov(), ExecuteKolmogorovSmirnovIndividual(), ExecuteLevenbergMarquardt(), ExecuteLevenbergMarquardtBatch(), ExecuteMLR(), ExecuteOMSizeCorrect(), ExecuteOutlierAnalysis(), ExecuteSDFA(), ExecuteSDFAM(), ExecuteSDFAOnevsRest(), and ExecuteSourceVerify().
| bool Conductor::Execute | ( | const std::string & | command, |
| const std::map< std::string, std::string > & | arguments ) |
Executes a specified analysis command with given parameters.
Supported commands include:
| command | Command name identifying the analysis type |
| arguments | Map of parameter names to values configuring the analysis |
Definition at line 24 of file conductor.cpp.
References SourceSinkData::AddtoToolsUsed(), CheckNegativeElements(), Data(), ExecuteANOVA(), ExecuteAutoSelect(), ExecuteBoxCox(), ExecuteBracketingAnalysis(), ExecuteBracketingAnalysisBatch(), ExecuteCMBBayesian(), ExecuteCMBBayesianBatch(), ExecuteCorrelationMatrix(), ExecuteCovarianceMatrix(), ExecuteDFA(), ExecuteDFAM(), ExecuteDFAOnevsRest(), ExecuteDistributionFitting(), ExecuteEDP(), ExecuteEDPM(), ExecuteErrorAnalysis(), ExecuteKolmogorovSmirnov(), ExecuteKolmogorovSmirnovIndividual(), ExecuteLevenbergMarquardt(), ExecuteLevenbergMarquardtBatch(), ExecuteMLR(), ExecuteOMSizeCorrect(), ExecuteOutlierAnalysis(), ExecuteSDFA(), ExecuteSDFAM(), ExecuteSDFAOnevsRest(), ExecuteSourceVerify(), ExecuteTestCMBBayesian(), host, SourceSinkData::IsotopesWithUnusableBaseElement(), and results.
|
private |
Executes Analysis of Variance (ANOVA) for element discrimination.
Performs one-way ANOVA to test whether elemental concentrations differ significantly across source groups. Returns p-values for each element indicating the statistical significance of between-group differences. Elements with low p-values (below threshold) show significant variation across sources and are good candidates for source apportionment. Optionally modifies included elements based on results. Supports log transformation and Box-Cox transformation.
| arguments | Map of configuration parameters including:
|
Definition at line 2262 of file conductor.cpp.
References SourceSinkData::ANOVA(), BoxCoxTransformedWithReport(), CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), CMBVector::ExtractWithinRange(), high, host, SourceSinkData::IncludeExcludeElementsBasedOn(), CMBVector::Labels(), low, normal, results, Interface::SetLimit(), ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::setXAxisTitle(), ResultItem::SetYAxisMode(), ResultItem::setYAxisTitle(), and vector.
Referenced by Execute().
|
private |
Executes automatic element selection based on discriminant power.
Automatically selects the optimal subset of elements for source apportionment by analyzing multi-way discriminant p-values for all source group pairs. Elements are ranked by their ability to discriminate between sources, and the top N elements from each pairwise comparison are aggregated to form the final selection. Optionally modifies the included elements in the dataset. Supports isotope inclusion, Box-Cox transformation, and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 2471 of file conductor.cpp.
References CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), SourceSinkData::DifferentiationPower_P_value(), elemental_profile_set, SourceSinkData::ExtractChemicalElements(), Elemental_Profile::GetElementNames(), high, host, SourceSinkData::IncludeExcludeElementsBasedOn(), normal, predicted_concentration, results, Elemental_Profile_Set::SelectTopElementsAggregate(), ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetYAxisMode(), ResultItem::setYAxisTitle(), and ResultItem::SetYLimit().
Referenced by Execute().
|
private |
Calculates optimal Box-Cox transformation parameters.
Computes the optimal Box-Cox lambda parameters for variance-stabilizing power transformations of elemental concentrations within a source or target group. Box-Cox transformation can normalize skewed distributions and stabilize variance, improving the performance of subsequent statistical analyses.
| arguments | Map of configuration parameters including:
|
Definition at line 1992 of file conductor.cpp.
References Data(), normal, ReportBoxCoxSkips(), results, ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetYAxisMode(), and vector.
Referenced by Execute().
|
private |
Executes bracketing analysis for a single target sample.
Performs bracketing test to determine if target sample concentrations fall within the range defined by source group concentrations. For each element, the test checks whether the target value is bracketed (bounded) by the minimum and maximum source values. Results are boolean indicators showing which elements pass the bracketing criterion. Supports optional OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 1908 of file conductor.cpp.
References SourceSinkData::BracketTest(), CheckNegativeElements(), SourceSinkData::CreateTracerDataset(), Data(), host, ReadBracketTolerance(), results, CMBVector::SetBooleanValue(), ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), and vector.
Referenced by Execute().
|
private |
Executes bracketing analysis across all target samples.
Performs batch bracketing test to determine if target sample concentrations fall within the range defined by source group concentrations for all samples. Returns a matrix showing boolean bracketing results for each element in each target sample. This batch analysis enables quick assessment of which samples and elements satisfy the bracketing criterion. Supports optional OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 1946 of file conductor.cpp.
References CheckNegativeElements(), Data(), data, host, matrix, ReadBracketTolerance(), results, CMBMatrix::SetBooleanValue(), ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), and ResultItem::SetType().
Referenced by Execute().
|
private |
Executes Bayesian Chemical Mass Balance using MCMC sampling.
Performs Bayesian inference for source apportionment using Markov Chain Monte Carlo (MCMC) sampling. This probabilistic approach estimates posterior distributions of source contributions accounting for uncertainties in both source profiles and receptor measurements. Generates comprehensive results including contribution distributions, parameter traces, and convergence diagnostics. Supports optional organic matter/size corrections and softmax transformations.
| arguments | Map of configuration parameters including:
|
Definition at line 2545 of file conductor.cpp.
References Data(), host, MCMC, SourceSinkData::MCMC(), ResolveRandomSeed(), results, and workingfolder.
Referenced by Execute().
|
private |
Executes Bayesian Chemical Mass Balance across all target samples.
Performs batch MCMC-based Bayesian source apportionment for all target samples, producing a comprehensive contribution matrix showing probabilistic source contributions with uncertainty ranges across multiple samples. This is the batch version of CMB Bayesian, enabling efficient spatial or temporal analysis of source contributions. Supports optional organic matter/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 1584 of file conductor.cpp.
References Data(), host, matrix, MCMC, normal, ResolveRandomSeed(), results, ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetYAxisMode(), and workingfolder.
Referenced by Execute().
|
private |
Calculates correlation matrix for a source or target group.
Computes the correlation matrix showing normalized relationships between elemental concentrations within a specified source or target group. Supports optional organic matter/size corrections and Box-Cox transformations. Values outside the specified threshold are highlighted.
| arguments | Map of configuration parameters including:
|
Definition at line 790 of file conductor.cpp.
References SourceSinkData::CreateCorrectedAndFilteredDataset(), SourceSinkData::CreateCorrectedDataset(), Data(), high, host, low, matrix, results, Interface::SetLimit(), ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::setTableTitle(), and ResultItem::SetType().
Referenced by Execute().
|
private |
Calculates covariance matrix for a source or target group.
Computes the covariance matrix showing relationships between elemental concentrations within a specified source or target group. Useful for understanding correlations and dependencies between elements in the data.
| arguments | Map of configuration parameters including:
|
Definition at line 769 of file conductor.cpp.
References Data(), matrix, results, ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), and ResultItem::SetType().
Referenced by Execute().
|
private |
Executes Discriminant Function Analysis between two groups.
Performs two-group discriminant function analysis to find the linear combination of elements that best separates two source or target groups. Computes eigenvalues, eigenvectors, projected profiles, and statistical significance (chi-squared and F-test p-values). Supports optional Box-Cox transformation and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 846 of file conductor.cpp.
References BoxCoxTransformedWithReport(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), SourceSinkData::DiscriminantFunctionAnalysis(), DFA_result::eigen_vectors, DFA_result::F_test_P_value, host, normal, DFA_result::p_values, DFA_result::projected, results, ResultItem::SetName(), ProgressReporter::SetProgress(), SourceSinkData::SetProgressReporter(), ResultItem::SetResult(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetYAxisMode(), ProgressReporter::Start(), vector, and vectorset_groups.
Referenced by Execute().
|
private |
Executes multi-way Discriminant Function Analysis across all groups.
Performs multi-way discriminant function analysis to find linear combinations of elements that optimally separate all source groups simultaneously. Computes multiple discriminant functions (eigenvalues/eigenvectors) and projects all groups onto these discriminant axes. Supports optional Box-Cox transformation and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 1046 of file conductor.cpp.
References BoxCoxTransformedWithReport(), CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), dfa_vectorsetset, SourceSinkData::DiscriminantFunctionAnalysis(), DFA_result::eigen_vectors, DFA_result::F_test_P_value, host, DFA_result::multi_projected, normal, DFA_result::p_values, results, ResultItem::SetName(), ProgressReporter::SetProgress(), SourceSinkData::SetProgressReporter(), ResultItem::SetResult(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetYAxisMode(), ProgressReporter::Start(), vector, and vectorset.
Referenced by Execute().
|
private |
Executes Discriminant Function Analysis for one group versus all others.
Performs discriminant function analysis to separate one specified source group from all other groups combined. Useful for identifying which elements best distinguish a particular source from the background of all other sources. Supports optional Box-Cox transformation and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 950 of file conductor.cpp.
References BoxCoxTransformedWithReport(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), SourceSinkData::DiscriminantFunctionAnalysis(), DFA_result::eigen_vectors, DFA_result::F_test_P_value, host, normal, DFA_result::p_values, DFA_result::projected, results, ResultItem::SetName(), ProgressReporter::SetProgress(), SourceSinkData::SetProgressReporter(), ResultItem::SetResult(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetYAxisMode(), ProgressReporter::Start(), vector, and vectorset_groups.
Referenced by Execute().
|
private |
Executes distribution fitting analysis for a constituent.
Fits normal and lognormal distributions to observed elemental concentrations for a specific constituent within a source or target group. Generates both probability density functions (PDF) and cumulative distribution functions (CDF) comparing observed data with fitted theoretical distributions. Useful for assessing distributional assumptions before source apportionment. Supports optional Box-Cox transformation and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 1741 of file conductor.cpp.
References BoxCoxTransformedWithReport(), CheckNegativeElements(), complete, SourceSinkData::CreateCorrectedAndFilteredDataset(), SourceSinkData::CreateCorrectedDataset(), Data(), distribution, SourceSinkData::GetElementDistribution(), host, lognormal, normal, results, ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetType(), ResultItem::setXAxisTitle(), ResultItem::SetYAxisMode(), ResultItem::setYAxisTitle(), and timeseries_set_first_symbol.
Referenced by Execute().
|
private |
Calculates two-way element discriminant power between two groups.
Evaluates the ability of each element to discriminate between two specific source or target groups using multiple metrics: difference-to-standard-deviation ratio, discrimination fraction (percentage of samples correctly separated), and statistical significance (t-test p-values). Elements with low p-values and high discrimination power are good candidates for source apportionment. Supports Box-Cox transformation and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 2056 of file conductor.cpp.
References BoxCoxTransformedWithReport(), CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), SourceSinkData::DifferentiationPower(), SourceSinkData::DifferentiationPower_Percentage(), high, host, low, normal, predicted_concentration, results, Interface::SetLimit(), ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::setXAxisTitle(), ResultItem::SetYAxisMode(), ResultItem::setYAxisTitle(), ResultItem::SetYLimit(), and SourceSinkData::t_TestPValue().
Referenced by Execute().
|
private |
Calculates multi-way element discriminant power across all groups.
Evaluates the ability of each element to discriminate among all source groups simultaneously using pairwise comparisons. Computes three metrics for each element-pair combination: difference-to-standard-deviation ratio, discrimination fraction, and t-test p-values. Results show which elements provide optimal discrimination across the entire source dataset. Optionally includes target samples. Supports Box-Cox transformation and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 2167 of file conductor.cpp.
References BoxCoxTransformedWithReport(), CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), SourceSinkData::DifferentiationPower(), SourceSinkData::DifferentiationPower_P_value(), SourceSinkData::DifferentiationPower_Percentage(), elemental_profile_set, high, host, low, normal, results, Interface::SetLimit(), ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetYAxisMode(), ResultItem::setYAxisTitle(), and ResultItem::SetYLimit().
Referenced by Execute().
|
private |
Executes bootstrap error analysis for uncertainty quantification.
Performs bootstrap resampling to quantify uncertainty in source contribution estimates. Randomly removes a specified percentage of elements in each bootstrap iteration and re-solves the source apportionment problem, generating distributions of contribution estimates. Produces confidence intervals and uncertainty metrics for source contributions. Supports both linear and softmax transformations and optional OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 2332 of file conductor.cpp.
References SourceSinkData::BootStrap(), CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), Data(), host, SourceSinkData::InitializeParametersAndObservations(), ResolveRandomSeed(), results, SourceSinkData::SetProgressReporter(), softmax, and ProgressReporter::Start().
Referenced by Execute().
|
private |
Executes Kolmogorov-Smirnov goodness-of-fit test for a source/target group.
Performs Kolmogorov-Smirnov test to assess how well elemental concentration distributions within a source or target group conform to a specified theoretical distribution (normal or lognormal). Returns K-S statistics for each element, where larger values indicate poorer fit to the assumed distribution.
| arguments | Map of configuration parameters including:
|
Definition at line 1506 of file conductor.cpp.
References Data(), lognormal, normal, results, ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetYAxisMode(), and vector.
Referenced by Execute().
|
private |
Executes Kolmogorov-Smirnov test for a single constituent in a group.
Performs detailed Kolmogorov-Smirnov goodness-of-fit test for one specific element within a source or target group. Returns the cumulative distribution function (CDF) comparison between observed data and the theoretical distribution (normal or lognormal), allowing visual assessment of distribution fit.
| arguments | Map of configuration parameters including:
|
Definition at line 1536 of file conductor.cpp.
References Data(), distribution, SourceSinkData::GetElementDistribution(), host, lognormal, normal, results, ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowTable(), ResultItem::SetType(), and timeseries_set.
Referenced by Execute().
|
private |
Executes Levenberg-Marquardt nonlinear optimization.
Performs Levenberg-Marquardt least squares optimization to estimate source contributions. This deterministic algorithm is faster than GA/MCMC and works well when the problem is well-conditioned. Supports both linear and softmax transformations for contribution constraints.
| arguments | Map of configuration parameters including:
|
Definition at line 512 of file conductor.cpp.
References CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), Data(), direct, SourceSinkData::GetContribution(), SourceSinkData::GetObservedvsModeledElementalProfile(), SourceSinkData::GetObservedvsModeledElementalProfile_Isotope(), SourceSinkData::GetPredictedElementalProfile(), host, SourceSinkData::InitializeParametersAndObservations(), linear, SourceSinkData::NegativeContributionCheck(), ReportNegativeContributions(), results, SourceSinkData::SetProgressReporter(), ResultItem::SetShowTable(), softmax, SourceSinkData::SolveLevenberg_Marquardt(), and ProgressReporter::Start().
Referenced by Execute().
|
private |
Executes Levenberg-Marquardt optimization across all target samples.
Performs batch Levenberg-Marquardt optimization for all target samples, producing a comprehensive contribution matrix showing source apportionment results across multiple samples. Useful for analyzing spatial or temporal patterns in source contributions.
| arguments | Map of configuration parameters including:
|
Definition at line 580 of file conductor.cpp.
References CheckNegativeElements(), contribution, counter, Data(), Interface::GetOptions(), high, host, CMBTimeSeriesSet::Label(), linear, low, ReportNegativeContributions(), results, ResultItem::SetName(), Interface::SetOption(), SourceSinkData::SetProgressReporter(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetXAxisMode(), ResultItem::setXAxisTitle(), ResultItem::setYAxisTitle(), ResultItem::SetYLimit(), single_column_x, softmax, stacked_bar_chart, ProgressReporter::Start(), options::X_suffix, and options::Y_suffix.
Referenced by Execute().
|
private |
Executes multiple linear regression versus organic matter and particle size.
Performs multiple linear regression analysis to establish relationships between elemental concentrations and organic matter content/particle size. The resulting regression models are stored and can be used to correct concentrations in subsequent analyses. Supports both linear and power-law regression forms.
| arguments | Map of configuration parameters including:
|
Definition at line 703 of file conductor.cpp.
References SourceSinkData::CreateCorrectedAndFilteredDataset(), Data(), SourceSinkData::GetMLRResults(), host, linear, SourceSinkData::PerformRegressionVsOMAndSize(), power, results, and SourceSinkData::SetOMandSizeConstituents().
Referenced by Execute().
|
private |
Executes organic matter and particle size correction.
Applies multiple linear regression corrections to adjust elemental concentrations for variations in organic matter content and particle size. Returns corrected source profiles for the specified target sample, which can then be used in subsequent source apportionment analyses.
| arguments | Map of configuration parameters including:
|
Definition at line 677 of file conductor.cpp.
References SourceSinkData::CreateCorrectedAndFilteredDataset(), Data(), SourceSinkData::GetSourceProfiles(), results, and SourceSinkData::SetSelectedTargetSample().
Referenced by Execute().
|
private |
Executes outlier detection analysis for a source/target group.
Performs Box-Cox based outlier detection to identify samples with unusual elemental concentrations within a source or target group. After Box-Cox transformation to normality, calculates standardized residuals and flags values exceeding the specified threshold (typically ±2 or ±3 standard deviations). Supports sample and element filtering.
| arguments | Map of configuration parameters including:
|
Definition at line 2015 of file conductor.cpp.
References CheckNegativeElements(), SourceSinkData::CreateCorrectedAndFilteredDataset(), Data(), high, low, matrix, ReportBoxCoxSkips(), results, Interface::SetLimit(), ResultItem::SetName(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), and ResultItem::SetType().
Referenced by Execute().
|
private |
Executes Stepwise Discriminant Function Analysis between two groups.
Performs stepwise discriminant function analysis to identify the subset of elements that provides optimal discrimination between two source groups. Elements are added sequentially based on their contribution to group separation, evaluated using Wilks' Lambda, chi-squared, and F-test statistics. Supports optional Box-Cox transformation and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 1143 of file conductor.cpp.
References BoxCoxTransformedWithReport(), CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), high, host, log, results, ResultItem::SetAbsoluteValue(), ResultItem::SetName(), SourceSinkData::SetProgressReporter(), ResultItem::SetResult(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::setXAxisTitle(), ResultItem::SetYAxisMode(), ResultItem::SetYLimit(), ProgressReporter::Start(), SourceSinkData::StepwiseDiscriminantFunctionAnalysis(), and vector.
Referenced by Execute().
|
private |
Executes multi-way Stepwise Discriminant Function Analysis across all groups.
Performs stepwise discriminant function analysis to identify the optimal subset of elements for discriminating among all source groups simultaneously. Elements are sequentially selected based on their contribution to overall group separation using Wilks' Lambda, chi-squared, and F-test statistics. Optionally modifies the included elements based on results. Supports Box-Cox transformation and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 1247 of file conductor.cpp.
References CMBVector::append(), BoxCoxTransformedWithReport(), CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), dfa_vectorsetset, SourceSinkData::DFAConfusionMatrix(), SourceSinkData::DiscriminantFunctionAnalysis(), DFA_result::eigen_vectors, CMBVector::ExtractUpToMinimum(), high, host, SourceSinkData::IncludeExcludeElementsBasedOn(), CMBVector::Labels(), log, matrix, DFA_result::multi_projected, normal, results, ResultItem::SetAbsoluteValue(), ResultItem::SetName(), SourceSinkData::SetProgressReporter(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::setTableTitle(), ResultItem::SetType(), ResultItem::setXAxisTitle(), ResultItem::SetYAxisMode(), ResultItem::setYAxisTitle(), ResultItem::SetYLimit(), ProgressReporter::Start(), SourceSinkData::StepwiseDiscriminantFunctionAnalysis(), CMBVector::valueAt(), vector, and vectorset.
Referenced by Execute().
|
private |
Executes Stepwise Discriminant Function Analysis for one group versus all others.
Performs stepwise discriminant function analysis to identify the optimal subset of elements for discriminating one specified source group from all other groups combined. Elements are sequentially selected based on Wilks' Lambda, chi-squared, and F-test statistics. Supports optional Box-Cox transformation and OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 1410 of file conductor.cpp.
References BoxCoxTransformedWithReport(), CheckNegativeElements(), SourceSinkData::CreateCorrectedDataset(), SourceSinkData::CreateTracerDataset(), Data(), high, host, log, results, ResultItem::SetAbsoluteValue(), ResultItem::SetName(), SourceSinkData::SetProgressReporter(), ResultItem::SetResult(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::setXAxisTitle(), ResultItem::SetYAxisMode(), ResultItem::SetYLimit(), ProgressReporter::Start(), SourceSinkData::StepwiseDiscriminantFunctionAnalysis(), and vector.
Referenced by Execute().
|
private |
Executes source verification analysis.
Performs leave-one-out cross-validation where each sample from a specified source group is treated as an unknown target and contributions are estimated using the remaining sources. If source apportionment is working correctly, the "unknown" sample should show high contribution from its true source group. Results show contribution matrices for all verification samples, enabling assessment of source profile representativeness and model reliability. Supports softmax transformation and optional OM/size corrections.
| arguments | Map of configuration parameters including:
|
Definition at line 2394 of file conductor.cpp.
References CheckNegativeElements(), counter, Data(), Interface::GetOptions(), high, host, low, results, ResultItem::SetName(), Interface::SetOption(), ProgressReporter::SetProgress(), SourceSinkData::SetProgressReporter(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ResultItem::SetShowGraph(), ResultItem::SetShowTable(), ResultItem::SetType(), ResultItem::SetXAxisMode(), ResultItem::setXAxisTitle(), ResultItem::setYAxisTitle(), ResultItem::SetYLimit(), single_column_x, softmax, stacked_bar_chart, ProgressReporter::Start(), SourceSinkData::VerifySource(), options::X_suffix, and options::Y_suffix.
Referenced by Execute().
|
private |
Executes MCMC test with a simple analytical model.
Performs MCMC sampling on a simple test model (TestMCMC) with known analytical properties to validate the MCMC implementation. Useful for debugging convergence issues, tuning sampler parameters, and verifying posterior distributions against expected theoretical results. Generates both parameter trace samples and posterior distributions.
| arguments | Map of configuration parameters including:
|
Definition at line 1650 of file conductor.cpp.
References distribution, host, CMCMC< T >::initialize(), TestMCMC::InitializeParametersObservations(), mcmc_samples, CMCMC< T >::Model, ResolveRandomSeed(), results, samples, ResultItem::SetName(), CMCMC< T >::SetProperty(), CMCMC< T >::SetRandomSeed(), ResultItem::SetResult(), ResultItem::SetShowAsString(), ProgressReporter::SetTitle(), ResultItem::SetType(), ProgressReporter::SetYAxisTitle(), ProgressReporter::Start(), CMCMC< T >::step(), and workingfolder.
Referenced by Execute().
|
inline |
Creates and returns a heap-allocated copy of current results.
Returns a new Results object allocated on the heap containing a copy of the most recent analysis results. The caller assumes ownership and is responsible for deletion.
Definition at line 101 of file conductor.h.
References results.
| void Conductor::ReportBoxCoxSkips | ( | SourceSinkData & | dataset, |
| const std::string & | group, | ||
| const std::string & | consequence ) |
Warns about constituents the Box-Cox transformation leaves untransformed.
Box-Cox is defined for positive values only; constituents with a zero or negative value are skipped and used as they are. This lists them, by group, through the AnalysisHost.
| dataset | Dataset about to be transformed |
| group | Only this group, or every group if empty |
| consequence | What happens to the skipped constituents, for the message |
Definition at line 292 of file conductor.cpp.
References host.
Referenced by BoxCoxTransformedWithReport(), ExecuteBoxCox(), and ExecuteOutlierAnalysis().
| void Conductor::ReportNegativeContributions | ( | const std::vector< std::string > & | offenders | ) |
Reports negative source contributions through the AnalysisHost.
Says which contributions came out negative and how to get a solution that cannot. The results are still reported: this warns about them rather than withholding them, so the user can see what the fit did.
| offenders | Negative contributions, as NegativeContributionCheck() lists them |
offenders is empty Definition at line 255 of file conductor.cpp.
References host.
Referenced by ExecuteLevenbergMarquardt(), and ExecuteLevenbergMarquardtBatch().
| bool Conductor::ResolveRandomSeed | ( | std::map< std::string, std::string > & | arguments, |
| std::uint64_t & | seed ) |
Resolves the "Random seed" argument of an MCMC analysis.
A blank seed is replaced by one drawn from the operating system, so the seed actually used can be recorded and the run repeated.
| arguments | Analysis arguments; "Random seed" is set to the seed used |
| seed | Set to the seed used |
Definition at line 307 of file conductor.cpp.
References host, and ParseRandomSeed().
Referenced by ExecuteCMBBayesian(), ExecuteCMBBayesianBatch(), ExecuteErrorAnalysis(), and ExecuteTestCMBBayesian().
|
inline |
Sets the SourceSinkData for analysis.
| _data | Pointer to SourceSinkData (non-owning, must remain valid during operations) |
Definition at line 86 of file conductor.h.
References data.
|
inline |
Sets the working directory for output files.
| wf | Working folder path as QString |
Definition at line 107 of file conductor.h.
References workingfolder.
|
inline |
Returns the current working directory path.
Definition at line 113 of file conductor.h.
References workingfolder.
|
private |
Non-owning pointer to analysis data.
Definition at line 186 of file conductor.h.
Referenced by Conductor(), Data(), ExecuteBracketingAnalysisBatch(), and SetData().
|
private |
Non-owning pointer to the running environment.
Definition at line 193 of file conductor.h.
Referenced by Conductor(), CheckNegativeElements(), CheckNegativeElements(), Execute(), ExecuteANOVA(), ExecuteAutoSelect(), ExecuteBracketingAnalysis(), ExecuteBracketingAnalysisBatch(), ExecuteCMBBayesian(), ExecuteCMBBayesianBatch(), ExecuteCorrelationMatrix(), ExecuteDFA(), ExecuteDFAM(), ExecuteDFAOnevsRest(), ExecuteDistributionFitting(), ExecuteEDP(), ExecuteEDPM(), ExecuteErrorAnalysis(), ExecuteKolmogorovSmirnovIndividual(), ExecuteLevenbergMarquardt(), ExecuteLevenbergMarquardtBatch(), ExecuteMLR(), ExecuteSDFA(), ExecuteSDFAM(), ExecuteSDFAOnevsRest(), ExecuteSourceVerify(), ExecuteTestCMBBayesian(), ReportBoxCoxSkips(), ReportNegativeContributions(), and ResolveRandomSeed().
|
private |
MCMC sampler (owned).
Definition at line 190 of file conductor.h.
Referenced by ExecuteCMBBayesian(), and ExecuteCMBBayesianBatch().
|
private |
Current analysis results (cleared each Execute).
Definition at line 191 of file conductor.h.
Referenced by Execute(), ExecuteANOVA(), ExecuteAutoSelect(), ExecuteBoxCox(), ExecuteBracketingAnalysis(), ExecuteBracketingAnalysisBatch(), ExecuteCMBBayesian(), ExecuteCMBBayesianBatch(), ExecuteCorrelationMatrix(), ExecuteCovarianceMatrix(), ExecuteDFA(), ExecuteDFAM(), ExecuteDFAOnevsRest(), ExecuteDistributionFitting(), ExecuteEDP(), ExecuteEDPM(), ExecuteErrorAnalysis(), ExecuteKolmogorovSmirnov(), ExecuteKolmogorovSmirnovIndividual(), ExecuteLevenbergMarquardt(), ExecuteLevenbergMarquardtBatch(), ExecuteMLR(), ExecuteOMSizeCorrect(), ExecuteOutlierAnalysis(), ExecuteSDFA(), ExecuteSDFAM(), ExecuteSDFAOnevsRest(), ExecuteSourceVerify(), ExecuteTestCMBBayesian(), and GetResults().
|
private |
Output directory path.
Definition at line 192 of file conductor.h.
Referenced by ExecuteCMBBayesian(), ExecuteCMBBayesianBatch(), ExecuteTestCMBBayesian(), SetWorkingFolder(), and WorkingFolder().