diff --git a/README.md b/README.md index f6e86d5d..bbdd5dda 100644 --- a/README.md +++ b/README.md @@ -42,18 +42,18 @@ We don't presently deploy versioned artifacts into a public repository like the #### **As a single runnable JAR** ```shell -java -jar coda-calibration/calibration-standalone/target/calibration-standalone-1.0.2-runnable.jar +java -jar coda-calibration/calibration-standalone/target/calibration-standalone-1.0.3-runnable.jar ``` #### **GUI alone** ```shell -java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.2-runnable.jar +java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.3-runnable.jar ``` #### **Calibration REST service alone** ```shell -java -jar coda-calibration/calibration-service/application/target/application-1.0.2-runnable.jar +java -jar coda-calibration/calibration-service/application/target/application-1.0.3-runnable.jar ``` #### A note about HTTPS diff --git a/calibration-gui/pom.xml b/calibration-gui/pom.xml index 88d13279..32d5f2fb 100644 --- a/calibration-gui/pom.xml +++ b/calibration-gui/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-gui - 1.0.2 + 1.0.3 jar calibration-gui @@ -65,12 +65,12 @@ gov.llnl.gnem.apps.coda.calibration externals - 1.0.2 + 1.0.3 gov.llnl.gnem.apps.coda.calibration model - 1.0.2 + 1.0.3 org.eclipse.persistence diff --git a/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/LoadingGui.java b/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/LoadingGui.java deleted file mode 100644 index 478181e6..00000000 --- a/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/LoadingGui.java +++ /dev/null @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory -* CODE-743439. -* All rights reserved. -* This file is part of CCT. For details, see https://github.com/LLNL/coda-calibration-tool. -* -* Licensed under the Apache License, Version 2.0 (the “Licensee”); you may not use this file except in compliance with the License. You may obtain a copy of the License at: -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and limitations under the license. -* -* This work was performed under the auspices of the U.S. Department of Energy -* by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344. -*/ -package gov.llnl.gnem.apps.coda.calibration.gui.controllers; - -import java.io.IOException; - -import gov.llnl.gnem.apps.coda.calibration.gui.util.ProgressMonitor; -import javafx.application.Platform; -import javafx.beans.binding.Bindings; -import javafx.collections.FXCollections; -import javafx.collections.ObservableList; -import javafx.fxml.FXML; -import javafx.fxml.FXMLLoader; -import javafx.scene.Node; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.scene.control.TableCell; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableView; -import javafx.scene.text.Font; -import javafx.stage.Stage; -import javafx.stage.StageStyle; -import javafx.util.Callback; - -/** - * @throws IllegalStateException - * if the FXML sub-system is unable to initialize the display - */ -public class LoadingGui { - - @FXML - private TableView progressTable; - - @FXML - private TableColumn progressColumn; - - @FXML - private TableColumn taskColumn; - - private Stage stage; - private ObservableList monitors = FXCollections.observableArrayList(); - - public LoadingGui() { - Platform.runLater(() -> { - FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/WaveformLoading.fxml")); - fxmlLoader.setController(this); - stage = new Stage(StageStyle.UTILITY); - Font.loadFont(getClass().getResource("/fxml/MaterialIcons-Regular.ttf").toExternalForm(), 18); - Parent root; - try { - root = fxmlLoader.load(); - Scene scene = new Scene(root); - stage.setScene(scene); - - taskColumn.setCellValueFactory(value -> Bindings.createStringBinding(() -> value.getValue().getDisplayableName())); - - progressColumn.setCellValueFactory(value -> Bindings.createObjectBinding(() -> value.getValue())); - progressColumn.setCellFactory(new Callback, TableCell>() { - - @Override - public TableCell call(TableColumn param) { - return new TableCell() { - @Override - protected void updateItem(Node item, boolean empty) { - if (item == getItem()) - return; - super.updateItem(item, empty); - - if (item == null) { - super.setText(null); - super.setGraphic(null); - } else if (item instanceof Node) { - super.setText(null); - super.setGraphic((Node) item); - } - } - }; - } - }); - progressTable.setItems(monitors); - } catch (IOException e) { - throw new IllegalStateException(e); - } - }); - } - - public void addProgressMonitor(ProgressMonitor monitor) { - monitors.add(monitor); - Platform.runLater(() -> { - stage.show(); - }); - } - - public void removeProgressMonitor(ProgressMonitor monitor) { - monitors.remove(monitor); - } - - public void hide() { - Platform.runLater(() -> { - stage.hide(); - }); - } - - public void show() { - Platform.runLater(() -> { - stage.show(); - }); - } -} diff --git a/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/PathController.java b/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/PathController.java index aca45039..cf6fcf15 100644 --- a/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/PathController.java +++ b/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/PathController.java @@ -372,6 +372,8 @@ private void plotSd() { if (xmax == null) { xmax = plotObj.getXcenter(); + } + if (xmin == null) { xmin = plotObj.getXcenter(); } if (plotObj.getXcenter() > xmax) { @@ -402,10 +404,14 @@ private void plotSd() { } plot.AddPlotObject(plotObj2, 10); } + String labelText; if (xmax != null) { plot.SetAxisLimits(xmin - (xmin * .1) - .1, xmax + (xmax * .1) + .1, ymin - (ymin * .1) - .1, ymax + (ymax * .1) + .1); + labelText = "StdDev(Before) = " + dfmt2.format(overallBeforeStats.getStandardDeviation()) + " StdDev(After) = " + dfmt2.format(overallAfterStats.getStandardDeviation()); + } + else { + labelText = ""; } - String labelText = "StdDev(Before) = " + dfmt2.format(overallBeforeStats.getStandardDeviation()) + " StdDev(After) = " + dfmt2.format(overallAfterStats.getStandardDeviation()); sdPlot.getXaxis().setVisible(false); sdPlot.getXaxis().setLabelText(labelText); sdPlot.getXaxis().setVisible(true); @@ -473,6 +479,8 @@ private void plotBeforeAfter() { if (xmax == null) { xmax = plotObj.getXcenter(); + } + if (xmin == null) { xmin = plotObj.getXcenter(); } if (plotObj.getXcenter() > xmax) { @@ -507,7 +515,12 @@ private void plotBeforeAfter() { } } - + if (xmax == null) { + xmax = 1.0; + } + if (xmin == null) { + xmin = 0.0; + } double paddedXmin = xmin - (xmin * .1); double paddedXmax = xmax + (xmax * .1); if (xmax != null) { diff --git a/calibration-gui/src/main/resources/fxml/WaveformLoading.fxml b/calibration-gui/src/main/resources/fxml/WaveformLoading.fxml deleted file mode 100644 index b81ec37a..00000000 --- a/calibration-gui/src/main/resources/fxml/WaveformLoading.fxml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/calibration-service/application/pom.xml b/calibration-service/application/pom.xml index 465e7882..8e8cf6a2 100644 --- a/calibration-service/application/pom.xml +++ b/calibration-service/application/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.2 + 1.0.3 4.0.0 application diff --git a/calibration-service/application/src/main/resources/data.sql b/calibration-service/application/src/main/resources/data.sql index dffdd6ce..94dd0b04 100644 --- a/calibration-service/application/src/main/resources/data.sql +++ b/calibration-service/application/src/main/resources/data.sql @@ -1,21 +1,21 @@ -INSERT INTO "MDACPS" (ID, DEL_ETA, DEL_GAMMA0, DELQ0, DIST_CRIT, ETA, GAMMA0, PHASE, Q0, SNR, U0, VERSION) VALUES ('1', '0', '0', '0', '0.001', '1.1', '0.65', 'Pn', '210', '2', '7900', '0') -INSERT INTO "MDACPS" (ID, DEL_ETA, DEL_GAMMA0, DELQ0, DIST_CRIT, ETA, GAMMA0, PHASE, Q0, SNR, U0, VERSION) VALUES ('2', '0', '0', '0', '100', '0.5', '0.45', 'Pg', '190', '2', '6000', '0') -INSERT INTO "MDACPS" (ID, DEL_ETA, DEL_GAMMA0, DELQ0, DIST_CRIT, ETA, GAMMA0, PHASE, Q0, SNR, U0, VERSION) VALUES ('3', '0', '0', '0', '0.001', '1.1', '0.55', 'Sn', '590', '2', '4500', '0') -INSERT INTO "MDACPS" (ID, DEL_ETA, DEL_GAMMA0, DELQ0, DIST_CRIT, ETA, GAMMA0, PHASE, Q0, SNR, U0, VERSION) VALUES ('4', '0', '0', '0', '100', '0.5', '0.54', 'Lg', '200', '2', '3500', '0') +INSERT INTO "MDACPS" (ID, DEL_ETA, DEL_GAMMA0, DELQ0, DIST_CRIT, ETA, GAMMA0, PHASE, Q0, SNR, U0, VERSION) VALUES ('-1', '0', '0', '0', '0.001', '1.1', '0.65', 'Pn', '210', '2', '7900', '0') +INSERT INTO "MDACPS" (ID, DEL_ETA, DEL_GAMMA0, DELQ0, DIST_CRIT, ETA, GAMMA0, PHASE, Q0, SNR, U0, VERSION) VALUES ('-2', '0', '0', '0', '100', '0.5', '0.45', 'Pg', '190', '2', '6000', '0') +INSERT INTO "MDACPS" (ID, DEL_ETA, DEL_GAMMA0, DELQ0, DIST_CRIT, ETA, GAMMA0, PHASE, Q0, SNR, U0, VERSION) VALUES ('-3', '0', '0', '0', '0.001', '1.1', '0.55', 'Sn', '590', '2', '4500', '0') +INSERT INTO "MDACPS" (ID, DEL_ETA, DEL_GAMMA0, DELQ0, DIST_CRIT, ETA, GAMMA0, PHASE, Q0, SNR, U0, VERSION) VALUES ('-4', '0', '0', '0', '100', '0.5', '0.54', 'Lg', '200', '2', '3500', '0') -INSERT INTO "MDACFI" (ID, ALPHAR, ALPHAS, BETAS, BETAR, DEL_PSI, DEL_SIGMA, M0REF, PSI, RAD_PATP, RAD_PATS, RHOR, RHOS, SIGMA, VERSION, ZETA) VALUES ('1', '5000', '6000', '3500', '2900', '0', '0', '10000000000000000', '0.25', '0.44', '0.6', '2500', '2700', '0.3', '0', '1') +INSERT INTO "MDACFI" (ID, ALPHAR, ALPHAS, BETAS, BETAR, DEL_PSI, DEL_SIGMA, M0REF, PSI, RAD_PATP, RAD_PATS, RHOR, RHOS, SIGMA, VERSION, ZETA) VALUES ('-1', '5000', '6000', '3500', '2900', '0', '0', '10000000000000000', '0.25', '0.44', '0.6', '2500', '2700', '0.3', '0', '1') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('1', '0', '0', '0', '0', '0', '0', '0.0200', '0.0300', '0.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '300', '1000','100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('2', '0', '0', '0', '0', '0', '0', '0.0300', '0.0500', '0.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '300', '800', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('3', '0', '0', '0', '0', '0', '0', '0.0500', '0.1000', '0.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '250', '600', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('4', '0', '0', '0', '0', '0', '0', '0.1000', '0.2000', '0.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '250', '550', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('5', '0', '0', '0', '0', '0', '0', '0.2000', '0.3000', '0.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '150', '550', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('6', '0', '0', '0', '0', '0', '0', '0.3000', '0.5000', '0.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '150', '500', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('7', '0', '0', '0', '0', '0', '0', '0.5000', '0.7000', '0.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '150', '500', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('8', '0', '0', '0', '0', '0', '0', '0.7000', '1.0000', '0.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '120', '450', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('9', '0', '0', '0', '0', '0', '0', '1.0000', '1.5000', '0.6', '0', '0', '0', '0', '0', '0', '0', '0', '0', '90', '450', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('10', '0', '0', '0', '0', '0', '0', '1.5000', '2.0000', '0.75', '0', '0', '0', '0', '0', '0', '0', '0', '0', '80', '400', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('11', '0', '0', '0', '0', '0', '0', '2.0000', '3.0000', '0.75', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60', '400', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('12', '0', '0', '0', '0', '0', '0', '3.0000', '4.0000', '0.75', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60', '400', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('13', '0', '0', '0', '0', '0', '0', '4.0000', '6.0000', '1.0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60', '400', '100') -INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('14', '0', '0', '0', '0', '0', '0', '6.0000', '8.0000', '1.0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '40', '350', '100') \ No newline at end of file +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-1', '0', '0', '0', '0', '0', '0', '0.0200', '0.0300', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '300', '1000','100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-2', '0', '0', '0', '0', '0', '0', '0.0300', '0.0500', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '300', '800', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-3', '0', '0', '0', '0', '0', '0', '0.0500', '0.1000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '250', '600', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-4', '0', '0', '0', '0', '0', '0', '0.1000', '0.2000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '250', '550', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-5', '0', '0', '0', '0', '0', '0', '0.2000', '0.3000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '150', '550', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-6', '0', '0', '0', '0', '0', '0', '0.3000', '0.5000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '150', '500', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-7', '0', '0', '0', '0', '0', '0', '0.5000', '0.7000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '150', '500', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-8', '0', '0', '0', '0', '0', '0', '0.7000', '1.0000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '120', '450', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-9', '0', '0', '0', '0', '0', '0', '1.0000', '1.5000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '90', '450', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-10', '0', '0', '0', '0', '0', '0', '1.5000', '2.0000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '80', '400', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-11', '0', '0', '0', '0', '0', '0', '2.0000', '3.0000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60', '400', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-12', '0', '0', '0', '0', '0', '0', '3.0000', '4.0000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60', '400', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-13', '0', '0', '0', '0', '0', '0', '4.0000', '6.0000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60', '400', '100') +INSERT INTO "SHARED_FB_PARAMS" (ID, BETA0, BETA1, BETA2, GAMMA0, GAMMA1, GAMMA2, LOW_FREQUENCY, HIGH_FREQUENCY,MIN_SNR, Q, S1, S2, VELOCITY0, VELOCITY1, VELOCITY2, VERSION, XC, XT, MIN_LENGTH, MAX_LENGTH, MEASURE_TIME) VALUES ('-14', '0', '0', '0', '0', '0', '0', '6.0000', '8.0000', '1.5', '0', '0', '0', '0', '0', '0', '0', '0', '0', '40', '350', '100') \ No newline at end of file diff --git a/calibration-service/integration/pom.xml b/calibration-service/integration/pom.xml index b575b146..95a67eb6 100644 --- a/calibration-service/integration/pom.xml +++ b/calibration-service/integration/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.2 + 1.0.3 4.0.0 integration diff --git a/calibration-service/model/pom.xml b/calibration-service/model/pom.xml index 664faa56..2ec908e0 100644 --- a/calibration-service/model/pom.xml +++ b/calibration-service/model/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.2 + 1.0.3 4.0.0 model diff --git a/calibration-service/pom.xml b/calibration-service/pom.xml index a1722732..28225592 100644 --- a/calibration-service/pom.xml +++ b/calibration-service/pom.xml @@ -9,7 +9,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.2 + 1.0.3 diff --git a/calibration-service/repository/pom.xml b/calibration-service/repository/pom.xml index b0dc05f6..008a9353 100644 --- a/calibration-service/repository/pom.xml +++ b/calibration-service/repository/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.2 + 1.0.3 4.0.0 repository diff --git a/calibration-service/service-api/pom.xml b/calibration-service/service-api/pom.xml index a8c046f5..d22c3aed 100644 --- a/calibration-service/service-api/pom.xml +++ b/calibration-service/service-api/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.2 + 1.0.3 4.0.0 service.api diff --git a/calibration-service/service-impl/pom.xml b/calibration-service/service-impl/pom.xml index 89c0e5d3..db5d0fca 100644 --- a/calibration-service/service-impl/pom.xml +++ b/calibration-service/service-impl/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.2 + 1.0.3 4.0.0 service.impl diff --git a/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/Joint1DPathCorrection.java b/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/Joint1DPathCorrection.java index eb8f2f20..f92ba522 100644 --- a/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/Joint1DPathCorrection.java +++ b/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/Joint1DPathCorrection.java @@ -32,15 +32,17 @@ import org.apache.commons.math3.optim.InitialGuess; import org.apache.commons.math3.optim.MaxEval; import org.apache.commons.math3.optim.PointValuePair; +import org.apache.commons.math3.optim.SimpleBounds; import org.apache.commons.math3.optim.SimpleValueChecker; import org.apache.commons.math3.optim.nonlinear.scalar.GoalType; import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction; -import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.PowellOptimizer; +import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer; import org.apache.commons.math3.optim.univariate.BrentOptimizer; import org.apache.commons.math3.optim.univariate.SearchInterval; import org.apache.commons.math3.optim.univariate.UnivariateObjectiveFunction; import org.apache.commons.math3.optim.univariate.UnivariateOptimizer; import org.apache.commons.math3.optim.univariate.UnivariatePointValuePair; +import org.apache.commons.math3.random.MersenneTwister; import org.apache.commons.math3.stat.StatUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -93,6 +95,8 @@ public class Joint1DPathCorrection implements PathCalibrationService { private static final double SITE_MAX = 10.0; private static final double SITE_MIN = -10.0; + private static final int POP_SIZE = 10; + // Evids actually potentially need meta-data about p1,p2,q,xt,xc,etc per // evid in the future but for now they are common values for 1D. private double p1 = Math.log10(0.0001); @@ -216,20 +220,29 @@ public Map measurePathCorrections( optimizationLowBounds[i] = SITE_MIN; optimizationHighBounds[i] = SITE_MAX; } + + double[] sigmaArray = new double[optimizationParams.length]; + for (int i = 0; i < sigmaArray.length; i++) { + sigmaArray[i] = 1.; + } - // starting L1.2 residual - Double initialResidual = Math.pow(costFunction(freqBandData, dataMap, distanceMap, stationIdxMap, frequencyBand, optimizationParams) / totalDataCount, (1.0 / 1.2)); + // starting residual + Double initialResidual = Math.pow(costFunction(freqBandData, dataMap, distanceMap, stationIdxMap, frequencyBand, optimizationParams) / totalDataCount, (1.0 / 2.0)); PointValuePair optimizedResult = IntStream.range(0, STARTING_POINTS).parallel().mapToObj(i -> { ConvergenceChecker convergenceChecker = new SimpleValueChecker(TOLERANCE, TOLERANCE); - PowellOptimizer optimizer = new PowellOptimizer(TOLERANCE, TOLERANCE, convergenceChecker); + CMAESOptimizer optimizer = new CMAESOptimizer(1000000, TOLERANCE, true, 0, 10, new MersenneTwister(), true, convergenceChecker); + MultivariateFunction prediction = new ESHPathMultivariate(freqBandData, dataMap, distanceMap, stationIdxMap, frequencyBand); PointValuePair opt = null; try { - opt = optimizer.optimize(new MaxEval(2000000), + opt = optimizer.optimize(new MaxEval(1000000), new ObjectiveFunction(prediction), GoalType.MINIMIZE, - new InitialGuess(perturbParams(optimizationLowBounds, optimizationHighBounds))); + new SimpleBounds(optimizationLowBounds, optimizationHighBounds), + new InitialGuess(perturbParams(optimizationLowBounds, optimizationHighBounds)), + new CMAESOptimizer.PopulationSize(POP_SIZE), + new CMAESOptimizer.Sigma(sigmaArray)); } catch (TooManyEvaluationsException e) { } return opt; @@ -242,9 +255,9 @@ public Map measurePathCorrections( optimizationParams = optimizedResult.getPoint(); } - // final L1.2 residual + // final residual PathCostFunctionResult finalResults = costFunctionFull(freqBandData, dataMap, distanceMap, stationIdxMap, frequencyBand, optimizationParams); - Double finalResidual = Math.pow(finalResults.getCost() / totalDataCount, (1.0 / 1.2)); + Double finalResidual = Math.pow(finalResults.getCost() / totalDataCount, (1.0 / 2.0)); PathCalibrationMeasurement measurement = new PathCalibrationMeasurement(); measurement.setInitialResidual(initialResidual); @@ -331,7 +344,7 @@ private Map>> removeS } /** - * L1.2 cost function for use in optimization code. Extended Street-Herrmann + * cost function for use in optimization code. Extended Street-Herrmann * spreading model, no Q. */ public double costFunction(Map> evidStaData, Map> dataMap, Map> distanceMap, @@ -378,7 +391,7 @@ public PathCostFunctionResult costFunctionFull(Map 1) { double dmed = lpMean(ArrayUtils.toPrimitive(dataVec.toArray(new Double[0]))); for (Entry entry : stationMapData.entrySet()) { - rsum = rsum + Math.pow(Math.abs(localDataMap.get(evid).get(entry.getKey()) - dmed), 1.2); + rsum = rsum + Math.pow(Math.abs(localDataMap.get(evid).get(entry.getKey()) - dmed), 2.0); if (!residuals.containsKey(evid)) { residuals.put(evid, new HashMap()); } @@ -455,7 +468,7 @@ private double lpMean(final double[] values) { } else { UnivariateOptimizer optimizer = new BrentOptimizer(1e-10, 1e-14); UnivariatePointValuePair result = optimizer.optimize(new UnivariateObjectiveFunction(x -> xlpSum(values, x)), - new MaxEval(1000000), + new MaxEval(10000), GoalType.MINIMIZE, new SearchInterval(xmin, xmax, xstart)); mean = result.getPoint(); @@ -466,7 +479,7 @@ private double lpMean(final double[] values) { private double xlpSum(double[] x, double x0) { double sum = 0.0; for (int i = 0; i < x.length; i++) { - sum = sum + Math.pow(Math.abs(x[i] - x0), 1.2); + sum = sum + Math.pow(Math.abs(x[i] - x0), 2.0); } return sum; } diff --git a/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/processing/MaxVelocityCalculator.java b/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/processing/MaxVelocityCalculator.java index c428c655..a7f5c411 100644 --- a/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/processing/MaxVelocityCalculator.java +++ b/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/processing/MaxVelocityCalculator.java @@ -71,9 +71,9 @@ public Collection computeMaximumVelocity(List // cut the coda window portion of the seismograms waveform.cut(starttime, endtime); - double min_length = 50.; + double min_length = 25.; if (endtime.subtract(starttime).getEpochTime() < min_length) { - log.trace("Coda window length too short: {}", endtime.subtract(starttime).getEpochTime()); + log.info("Coda window length too short: {}", endtime.subtract(starttime).getEpochTime()); } // peakS[0] time in seconds for diff --git a/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/processing/ShapeCalculator.java b/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/processing/ShapeCalculator.java index 420399cf..f72cf6b9 100644 --- a/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/processing/ShapeCalculator.java +++ b/calibration-service/service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/processing/ShapeCalculator.java @@ -71,7 +71,7 @@ public List fitShapelineToMeasuredEnvelopes(Collection gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.2 + 1.0.3 4.0.0 @@ -72,12 +72,12 @@ gov.llnl.gnem.apps.coda.calibration calibration-gui - 1.0.2 + 1.0.3 gov.llnl.gnem.apps.coda.calibration application - 1.0.2 + 1.0.3 diff --git a/externals/pom.xml b/externals/pom.xml index 2e68ed3e..bffd9b9c 100644 --- a/externals/pom.xml +++ b/externals/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.calibration externals - 1.0.2 + 1.0.3 jar externals diff --git a/logo.gif b/logo.gif deleted file mode 100644 index 5fde177a..00000000 Binary files a/logo.gif and /dev/null differ diff --git a/pom.xml b/pom.xml index d3de36d7..1c7b54ee 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.2 + 1.0.3 coda-calibration pom @@ -49,7 +49,7 @@ gov.llnl.gnem.apps.coda.calibration externals - 1.0.2 + 1.0.3 org.springframework.boot