Skip to content

Commit

Permalink
CCT 1.0.8
Browse files Browse the repository at this point in the history
New Features:
 MW spectra truncation
   When a calibration is performed with events with and without apparent stress both loaded
     Those events with apparent stress values are treated as GT spectra and will not use the loaded MDAC model. These events will impact the site term fitting across the entire frequency spectra.
     Those events with only Mw values will be treated as a constraint on the magnitude by setting a very low apparent stress value and truncating the spectra at the computed corner frequency. In effect these events can still influence your overall site correction terms at the low frequency, and thereby help constrain the Mw value, but don't contribute to the roll-off shape of the spectra overall.
   **Enabled by default** you can toggle the old behavior back on via the --spectraTruncationEnabled=false flag at runtime.
 **BETA** UQ measurements for the final spectra results in calibration and measurement
   The confidence regions presently generated are relative to the optimizer's inversion walk on the theoretical spectra model vs. the measured values. This should be interpreted as the inversions confidence in finding a global minimum in the model misfit and **should not be treated as a confidence on the data itself**.
   A variety of metrics that can be diagnostic for QC, including misfit and data counts per event, are now reported in the Mw tables and exported JSON.
    * e.g. A model may have a very low misfit, and tight confidence bounds, but still be suspect due to having good spectra coverage on only the long period level at a few stations.
   These metrics are very much a work in progress but can be useful and **community input** on additional reporting that may prove useful is welcome.
 Persistent measurement intermediary artifacts
   Measurements will now save auto-picks, synthetics, and various other intermediary measurements that a calibration would typically be recording to support iterative QC from the GUI when looking at the spectra and inspecting related waveforms.
   The GUI has this feature enabled by default for the interactive workflow.
   The REST API now includes options to enable/disable this function (disabled by default)
 Capability to export diagnostic plots as images
   Export individual plots to SVG where possible
   Export specific overall views as high resolution PNGs
   Export polygon based map layers as SVG (icons, events, paths, etc)
   Export raster based map layers as high resolution PNGs (aerial imagery, topography, lithography, etc)

Improvements and Bugfixes:
 Significant performance improvements to the envelope tool across the board when generating envelopes.
 Minor performance improvements on Path calibration.
 Corrected a envelope stacking bug related to performance (no behavior changes).
 Updates to support very long, very low sample rate envelopes w.r.t. shape fitting and envelope creation.
 Updated the example notebook to have the latest API changes for the REST endpoints.
  • Loading branch information
