Skip to content

Commit

Permalink
Re-did bug fix in NLopt loadSurveyQParameterRanges
Browse files Browse the repository at this point in the history
  • Loading branch information
rklasky committed May 9, 2022
1 parent a231c60 commit c38b5ce
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 99 deletions.
85 changes: 1 addition & 84 deletions MSSPM_Main/nmfMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,7 @@ void
nmfMainWindow::menu_about()
{
QString name = "Multi-Species Surplus Production Model";
QString version = "MSSPM v1.1.0";
QString version = "MSSPM v1.1.1";
QString specialAcknowledgement = "";
QString cppVersion = "C++??";
QString mysqlVersion = "?";
Expand Down Expand Up @@ -3995,7 +3995,6 @@ nmfMainWindow::menu_saveCurrentRun()
OutputSurveyQTable,OutputSurveyQCovariateCoeffsTable,
OutputBiomassTable);
if (m_DatabasePtr->isARelativeBiomassModel(m_ProjectName,m_ModelName)) {
// RSK ??? check this for covariate coefficient logic
updateObservedBiomassAndEstSurveyQTable(SpeciesList,RunLength+1,
EstSurveyQ,EstSurveyQCovariateCoeffs);
}
Expand Down Expand Up @@ -4062,7 +4061,6 @@ nmfMainWindow::menu_saveCurrentRun()
OutputSurveyQTable,OutputSurveyQCovariateCoeffsTable,
OutputBiomassTable);
if (m_DatabasePtr->isARelativeBiomassModel(m_ProjectName,m_ModelName)) {
// RSK ??? check this for covariate coefficient logic
updateObservedBiomassAndEstSurveyQTable(SpeciesList,RunLength+1,
EstSurveyQ,EstSurveyQCovariateCoeffs);
}
Expand Down Expand Up @@ -8897,87 +8895,6 @@ nmfMainWindow::getLegendCode(bool isAveraged,
return code;
}



/*
* RSK remove this...it's not being used
*/
void
nmfMainWindow::showObservedBiomassScatter(
const std::string &ChartTitle,
const int &StartYearForecast,
const int &NumSpecies,
const QString &OutputSpecies,
const int &SpeciesNum,
const int NumYears,
boost::numeric::ublas::matrix<double> &ObservedBiomass,
QString &ScaleStr,
double &ScaleVal,
double &YMinSliderVal,
const bool& clearChart,
QStringList ColumnLabelsForLegend)

{
//
// Draw the line chart
//
bool ShowLegend = false;
QStringList RowLabelsForBars;
boost::numeric::ublas::matrix<double> ChartScatterData;
ChartScatterData.resize(NumYears,1);
ChartScatterData.clear();
RowLabelsForBars.clear();
std::string value;
std::string LineStyle = "SolidLine";
QStringList SpeciesNames;
QStringList Years;
std::string legendCode = "";
std::string ChartType;
std::string MainTitle;
std::string XLabel;
std::string YLabel;
int Theme = 0; // Replace with checkbox values
std::vector<bool> GridLines = {true,true}; // Replace with checkbox values
QStringList HoverLabels;

ChartType = "Line";
MainTitle = ChartTitle + " for: " + OutputSpecies.toStdString();
XLabel = "Year";
YLabel = ChartTitle + " (" + ScaleStr.toStdString() + "metric tons)";

if (clearChart) {
m_ChartWidget->removeAllSeries();
}

// First show scatter
for (int species=0; species<NumSpecies; ++species) {
if (species == SpeciesNum) {
for (int time=0; time<NumYears; ++time) {
ChartScatterData(time,0) = ObservedBiomass(time,species)/ScaleVal;
}
break;
}
}

nmfChartScatter* scatterChart = new nmfChartScatter();
std::string chartType = "Scatter";
scatterChart->populateChart(m_ChartWidget,
chartType,
nmfConstantsMSSPM::ShowFirstPoint,
ChartScatterData,
QColor(100,100,255),
{}, {},
MainTitle,
XLabel,
YLabel,
GridLines,
0);


}



void
nmfMainWindow::showChartBiomassVsTime(
const int &NumSpecies,
Expand Down
13 changes: 0 additions & 13 deletions MSSPM_Main/nmfMainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,19 +809,6 @@ class nmfMainWindow : public QMainWindow
void setupOutputViewerWidget();
void setOutputControlsWidth();
void setupProgressChart();
void showObservedBiomassScatter(
const std::string &ChartTitle,
const int &StartForecastYear,
const int &NumSpecies,
const QString &OutputSpecies,
const int &SpeciesNum,
const int NumYears,
boost::numeric::ublas::matrix<double> &ObservedBiomass,
QString &ScaleStr,
double &ScaleVal,
double &YMinSliderVal,
const bool& clearChart,
QStringList ColumnLabelsForLegend);
void showChartBiomassVsTime(
const int &NumSpecies,
const QString &OutputSpecies,
Expand Down
4 changes: 2 additions & 2 deletions MSSPM_ParameterEstimationNLoptAlgorithm/NLopt_Estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ NLopt_Estimator::extractParameters(const nmfStructsQt::ModelDataStruct& NLoptDat
for (int i=0; i<NumSpeciesOrGuilds; ++i) {
surveyQCovariateCoeffs.emplace_back(EstParameters[offset+i]);
}
offset += NumSpeciesOrGuilds;
// offset += NumSpeciesOrGuilds;
}

double
Expand Down Expand Up @@ -703,7 +703,7 @@ NLopt_Estimator::loadSurveyQParameterRanges(
}

// Always load SurveyQ Covariate Coefficient values
for (unsigned species=0; species<dataStruct.SurveyQCovariateCoeff.size(); ++species) {
for (unsigned species=0; species<dataStruct.SurveyQMin.size(); ++species) {
speciesName = dataStruct.SpeciesNames[species];
covariateCoeffMap = dataStruct.SurveyQCovariateCoeff;
covariateStruct = covariateCoeffMap[speciesName];
Expand Down

0 comments on commit c38b5ce

Please sign in to comment.