Skip to content

Commit

Permalink
Small changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maginor committed Mar 21, 2023
1 parent b05b793 commit 44e1204
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 47 deletions.
2 changes: 1 addition & 1 deletion AdditionalPlotView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void AdditionalPlotView::SetAll(std::vector<plot_setup> &Setups)
for(int Row = 0; Row < Count; ++Row)
Plots[Row].Plot.PlotSetup = Setups[Row];
EditNumRows.SetData(Count);
NumRowsChanged(true);
NumRowsChanged(true);
}

void SerializePlotSetup(Json &SetupJson, plot_setup &Setup, MobiView *ParentWindow)
Expand Down
4 changes: 2 additions & 2 deletions MCMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ bool AffineStretchMove(double *SamplerParams, double *Scale, int Step, int Walke

bool AffineWalkMove(double *SamplerParams, double *Scale, int Step, int Walker, int FirstEnsembleWalker, int EnsembleStep, size_t NEnsemble, mcmc_data *Data,
double (*LogLikelyhood)(void *, int, int), void *LLFunState)
{
{
int S0 = (int)SamplerParams[0];

bool Accepted = true;
Expand Down Expand Up @@ -163,7 +163,7 @@ bool DifferentialEvolutionMove(double *SamplerParams, double *Scale, int Step, i

int EnsW1 = (int)Random(NEnsemble) + FirstEnsembleWalker;
int EnsW2;
do
do
EnsW2 = (int)Random(NEnsemble) + FirstEnsembleWalker;
while(EnsW2 == EnsW1);

Expand Down
4 changes: 1 addition & 3 deletions MCMCResultWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,10 +937,8 @@ void MCMCResultWindow::GenerateProjectionsPushed()

ParentWindow->ModelDll.GetResultSeries(DataSets[Worker], Target.ResultName.data(), (char**)ResultIndexes.data(), ResultIndexes.size(), ResultYValues);


if(!ParametricOnly)
{

std::vector<double> ErrParam(Target.ErrParNum.size());
for(int Idx = 0; Idx < ErrParam.size(); ++Idx) ErrParam[Idx] = Pars[Target.ErrParNum[Idx]];
AddRandomError(ResultYValues, ResultTimesteps, ErrParam, Target.ErrStruct, Generators[Worker]);
Expand Down Expand Up @@ -1133,7 +1131,7 @@ void MCMCResultWindow::GenerateProjectionsPushed()
ResidualYValues.reserve(ResultTimesteps);
ComputeStandardizedResiduals(InputYValues, YValuesOfMedian, ResultTimesteps, ErrPar, Target.ErrStruct, ResidualYValues);

assert(YValuesStored.size() == ResidualYValues.size());
//assert(YValuesStored.size() == ResidualYValues.size());

GraphColor = ResidPlot.PlotColors.Next();
ResidPlot.SetSequentialXAll(false);
Expand Down
16 changes: 10 additions & 6 deletions OptimizationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ OptimizationWindow::OptimizationWindow()
RunSetup.EditEpsilon.Min(0.0);
RunSetup.EditEpsilon.SetData(0.0);

RunSetup.OptionShowProgress.SetData(true);


MCMCSetup.PushRun.WhenPush = [&](){ RunClicked(1); };
MCMCSetup.PushRun.SetImage(IconImg4::Run());
Expand Down Expand Up @@ -1723,13 +1725,13 @@ void OptimizationWindow::RunClicked(int RunType)
auto BeginTime = std::chrono::high_resolution_clock::now();

std::vector<bool> Dummy;
dlib::function_evaluation Result
= dlib::find_max_global(OptimizationModel,
MinBound,
dlib::function_evaluation Result
= dlib::find_max_global(OptimizationModel,
MinBound,
MaxBound,
dlib::max_function_calls(MaxFunctionCalls),
dlib::FOREVER,
Epsilon,
dlib::max_function_calls(MaxFunctionCalls),
dlib::FOREVER,
Epsilon,
InitialEvals
);

Expand Down Expand Up @@ -2148,6 +2150,8 @@ void OptimizationWindow::LoadFromJson()
return;
}

//PromptOK("Bing!");

String JsonData = LoadFile(Filename);

LoadFromJsonString(JsonData);
Expand Down
48 changes: 24 additions & 24 deletions ParameterView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ MobiView::GetSelectedParameterGroupIndexSets(std::vector<char *> &IndexSetsOut,

indexed_parameter
MobiView::GetParameterAtRow(int Row)
{
{
indexed_parameter Result = {};
Result.Valid = false;

Expand All @@ -101,26 +101,26 @@ MobiView::GetParameterAtRow(int Row)
for(char * IndexSetName : IndexSetNames)
{
int IdxSetId = IndexSetNameToId[IndexSetName];
parameter_index Idx = {};
String IndexName;
if(SecondExpandedSetLocal == IdxIdx)
{
//NOTE: This is a "little" hacky...
for(int Col = 0; Col < Params.ParameterView.GetColumnCount(); ++Col)
{
LineEdit *Control = (LineEdit *)Params.ParameterView.GetCtrl(Row, Col);
if(Control->HasFocus())
{
IndexName = Params.ParameterView.GetId(Col);
break;
}
}
}
else if(ExpandedSetLocal == IdxIdx)
IndexName = Params.ParameterView.Get(Row, Id("__index"));
else
IndexName = IndexList[IdxSetId]->Get();

parameter_index Idx = {};
String IndexName;
if(SecondExpandedSetLocal == IdxIdx)
{
//NOTE: This is a "little" hacky...
for(int Col = 0; Col < Params.ParameterView.GetColumnCount(); ++Col)
{
LineEdit *Control = (LineEdit *)Params.ParameterView.GetCtrl(Row, Col);
if(Control->HasFocus())
{
IndexName = Params.ParameterView.GetId(Col);
break;
}
}
}
else if(ExpandedSetLocal == IdxIdx)
IndexName = Params.ParameterView.Get(Row, Id("__index"));
else
IndexName = IndexList[IdxSetId]->Get();

Idx.IndexSetName = std::string(IndexSetName);
Idx.Name = IndexName.ToStd();
Expand Down Expand Up @@ -271,7 +271,7 @@ void MobiView::RefreshParameterView(bool RefreshValuesOnly)
Params.ParameterView.AddColumn(Id("__value"), "Value");
}
else
{
{
for(char *IndexName : SecondExpandedIndexSet)
Params.ParameterView.AddColumn(Id(IndexName), IndexName);
}
Expand Down Expand Up @@ -313,7 +313,7 @@ void MobiView::RefreshParameterView(bool RefreshValuesOnly)
//NOTE: We don't store info about it being locked here, since that has to be
//overridden later anyway (the lock status can have changed since the table was
//constructed.
Parameter.Indexes[Idx].Locked = false;
Parameter.Indexes[Idx].Locked = false;
}
}

Expand Down Expand Up @@ -448,7 +448,7 @@ void MobiView::RefreshParameterView(bool RefreshValuesOnly)
StrToTime(D, TimeVal); //Error handling? But should not be necessary.
RowData.Set(ValueColumn, D);

if(!RefreshValuesOnly)
if(!RefreshValuesOnly)
{
ParameterControls.Create<EditTimeNotNull>();

Expand Down
8 changes: 4 additions & 4 deletions Plotting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ MyPlot::MyPlot()
{

//this->SetFastViewX(true); Can't be used with scatter plot data since it combines points.
this->SetSequentialXAll(true);
//this->SetSequentialXAll(true); // And this crops lines that go outside the boundary.

Size PlotReticleSize = GetTextSize("00000000", this->GetReticleFont());
Size PlotUnitSize = GetTextSize("[dummy]", this->GetLabelsFont());
Expand Down Expand Up @@ -1379,7 +1379,7 @@ void MyPlot::StackedPlotFixup(plot_major_mode MajorMode)

//NOTE we have to do backwards iteration so that the ones that were added first are the
//ones on top. Otherwise the ones in front will be higher and over-paint them.
for(int Idx = this->CachedStackY.size()-1; Idx >= 0; --Idx)
for(int Idx = this->CachedStackY.size()-1; Idx >= 0; --Idx)
{
double *Ys = this->CachedStackY[Idx];
for(size_t Ts = 0; Ts < Len; ++Ts)
Expand All @@ -1391,7 +1391,7 @@ void MyPlot::StackedPlotFixup(plot_major_mode MajorMode)
}
if(MajorMode == MajorMode_StackedShare)
{
for(int Idx = this->CachedStackY.size()-1; Idx >= 0; --Idx)
for(int Idx = this->CachedStackY.size()-1; Idx >= 0; --Idx)
{
double *Ys = this->CachedStackY[Idx];
for(size_t Ts = 0; Ts < Len; ++Ts)
Expand Down Expand Up @@ -2085,7 +2085,7 @@ void MobiView::GetGofOffsets(const Time &ReferenceTime, uint64 ReferenceTimestep
Time AttemptBegin = CalibrationIntervalStart.GetData();
Time AttemptEnd = CalibrationIntervalEnd.GetData();

GetGofOffsetsBase(AttemptBegin, AttemptEnd, ReferenceTime, ReferenceTimesteps, BeginOut, EndOut, GofOffsetOut, GofTimestepsOut);
GetGofOffsetsBase(AttemptBegin, AttemptEnd, ReferenceTime, ReferenceTimesteps, BeginOut, EndOut, GofOffsetOut, GofTimestepsOut);
}


Expand Down
10 changes: 3 additions & 7 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,15 +945,11 @@ void MobiView::Load()

String InputExt = GetFileExt(InputFile.data());

//if(InputExt == ".xls" || InputExt == ".xlsx")
//{
// Success = LoadFromExcel(this, ParameterFile.data(), InputFile.data());
//}
//else
//{

//PromptOK("Bing!");

DataSet = ModelDll.SetupModel(ParameterFile.data(), InputFile.data());
Success = !CheckDllUserError();
//}

if(!Success)
{
Expand Down

0 comments on commit 44e1204

Please sign in to comment.