justinbarno committed Mar 10, 2020
1 parent aea7d93 commit 0214653
Show file tree
Hide file tree
Showing 123 changed files with 2,535 additions and 1,031 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.7-runnable.jar
java -jar coda-calibration/calibration-standalone/target/calibration-standalone-1.0.8-runnable.jar
```

#### **GUI alone**

```shell
java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.7-runnable.jar
java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.8-runnable.jar
```
#### **Calibration REST service alone**

```shell
java -jar coda-calibration/calibration-service/application/target/application-1.0.7-runnable.jar
java -jar coda-calibration/calibration-service/application/target/application-1.0.8-runnable.jar
```

#### A note about HTTPS
Expand Down
2 changes: 1 addition & 1 deletion calibration-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>coda-calibration</artifactId>
<version>1.0.7.1</version>
<version>1.0.8</version>
</parent>

<artifactId>calibration-gui</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import gov.llnl.gnem.apps.coda.common.mapping.WMSLayerDescriptor;

@Component
@ConfigurationProperties("app")
public class AppProperties {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;

import javax.annotation.PreDestroy;

Expand All @@ -43,6 +44,8 @@
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.MeasuredMwsController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.PathController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.ReferenceEventLoadingController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.RefreshableController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.ScreenshotEnabledController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.ShapeController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.SiteController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.parameters.ParametersController;
Expand All @@ -59,15 +62,19 @@
import gov.llnl.gnem.apps.coda.common.gui.data.client.api.WaveformClient;
import gov.llnl.gnem.apps.coda.common.gui.events.ShowFailureReportEvent;
import gov.llnl.gnem.apps.coda.common.gui.util.ProgressMonitor;
import gov.llnl.gnem.apps.coda.common.gui.util.SnapshotUtils;
import gov.llnl.gnem.apps.coda.common.mapping.api.GeoMap;
import gov.llnl.gnem.apps.coda.common.model.domain.Pair;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.CheckMenuItem;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.input.TransferMode;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
Expand All @@ -83,11 +90,15 @@ public class CodaGuiController {

private WaveformGui waveformGui;
private DataController data;
private ParametersController param;
private ShapeController shape;
private PathController path;
private SiteController site;
private MeasuredMwsController measuredMws;

@FXML
private TabPane mainTabPane;

@FXML
private Tab dataTab;

Expand All @@ -106,20 +117,18 @@ public class CodaGuiController {
@FXML
private Tab measuredMwsTab;

private Runnable dataRefresh;
private Runnable paramRefresh;
private Runnable shapeRefresh;
private Runnable pathRefresh;
private Runnable siteRefresh;
private Runnable measuredMwsRefresh;
private Runnable activeTabRefresh;
private Consumer<File> activeTabScreenshot;

@FXML
private Button showMapButton;

@FXML
private Button refreshButton;

@FXML
private Button snapshotButton;

@FXML
private CheckMenuItem waveformFocus;

Expand All @@ -140,6 +149,8 @@ public class CodaGuiController {
private CalibrationClient calibrationClient;

private DirectoryChooser sacDirFileChooser = new DirectoryChooser();
private DirectoryChooser screenshotFolderChooser = new DirectoryChooser();

private FileChooser sacFileChooser = new FileChooser();
private FileChooser codaParamsFileChooser = new FileChooser();
private FileChooser codaJsonParamsFileChooser = new FileChooser();
Expand Down Expand Up @@ -179,22 +190,19 @@ public CodaGuiController(GeoMap mapController, WaveformClient waveformClient, En
this.paramExporter = paramExporter;
this.waveformGui = waveformGui;
this.data = data;
this.param = param;
this.shape = shape;
this.path = path;
this.site = site;
this.measuredMws = measuredMws;
this.bus = bus;
bus.register(this);

dataRefresh = data.getRefreshFunction();
paramRefresh = param.getRefreshFunction();
shapeRefresh = shape.getRefreshFunction();
pathRefresh = path.getRefreshFunction();
siteRefresh = site.getRefreshFunction();
measuredMwsRefresh = measuredMws.getRefreshFunction();
activeTabRefresh = dataRefresh;
activeTabRefresh = data.getRefreshFunction();

sacDirFileChooser.setTitle("Coda STACK File Directory");
screenshotFolderChooser.setTitle("Screenshot Export Folder");

sacFileChooser.getExtensionFilters().add(new ExtensionFilter("Coda STACK Files (.sac,.env)", "*.sac", "*.env"));
sacFileChooser.getExtensionFilters().add(allFilesFilter);

Expand Down Expand Up @@ -301,7 +309,7 @@ private void openMdacFiWindow() {

@FXML
private void runCalibration() {
calibrationClient.runCalibration(Boolean.FALSE).subscribe(value -> log.trace(value), err -> log.trace(err.getMessage(), err));
calibrationClient.runCalibration(Boolean.FALSE).doOnError(err -> log.trace(err.getMessage(), err)).subscribe();
}

@FXML
Expand All @@ -311,12 +319,14 @@ private void measureMws() {

@FXML
private void clearData() {
calibrationClient.clearData().subscribe(value -> log.trace(value), err -> log.trace(err.getMessage(), err), () -> dataRefresh.run());
calibrationClient.clearData().subscribe(val -> {
}, err -> log.trace(err.getMessage(), err), () -> data.getRefreshFunction().run());
}

@FXML
private void runAutoPickingCalibration() {
calibrationClient.runCalibration(Boolean.TRUE).subscribe(value -> log.trace(value), err -> log.trace(err.getMessage(), err));
calibrationClient.runCalibration(Boolean.TRUE).subscribe(value -> {
}, err -> log.trace(err.getMessage(), err));
}

@FXML
Expand All @@ -329,20 +339,25 @@ public void initialize() {
activeMapIcon = makeMapLabel();
showMapIcon = makeMapLabel();

addMapEnabledTabListeners(dataTab, data, dataRefresh);
snapshotButton.setGraphic(makeSnapshotLabel());
snapshotButton.setContentDisplay(ContentDisplay.CENTER);

addEnabledTabListeners(dataTab, data);
activeTabScreenshot = (folder) -> SnapshotUtils.writePng(folder, new Pair<>(dataTab.getText(), dataTab.getContent()));
data.setVisible(true);

paramTab.setOnSelectionChanged(e -> {
if (paramTab.isSelected()) {
mapController.clearIcons();
activeTabRefresh = paramRefresh;
activeTabRefresh = param.getRefreshFunction();
activeTabScreenshot = (folder) -> SnapshotUtils.writePng(folder, new Pair<>(paramTab.getText(), paramTab.getContent()));
}
});

addMapEnabledTabListeners(shapeTab, shape, shapeRefresh);
addMapEnabledTabListeners(pathTab, path, pathRefresh);
addMapEnabledTabListeners(siteTab, site, siteRefresh);
addMapEnabledTabListeners(measuredMwsTab, measuredMws, measuredMwsRefresh);
addEnabledTabListeners(shapeTab, shape);
addEnabledTabListeners(pathTab, path);
addEnabledTabListeners(siteTab, site);
addEnabledTabListeners(measuredMwsTab, measuredMws);

rootElement.setOnDragOver(event -> {
if (event.getGestureSource() != rootElement && event.getDragboard().hasFiles()) {
Expand Down Expand Up @@ -370,13 +385,22 @@ public void initialize() {

}

private void addMapEnabledTabListeners(Tab tab, MapListeningController controller, Runnable runnable) {
private void addEnabledTabListeners(Tab tab, MapListeningController controller) {
tab.setOnSelectionChanged(e -> {
if (tab.isSelected()) {
controller.setVisible(true);
controller.refreshView();
tab.setGraphic(activeMapIcon);
activeTabRefresh = runnable;
if (controller instanceof RefreshableController) {
activeTabRefresh = ((RefreshableController) controller).getRefreshFunction();
} else {
activeTabRefresh = () -> controller.refreshView();
}
if (controller instanceof ScreenshotEnabledController) {
activeTabScreenshot = ((ScreenshotEnabledController) controller).getScreenshotFunction();
} else {
activeTabScreenshot = (folder) -> SnapshotUtils.writePng(folder, new Pair<>(tab.getText(), tab.getContent()));
}
} else {
tab.setGraphic(null);
controller.setVisible(false);
Expand All @@ -389,6 +413,19 @@ private void refreshTab(ActionEvent e) {
activeTabRefresh.run();
}

@FXML
private void snapshotTab(ActionEvent e) {
File folder = screenshotFolderChooser.showDialog(rootElement.getScene().getWindow());
try {
if (folder != null && folder.exists() && folder.isDirectory() && folder.canWrite()) {
screenshotFolderChooser.setInitialDirectory(folder);
Platform.runLater(() -> activeTabScreenshot.accept(folder));
}
} catch (SecurityException ex) {
log.warn("Exception trying to write screenshots to folder {} : {}", folder, ex.getLocalizedMessage(), ex);
}
}

private Label makeMapLabel() {
Label mapLabel = new Label("\uE55B");
mapLabel.getStyleClass().add("material-icons-medium");
Expand All @@ -405,6 +442,14 @@ private Label makeRefreshLabel() {
return label;
}

private Label makeSnapshotLabel() {
Label label = new Label("\uE3B0");
label.getStyleClass().add("material-icons-medium");
label.setMaxHeight(16);
label.setMinWidth(16);
return label;
}

//TODO: Move this to a controller
@Subscribe
private void listener(CalibrationStatusEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ public WebfluxConfig(ObjectMapper objectMapper) {
@Bean
public ExchangeStrategies configureJacksonExchangeStrategies() {
return ExchangeStrategies.builder().codecs(clientCodecConfigurer -> {
clientCodecConfigurer.customCodecs().decoder(new Jackson2JsonDecoder(objectMapper));
Jackson2JsonDecoder decoder = new Jackson2JsonDecoder(objectMapper);
decoder.setMaxInMemorySize(-1);
clientCodecConfigurer.customCodecs().decoder(decoder);
clientCodecConfigurer.customCodecs().encoder(new Jackson2JsonEncoder(objectMapper));
//Unlimited
clientCodecConfigurer.defaultCodecs().maxInMemorySize(-1);
}).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import javafx.scene.control.CheckBox;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellDataFeatures;
Expand All @@ -77,6 +78,9 @@ public class DataController implements MapListeningController, RefreshableContro
@FXML
private MenuItem importWaveforms;

@FXML
private ScrollPane scrollPane;

@FXML
private TableView<Waveform> tableView;

Expand Down
Loading

0 comments on commit 0214653

Please sign in to comment.