SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
conductor.h
Go to the documentation of this file.
1// SedSAT3 – Sediment Source Assessment Tool, version 3
2// U.S. Geological Survey. See LICENSE.md and DISCLAIMER.md in the repository root.
3
4#ifndef CONDUCTOR_H
5#define CONDUCTOR_H
6
7#include <string>
8#include <map>
9#include <vector>
10#include <memory>
11
12#include "sourcesinkdata.h"
13#ifdef SEDSAT3_ENABLE_GA
14#include "GA.h"
15#endif
16#include "MCMC.h"
17#include "results.h"
18#include "analysishost.h"
19
20class QString;
21
44{
45public:
51 explicit Conductor(AnalysisHost* host);
52
74 bool Execute(const std::string& command, const std::map<std::string, std::string>& arguments);
75
80 SourceSinkData* Data() { return data; }
81
86 void SetData(SourceSinkData* _data) { data = _data; }
87
101 Results* GetResults() { return new Results(results); }
102
107 void SetWorkingFolder(const QString& wf) { workingfolder = wf; }
108
113 QString WorkingFolder() const { return workingfolder; }
114
129
141 bool CheckNegativeElements(std::map<std::string, std::vector<std::string>> negative_elements);
142
153 void ReportNegativeContributions(const std::vector<std::string>& offenders);
154
166 void ReportBoxCoxSkips(SourceSinkData& dataset, const std::string& group, const std::string& consequence);
167
172
183 bool ResolveRandomSeed(std::map<std::string, std::string>& arguments, std::uint64_t& seed);
184
185private:
187#ifdef SEDSAT3_ENABLE_GA
188 std::unique_ptr<CGA<SourceSinkData>> GA;
189#endif
190 std::unique_ptr<CMCMC<SourceSinkData>> MCMC;
194
195#ifdef SEDSAT3_ENABLE_GA
210 bool ExecuteGA(const std::map<std::string, std::string>& arguments);
211
225 bool ExecuteGA_FixedProfile(const std::map<std::string, std::string>& arguments);
226
240 bool ExecuteGA_NoTargets(const std::map<std::string, std::string>& arguments);
241#endif // SEDSAT3_ENABLE_GA
242
257 bool ExecuteLevenbergMarquardt(const std::map<std::string, std::string>& arguments);
258
272 bool ExecuteLevenbergMarquardtBatch(const std::map<std::string, std::string>& arguments);
273
288 bool ExecuteOMSizeCorrect(const std::map<std::string, std::string>& arguments);
289
306 bool ExecuteMLR(const std::map<std::string, std::string>& arguments);
307
319 bool ExecuteCovarianceMatrix(const std::map<std::string, std::string>& arguments);
320
337 bool ExecuteCorrelationMatrix(const std::map<std::string, std::string>& arguments);
338
356 bool ExecuteDFA(const std::map<std::string, std::string>& arguments);
357
374 bool ExecuteDFAOnevsRest(const std::map<std::string, std::string>& arguments);
391 bool ExecuteDFAM(const std::map<std::string, std::string>& arguments);
392
411 bool ExecuteSDFA(const std::map<std::string, std::string>& arguments);
412
431 bool ExecuteSDFAM(const std::map<std::string, std::string>& arguments);
432
450 bool ExecuteSDFAOnevsRest(const std::map<std::string, std::string>& arguments);
451
465 bool ExecuteKolmogorovSmirnov(const std::map<std::string, std::string>& arguments);
466
481 bool ExecuteKolmogorovSmirnovIndividual(const std::map<std::string, std::string>& arguments);
482
499 bool ExecuteCMBBayesian(const std::map<std::string, std::string>& arguments);
500
515 bool ExecuteCMBBayesianBatch(const std::map<std::string, std::string>& arguments);
516
533 bool ExecuteTestCMBBayesian(const std::map<std::string, std::string>& arguments);
534
553 bool ExecuteDistributionFitting(const std::map<std::string, std::string>& arguments);
554
571 bool ExecuteBracketingAnalysis(const std::map<std::string, std::string>& arguments);
572
589 bool ExecuteBracketingAnalysisBatch(const std::map<std::string, std::string>& arguments);
590
603 bool ExecuteBoxCox(const std::map<std::string, std::string>& arguments);
604
621 bool ExecuteOutlierAnalysis(const std::map<std::string, std::string>& arguments);
622
642 bool ExecuteEDP(const std::map<std::string, std::string>& arguments);
643
662 bool ExecuteEDPM(const std::map<std::string, std::string>& arguments);
663
685 bool ExecuteANOVA(const std::map<std::string, std::string>& arguments);
686
706 bool ExecuteErrorAnalysis(const std::map<std::string, std::string>& given_arguments);
707
725 bool ExecuteSourceVerify(const std::map<std::string, std::string>& arguments);
726
744 bool ExecuteAutoSelect(const std::map<std::string, std::string>& arguments);
745};
746
747#endif // CONDUCTOR_H
Abstract environment that an analysis runs inside.
bool ExecuteOutlierAnalysis(const std::map< std::string, std::string > &arguments)
Executes outlier detection analysis for a source/target group.
bool ExecuteTestCMBBayesian(const std::map< std::string, std::string > &arguments)
Executes MCMC test with a simple analytical model.
bool ExecuteCMBBayesian(const std::map< std::string, std::string > &arguments)
Executes Bayesian Chemical Mass Balance using MCMC sampling.
bool ExecuteDFAM(const std::map< std::string, std::string > &arguments)
Executes multi-way Discriminant Function Analysis across all groups.
bool ExecuteDFA(const std::map< std::string, std::string > &arguments)
Executes 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 ExecuteBoxCox(const std::map< std::string, std::string > &arguments)
Calculates optimal Box-Cox transformation parameters.
bool ExecuteKolmogorovSmirnovIndividual(const std::map< std::string, std::string > &arguments)
Executes Kolmogorov-Smirnov test for a single constituent in a group.
void ReportBoxCoxSkips(SourceSinkData &dataset, const std::string &group, const std::string &consequence)
Warns about constituents the Box-Cox transformation leaves untransformed.
bool CheckNegativeElements(SourceSinkData *data=nullptr)
Validates that all element concentrations are non-negative.
bool ExecuteCMBBayesianBatch(const std::map< std::string, std::string > &arguments)
Executes Bayesian Chemical Mass Balance across all target samples.
bool ResolveRandomSeed(std::map< std::string, std::string > &arguments, std::uint64_t &seed)
Resolves the "Random seed" argument of an MCMC analysis.
bool ExecuteAutoSelect(const std::map< std::string, std::string > &arguments)
Executes automatic element selection based on discriminant power.
bool ExecuteSDFA(const std::map< std::string, std::string > &arguments)
Executes Stepwise Discriminant Function Analysis between two groups.
Results * GetResults()
Creates and returns a heap-allocated copy of current results.
Definition conductor.h:101
bool Execute(const std::string &command, const std::map< std::string, std::string > &arguments)
Executes a specified analysis command with given parameters.
Definition conductor.cpp:24
bool ExecuteBracketingAnalysisBatch(const std::map< std::string, std::string > &arguments)
Executes bracketing analysis across all target samples.
void SetWorkingFolder(const QString &wf)
Sets the working directory for output files.
Definition conductor.h:107
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.
AnalysisHost * host
Non-owning pointer to the running environment.
Definition conductor.h:193
QString workingfolder
Output directory path.
Definition conductor.h:192
bool ExecuteSourceVerify(const std::map< std::string, std::string > &arguments)
Executes source verification analysis.
void SetData(SourceSinkData *_data)
Sets the SourceSinkData for analysis.
Definition conductor.h:86
bool ExecuteMLR(const std::map< std::string, std::string > &arguments)
Executes multiple linear regression versus organic matter and particle size.
Conductor(AnalysisHost *host)
Constructs a Conductor that reports through host.
Definition conductor.cpp:18
bool ExecuteDistributionFitting(const std::map< std::string, std::string > &arguments)
Executes distribution fitting analysis for a constituent.
bool ExecuteLevenbergMarquardtBatch(const std::map< std::string, std::string > &arguments)
Executes Levenberg-Marquardt optimization across all target samples.
bool ExecuteKolmogorovSmirnov(const std::map< std::string, std::string > &arguments)
Executes Kolmogorov-Smirnov goodness-of-fit test for a source/target group.
SourceSinkData * Data()
Returns pointer to the current SourceSinkData.
Definition conductor.h:80
SourceSinkData * data
Non-owning pointer to analysis data.
Definition conductor.h:186
bool ExecuteSDFAOnevsRest(const std::map< std::string, std::string > &arguments)
Executes Stepwise Discriminant Function Analysis for one group versus all others.
bool ExecuteBracketingAnalysis(const std::map< std::string, std::string > &arguments)
Executes bracketing analysis for a single target sample.
bool ExecuteDFAOnevsRest(const std::map< std::string, std::string > &arguments)
Executes Discriminant Function Analysis for one group versus all others.
SourceSinkData BoxCoxTransformedWithReport(SourceSinkData &dataset)
Box-Cox transforms data with optimal lambdas, reporting skipped constituents.
bool ExecuteCovarianceMatrix(const std::map< std::string, std::string > &arguments)
Calculates covariance matrix for a source or target group.
Results results
Current analysis results (cleared each Execute).
Definition conductor.h:191
QString WorkingFolder() const
Returns the current working directory path.
Definition conductor.h:113
void ReportNegativeContributions(const std::vector< std::string > &offenders)
Reports negative source contributions through the AnalysisHost.
bool ExecuteOMSizeCorrect(const std::map< std::string, std::string > &arguments)
Executes organic matter and particle size correction.
bool ExecuteLevenbergMarquardt(const std::map< std::string, std::string > &arguments)
Executes Levenberg-Marquardt nonlinear optimization.
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 ExecuteCorrelationMatrix(const std::map< std::string, std::string > &arguments)
Calculates correlation matrix for a source or target group.
std::unique_ptr< CMCMC< SourceSinkData > > MCMC
MCMC sampler (owned).
Definition conductor.h:190