diff --git a/FEM/OpenSeesPyFEM.cpp b/FEM/OpenSeesPyFEM.cpp index 530eeb50..0a6f65c0 100644 --- a/FEM/OpenSeesPyFEM.cpp +++ b/FEM/OpenSeesPyFEM.cpp @@ -218,7 +218,7 @@ OpenSeesPyFEM::outputAppDataToJSON(QJsonObject &jsonObject) { if (fileInfo2.exists() && fileInfo2.isFile()) { dataObj["parametersScript"]=fileInfo2.fileName(); - dataObj["PS_Path"]=fileInfo1.path(); + dataObj["PA_Path"]=fileInfo2.path(); } else { if (fileName2.isEmpty()) dataObj["parametersScript"]=QString(""); @@ -253,6 +253,8 @@ OpenSeesPyFEM::inputAppDataFromJSON(QJsonObject &jsonObject) { QString fileName; QString filePath; + // Main == + if (dataObject.contains("mainScript")) { QJsonValue theName = dataObject["mainScript"]; fileName = theName.toString(); @@ -267,31 +269,39 @@ OpenSeesPyFEM::inputAppDataFromJSON(QJsonObject &jsonObject) { inputScript->setText(QDir(filePath).filePath(fileName)); + // Post == + if (dataObject.contains("postprocessScript")) { QJsonValue theName = dataObject["postprocessScript"]; fileName = theName.toString(); if (dataObject.contains("PS_Path")) { - QJsonValue theName = dataObject["PS_Path"]; - filePath = theName.toString(); - postprocessScript->setText(QDir(filePath).filePath(fileName)); - } else - postprocessScript->setText(fileName); - } else + QJsonValue theName = dataObject["PS_Path"]; + filePath = theName.toString(); + postprocessScript->setText(QDir(filePath).filePath(fileName)); + } else { + postprocessScript->setText(fileName); + } + } else { postprocessScript->setText(""); + } + + // Params == if (dataObject.contains("parametersScript")) { QJsonValue theName = dataObject["parametersScript"]; fileName = theName.toString(); - + if (dataObject.contains("PA_Path")) { - QJsonValue theName = dataObject["PA_Path"]; - filePath = theName.toString(); - parametersScript->setText(QDir(filePath).filePath(fileName)); - } else - parametersScript->setText(fileName); - } else - parametersScript->setText(""); + QJsonValue theName = dataObject["PA_Path"]; + filePath = theName.toString(); + parametersScript->setText(QDir(filePath).filePath(fileName)); + } else { + parametersScript->setText(fileName); + } + } else { + parametersScript->setText(""); + } } else return false; diff --git a/FEM/surrogateGpFEM.cpp b/FEM/surrogateGpFEM.cpp index fd722594..bea0ff18 100644 --- a/FEM/surrogateGpFEM.cpp +++ b/FEM/surrogateGpFEM.cpp @@ -87,7 +87,7 @@ surrogateGpFEM::surrogateGpFEM(QWidget *parent) QLabel *label2 = new QLabel("SurrogateGP Model (.pkl)"); postprocessScript = new QLineEdit; - postprocessScript->setPlaceholderText("(Optional)"); + postprocessScript->setPlaceholderText(""); QPushButton *choosePostprocessScript = new QPushButton(); choosePostprocessScript->setText(tr("Choose")); connect(choosePostprocessScript, &QPushButton::clicked, this, [this](){ @@ -134,8 +134,10 @@ surrogateGpFEM::surrogateGpFEM(QWidget *parent) QHBoxLayout * gpOutputLayout = new QHBoxLayout(); gpOutputComboBox= new QComboBox; gpOutputComboBox->addItem("Median (representative) prediction"); + //gpOutputComboBox->addItem("Random sample under prediction uncertainty"); gpOutputLayout->addWidget( new QLabel("GP output ")); gpOutputLayout->addWidget(gpOutputComboBox); + gpOutputComboBox->setMinimumWidth(400); gpOutputLayout->addStretch(1); connect(option3Button, &QRadioButton::toggled, this, [=](bool tog){ @@ -398,6 +400,8 @@ surrogateGpFEM::showGpOptions(QString name1) { if (file.open(QFile::ReadOnly | QFile::Text)) { QString val; val=file.readAll(); + val.replace(QString("NaN"),QString("null")); + val.replace(QString("Infinity"),QString("inf")); QJsonDocument doc = QJsonDocument::fromJson(val.toUtf8()); QJsonObject jsonSur = doc.object(); file.close(); diff --git a/FEM/surrogateGpParser.cpp b/FEM/surrogateGpParser.cpp index 623d95e3..5baa55b6 100644 --- a/FEM/surrogateGpParser.cpp +++ b/FEM/surrogateGpParser.cpp @@ -76,9 +76,13 @@ surrogateGpParser::getVariables(QString inFilename) if (file.open(QFile::ReadOnly | QFile::Text)) { QString val; val=file.readAll(); + file.close(); + val.replace(QString("NaN"),QString("null")); + val.replace(QString("Infinity"),QString("inf")); + QJsonDocument doc = QJsonDocument::fromJson(val.toUtf8()); QJsonObject jsonSur = doc.object(); - file.close(); + auto GPidentifier = jsonSur.find("kernName"); // should be the right .json file if (!jsonSur.isEmpty() && GPidentifier != jsonSur.end()) {