Skip to content

Commit

Permalink
Mods for 1.4.0a
Browse files Browse the repository at this point in the history
  • Loading branch information
rklasky committed Dec 12, 2022
1 parent 9abcc4d commit eed5ca7
Show file tree
Hide file tree
Showing 46 changed files with 41,098 additions and 980 deletions.
25 changes: 18 additions & 7 deletions MSSPM_GuiDiagnostic/nmfDiagnosticTab01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ nmfDiagnostic_Tab1::nmfDiagnostic_Tab1(QTabWidget* tabs,

// RSK - create constants for these strings...
m_OutputTableName["Growth Rate (r)"] = nmfConstantsMSSPM::TableOutputGrowthRate;
m_OutputTableName["Growth Rate Shape (p)"] = nmfConstantsMSSPM::TableOutputGrowthRateShape;
m_OutputTableName["Carrying Capacity (K)"] = nmfConstantsMSSPM::TableOutputCarryingCapacity;
m_OutputTableName["Initial Biomass (B₀)"] = nmfConstantsMSSPM::TableOutputInitBiomass;
m_OutputTableName["Catchability (q)"] = nmfConstantsMSSPM::TableOutputCatchability;
Expand All @@ -35,6 +36,7 @@ nmfDiagnostic_Tab1::nmfDiagnostic_Tab1(QTabWidget* tabs,
m_OutputTableName["SurveyQ Covariate Coefficient"] = nmfConstantsMSSPM::TableOutputSurveyQCovariateCoeffs;

m_DiagnosticTableName["Growth Rate (r)"] = nmfConstantsMSSPM::TableDiagnosticGrowthRate;
m_DiagnosticTableName["Growth Rate Shape (p)"] = nmfConstantsMSSPM::TableDiagnosticGrowthRateShape;
m_DiagnosticTableName["Carrying Capacity (K)"] = nmfConstantsMSSPM::TableDiagnosticCarryingCapacity;
m_DiagnosticTableName["Initial Biomass (B₀)"] = nmfConstantsMSSPM::TableDiagnosticInitBiomass;
m_DiagnosticTableName["Catchability (q)"] = nmfConstantsMSSPM::TableDiagnosticCatchability;
Expand Down Expand Up @@ -291,7 +293,7 @@ nmfDiagnostic_Tab1::parameterToTableName(const std::string whichTable,
{
tableName = "";
if (whichTable == "input") {
tableName = m_OutputTableName[parameter.toStdString()];
tableName = m_OutputTableName[parameter.toStdString()];
} else if (whichTable == "output") {
tableName = m_DiagnosticTableName[parameter.toStdString()];
}
Expand Down Expand Up @@ -745,7 +747,7 @@ nmfDiagnostic_Tab1::calculateFitness(const int& SpeciesOrGuildNum,
int NumGuilds;
int NumSpeciesOrGuilds;
int offset = 0;
int GrowthRateOffset,GrowthRateCovarOffset,CarryingCapacityOffset,CarryingCapacityCovarOffset;
int GrowthRateOffset,GrowthRateShapeOffset,GrowthRateCovarOffset,CarryingCapacityOffset,CarryingCapacityCovarOffset;
int CatchabilityOffset,CatchabilityCovarOffset;
int SurveyQOffset,SurveyQCovarOffset;
int InitBiomassOffset = 0;
Expand Down Expand Up @@ -789,8 +791,11 @@ nmfDiagnostic_Tab1::calculateFitness(const int& SpeciesOrGuildNum,
loadOutputParameters(nmfConstantsMSSPM::TableOutputInitBiomass,NumSpeciesOrGuilds,
Algorithm,Minimizer,ObjectiveCriterion,Scaling,isAggProdStr,initBiomassParameters);
offset = initBiomassParameters.size();
loadGrowthParameters(NumSpeciesOrGuilds,Algorithm,Minimizer,ObjectiveCriterion,Scaling,isAggProdStr,growthParameters,
offset,GrowthRateOffset,GrowthRateCovarOffset,CarryingCapacityOffset,CarryingCapacityCovarOffset);
loadGrowthParameters(NumSpeciesOrGuilds,Algorithm,Minimizer,
ObjectiveCriterion,Scaling,
isAggProdStr,growthParameters,
offset,GrowthRateOffset,GrowthRateShapeOffset,GrowthRateCovarOffset,
CarryingCapacityOffset,CarryingCapacityCovarOffset);
//std::cout << "GrowthRateOffset: " << GrowthRateOffset << std::endl;
//std::cout << "GrowthRateCovarOffset: " << GrowthRateCovarOffset << std::endl;
//std::cout << "CarryingCapacityOffset: " << CarryingCapacityOffset << std::endl;
Expand Down Expand Up @@ -832,8 +837,10 @@ nmfDiagnostic_Tab1::calculateFitness(const int& SpeciesOrGuildNum,
offset = 0; // RSK bug is here I think...
if (ParameterItem.first == "Initial Biomass (B₀)") {
offset = InitBiomassOffset;
} else if (ParameterItem.first == "Growth Rate (r)") { // RSK revisit this...make all the constants more consistent
} else if (ParameterItem.first == "Growth Rate (r)") {
offset = GrowthRateOffset;
} else if (ParameterItem.first == "Growth Rate Shape (p)") {
offset = GrowthRateShapeOffset;
} else if (ParameterItem.first == "Carrying Capacity (K)") {
offset = CarryingCapacityOffset;
} else if (ParameterItem.first == "Catchability (q)") {
Expand Down Expand Up @@ -947,6 +954,7 @@ nmfDiagnostic_Tab1::loadGrowthParameters(
std::vector<double>& Parameters,
const int& CurrentOffset,
int& GrowthRateOffset,
int& GrowthRateShapeOffset,
int& GrowthRateCovarOffset,
int& CarryingCapacityOffset,
int& CarryingCapacityCovarOffset)
Expand All @@ -958,6 +966,7 @@ nmfDiagnostic_Tab1::loadGrowthParameters(
std::vector<std::string> tableNames = {};

GrowthRateOffset = CurrentOffset;
GrowthRateShapeOffset = CurrentOffset;
GrowthRateCovarOffset = CurrentOffset;
CarryingCapacityOffset = CurrentOffset;
CarryingCapacityCovarOffset = CurrentOffset;
Expand All @@ -969,11 +978,13 @@ nmfDiagnostic_Tab1::loadGrowthParameters(
CarryingCapacityCovarOffset = GrowthRateCovarOffset;
} else if (m_DataStruct.GrowthForm == "Logistic") {
tableNames.push_back(nmfConstantsMSSPM::TableOutputGrowthRate);
tableNames.push_back(nmfConstantsMSSPM::TableOutputGrowthRateShape);
tableNames.push_back(nmfConstantsMSSPM::TableOutputGrowthRateCovariateCoeffs);
tableNames.push_back(nmfConstantsMSSPM::TableOutputCarryingCapacity);
tableNames.push_back(nmfConstantsMSSPM::TableOutputCarryingCapacityCovariateCoeffs);
GrowthRateCovarOffset = CurrentOffset + NumSpeciesOrGuilds;
CarryingCapacityOffset = GrowthRateCovarOffset + NumSpeciesOrGuilds;
GrowthRateShapeOffset = CurrentOffset + NumSpeciesOrGuilds;
GrowthRateCovarOffset = CurrentOffset + NumSpeciesOrGuilds;
CarryingCapacityOffset = GrowthRateCovarOffset + NumSpeciesOrGuilds;
CarryingCapacityCovarOffset = CarryingCapacityOffset + NumSpeciesOrGuilds;
}
for (std::string table : tableNames) {
Expand Down
1 change: 1 addition & 0 deletions MSSPM_GuiDiagnostic/nmfDiagnosticTab01.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class nmfDiagnostic_Tab1: public QObject
std::vector<double>& Parameters,
const int& CurrentOffset,
int& GrowthRateOffset,
int& GrowthRateShapeOffset,
int& GrowthRateCovarOffset,
int& CarryingCapacityOffset,
int& CarryingCapacityCovarOffset);
Expand Down
Loading

0 comments on commit eed5ca7

Please sign in to comment.