Skip to content

Commit d9ade7d

Browse files
committed
* Updated to Spring 6
* Spectral inversion results in CERT are now plotted as misfit in mean absolute deviation * CERT spectra now includes calculated HFL/LFL values for inversions and, if available, CCT magnitudes HFL/LFL reference lines * Added function to set user-specified high and low frequency asymptotes to the spectral ratio plot and include them in the exported report if they are available. These buttons can be found in the modebar on the top-right of the spectra ratio plot. * Updated the spectra download functions so that event report information, including the inversion results and user set frequency values will be exported in the .json file. * Changes to validation events to remove them also from the site correction re-averaging during calibrations. * Add path corrected plot back in to site tab, co-located with the raw amplitude plot. * Plots for the CERT module have been updated and reworked in many cases to clean up and/or add additional information or interactivity.
1 parent 63a3585 commit d9ade7d

File tree

1,621 files changed

+199316
-438651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,621 files changed

+199316
-438651
lines changed

.github/workflows/maven-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v3
19-
- name: Set up JDK 11
19+
- name: Set up JDK 17
2020
uses: actions/setup-java@v3
2121
with:
22-
java-version: '11'
22+
java-version: '17'
2323
distribution: 'adopt'
2424
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
2525
settings-path: ${{ github.workspace }} # location for the settings.xml file

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ mvn clean install
5151
#### **As a single runnable JAR**
5252

5353
```shell
54-
java -jar coda-calibration/calibration-standalone/target/calibration-standalone-1.0.20-runnable.jar
54+
java -jar coda-calibration/calibration-standalone/target/calibration-standalone-1.0.22-runnable.jar
5555
```
5656

5757
#### **GUI alone**
5858

5959
```shell
60-
java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.20-runnable.jar
60+
java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.22-runnable.jar
6161
```
6262

6363
#### **Calibration REST service alone**
6464

6565
```shell
66-
java -jar coda-calibration/calibration-service/application/target/application-1.0.20-runnable.jar
66+
java -jar coda-calibration/calibration-service/application/target/application-1.0.22-runnable.jar
6767
```
6868

6969
#### A note about HTTPS

calibration-gui/pom.xml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="https://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
35
<modelVersion>4.0.0</modelVersion>
46

57
<parent>
68
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
79
<artifactId>coda-calibration</artifactId>
8-
<version>1.0.21.1</version>
10+
<version>1.0.22</version>
911
</parent>
1012

1113
<artifactId>calibration-gui</artifactId>
@@ -52,10 +54,6 @@
5254
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
5355
<artifactId>calibration-model</artifactId>
5456
<exclusions>
55-
<exclusion>
56-
<groupId>org.eclipse.persistence</groupId>
57-
<artifactId>javax.persistence</artifactId>
58-
</exclusion>
5957
<exclusion>
6058
<groupId>org.aspectj</groupId>
6159
<artifactId>aspectjweaver</artifactId>
@@ -69,8 +67,8 @@
6967
<artifactId>spring-aspects</artifactId>
7068
</exclusion>
7169
<exclusion>
72-
<groupId>javax.validation</groupId>
73-
<artifactId>validation-api</artifactId>
70+
<groupId>jakarta.validation</groupId>
71+
<artifactId>jakarta.validation-api</artifactId>
7472
</exclusion>
7573
<exclusion>
7674
<groupId>org.springframework.data</groupId>
@@ -95,7 +93,6 @@
9593
<groupId>org.springframework.boot</groupId>
9694
<artifactId>spring-boot-starter-webflux</artifactId>
9795
</dependency>
98-
9996
<dependency>
10097
<groupId>org.springframework</groupId>
10198
<artifactId>spring-test</artifactId>
@@ -177,6 +174,8 @@
177174
<artifactId>maven-dependency-plugin</artifactId>
178175
<executions>
179176
<execution>
177+
<!-- Tells Eclipses m2e adapter to only execute this when using the maven->update project button -->
178+
<?m2eexecute onConfiguration?>
180179
<goals>
181180
<goal>unpack</goal>
182181
</goals>
@@ -207,6 +206,10 @@
207206
<plugin>
208207
<groupId>org.apache.maven.plugins</groupId>
209208
<artifactId>maven-compiler-plugin</artifactId>
209+
<configuration>
210+
<source>${java.version}</source>
211+
<target>${java.version}</target>
212+
</configuration>
210213
</plugin>
211214
<plugin>
212215
<groupId>org.apache.maven.plugins</groupId>
@@ -221,7 +224,8 @@
221224
<Implementation-Build>${buildNumber}</Implementation-Build>
222225
<Build-Branch>${scmBranch}</Build-Branch>
223226
<Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
224-
<JavaFX-Preloader-Class>gov.llnl.gnem.apps.coda.calibration.gui.CodaGuiPreloader</JavaFX-Preloader-Class>
227+
<JavaFX-Preloader-Class>
228+
gov.llnl.gnem.apps.coda.calibration.gui.CodaGuiPreloader</JavaFX-Preloader-Class>
225229
</manifestEntries>
226230
</archive>
227231
</configuration>

calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/CodaGuiController.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.util.concurrent.TimeUnit;
2828
import java.util.function.Consumer;
2929

30-
import javax.annotation.PreDestroy;
3130
import javax.net.ssl.HostnameVerifier;
3231
import javax.net.ssl.SSLContext;
3332

@@ -80,6 +79,7 @@
8079
import gov.llnl.gnem.apps.coda.envelope.gui.LoadRatioEventsGuiController;
8180
import gov.llnl.gnem.apps.coda.spectra.gui.RatioStatusProgressListener;
8281
import gov.llnl.gnem.apps.coda.spectra.gui.SpectraRatioGuiController;
82+
import jakarta.annotation.PreDestroy;
8383
import javafx.application.Platform;
8484
import javafx.concurrent.Worker;
8585
import javafx.event.ActionEvent;
@@ -112,7 +112,7 @@ public class CodaGuiController {
112112

113113
private static final String SCREENSHOT_TITLE = "CERT_Screenshot";
114114

115-
private static final String ABOUT_TEXT = "Version 1.0.21";
115+
private static final String ABOUT_TEXT = "Version 1.0.22";
116116

117117
@FXML
118118
private Node rootElement;
@@ -313,17 +313,21 @@ private void changeAppMode() {
313313
refreshButton.setGraphic(refreshLabel);
314314
});
315315
} else {
316+
activeTabRefresh = data.getRefreshFunction();
317+
316318
spectraGui.loadEnvelopes();
317319
siteTab.setOnSelectionChanged(e -> {
318320
if (siteTab.isSelected()) {
319321
activeTabRefresh = eventTableRefreshFunction;
322+
activeTabRefresh.run();
320323
activeTabScreenshot = basicPngScreenshot(siteTab);
321324
} else {
322325
siteTab.setGraphic(null);
323326
}
324327
});
325328

326329
Platform.runLater(() -> {
330+
dataTab.setGraphic(activeMapIcon);
327331
mainTabPane.getTabs().remove(shapeTab);
328332
mainTabPane.getTabs().remove(pathTab);
329333
mainTabPane.getTabs().remove(measuredMwsTab);
@@ -509,7 +513,7 @@ private void runCalibration() {
509513

510514
@FXML
511515
private void measureMws() {
512-
measuredMws.getRefreshFunction().run();
516+
Platform.runLater(measuredMws::reload);
513517
}
514518

515519
@FXML
@@ -550,12 +554,8 @@ public void initialize() {
550554
snapshotButton.setGraphic(makeSnapshotLabel());
551555
snapshotButton.setContentDisplay(ContentDisplay.CENTER);
552556

553-
addEnabledTabListeners(dataTab, data);
554-
555557
activeTabScreenshot = folder -> SnapshotUtils.writePng(folder, new Pair<>(dataTab.getText(), dataTab.getContent()));
556558

557-
data.setVisible(true);
558-
559559
paramTab.setOnSelectionChanged(e -> {
560560
if (paramTab.isSelected()) {
561561
cctMapController.clearIcons();
@@ -565,6 +565,9 @@ public void initialize() {
565565
}
566566
});
567567

568+
data.setVisible(true);
569+
addEnabledTabListeners(dataTab, data);
570+
568571
if (GuiApplication.getStartupMode() == ApplicationMode.CCT) {
569572
dataTab.setGraphic(activeMapIcon);
570573
addEnabledTabListeners(shapeTab, shape);
@@ -575,12 +578,14 @@ public void initialize() {
575578
siteTab.setOnSelectionChanged(e -> {
576579
if (siteTab.isSelected()) {
577580
activeTabRefresh = eventTableRefreshFunction;
581+
activeTabRefresh.run();
578582
activeTabScreenshot = basicPngScreenshot(siteTab);
579583
} else {
580584
siteTab.setGraphic(null);
581585
}
582586
});
583587
Platform.runLater(() -> {
588+
dataTab.setGraphic(activeMapIcon);
584589
mainTabPane.getTabs().remove(shapeTab);
585590
mainTabPane.getTabs().remove(pathTab);
586591
mainTabPane.getTabs().remove(measuredMwsTab);
@@ -657,6 +662,9 @@ private Consumer<File> basicPngScreenshot(Tab tab) {
657662
@FXML
658663
private void refreshTab(ActionEvent e) {
659664
activeTabRefresh.run();
665+
if (rootElement.getParent() != null) {
666+
rootElement.getParent().requestLayout();
667+
}
660668
}
661669

662670
@FXML

calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/GuiApplication.java

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,13 @@
1616

1717
import java.io.IOException;
1818
import java.io.InputStream;
19-
import java.net.URL;
2019
import java.util.Locale;
2120
import java.util.TimeZone;
2221
import java.util.concurrent.CancellationException;
2322
import java.util.concurrent.CompletableFuture;
2423
import java.util.concurrent.ExecutionException;
2524
import java.util.concurrent.TimeUnit;
2625
import java.util.concurrent.TimeoutException;
27-
import java.util.jar.Attributes;
28-
import java.util.jar.Manifest;
29-
30-
import javax.annotation.PostConstruct;
3126

3227
import org.slf4j.Logger;
3328
import org.slf4j.LoggerFactory;
@@ -43,6 +38,7 @@
4338
import gov.llnl.gnem.apps.coda.calibration.gui.events.CalibrationStageShownEvent;
4439
import gov.llnl.gnem.apps.coda.common.gui.SimpleGuiPreloader;
4540
import gov.llnl.gnem.apps.coda.common.gui.util.CommonGuiUtils;
41+
import jakarta.annotation.PostConstruct;
4642
import javafx.application.Application;
4743
import javafx.application.Platform;
4844
import javafx.fxml.FXMLLoader;
@@ -137,43 +133,14 @@ public void start(Stage primaryStage) throws Exception {
137133
Hooks.onOperatorDebug();
138134
}
139135

140-
try {
141-
Class<GuiApplication> clazz = GuiApplication.class;
142-
String className = clazz.getSimpleName() + ".class";
143-
String classPath = clazz.getResource(className).toString();
144-
String baseTitle = "";
145-
146-
if (GuiApplication.getStartupMode() == ApplicationMode.CCT) {
147-
baseTitle = CCT_TITLE;
148-
} else {
149-
baseTitle = CERT_TITLE;
150-
}
151-
152-
if (classPath.startsWith("jar")) {
153-
String manifestPath = classPath.substring(0, classPath.indexOf('!') + 1) + "/META-INF/MANIFEST.MF";
154-
Manifest mf = new Manifest(new URL(manifestPath).openStream());
155-
Attributes atts = mf.getMainAttributes();
156-
// Put this info in the log to help with analysis
157-
log.debug(
158-
"Version:{} Commit:{} Branch:{} By:{} at {}",
159-
atts.getValue("Implementation-Version"),
160-
atts.getValue("Implementation-Build"),
161-
atts.getValue("Build-Branch"),
162-
atts.getValue("Built-By"),
163-
atts.getValue("Build-Timestamp"));
164-
// Update the title bar
165-
baseTitle += " Built at " + atts.getValue("Build-Timestamp");
166-
} else {
167-
// Class not from JAR
168-
log.debug("{} not running from a jar.", baseTitle);
169-
}
170-
props.setBaseTitle(baseTitle);
171-
} catch (IOException e) {
172-
// should never happen...
173-
log.error("Failed initializing!", e);
136+
String baseTitle = "";
137+
if (GuiApplication.getStartupMode() == ApplicationMode.CCT) {
138+
baseTitle = CCT_TITLE;
139+
} else {
140+
baseTitle = CERT_TITLE;
174141
}
175142

176-
Platform.setImplicitExit(true);
143+
props.setBaseTitle(baseTitle);
177144
FXMLLoader fxmlLoader = null;
178145

179146
if (startupMode == ApplicationMode.CERT) {
@@ -199,7 +166,6 @@ public void start(Stage primaryStage) throws Exception {
199166
}
200167

201168
static public void changeApplicationMode() {
202-
203169
if (GuiApplication.getStartupMode() == ApplicationMode.CCT) {
204170
GuiApplication.startupMode = ApplicationMode.CERT;
205171
} else {
@@ -224,6 +190,7 @@ static public void changeApplicationMode() {
224190
try {
225191
Parent root = fxmlLoader.load();
226192
Platform.runLater(() -> {
193+
Font.loadFont(GuiApplication.class.getResource("/fxml/MaterialIcons-Regular.ttf").toExternalForm(), 18);
227194
primaryStage.setTitle(props.getBaseTitle());
228195
Scene scene = new Scene(root, props.getHeight(), props.getWidth());
229196
primaryStage.setScene(scene);

calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/WebfluxConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.fasterxml.jackson.databind.ObjectMapper;
2626
import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
2727
import com.fasterxml.jackson.databind.module.SimpleModule;
28+
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
2829

2930
import gov.llnl.gnem.apps.coda.calibration.model.domain.SiteFrequencyBandParameters;
3031
import gov.llnl.gnem.apps.coda.calibration.model.domain.SpectraMeasurementMetadata;
@@ -43,6 +44,7 @@ public class WebfluxConfig {
4344
@Autowired
4445
public WebfluxConfig(ObjectMapper objectMapper) {
4546
this.objectMapper = objectMapper;
47+
this.objectMapper.registerModule(new Jdk8Module());
4648
this.objectMapper.addMixIn(SharedFrequencyBandParameters.class, SharedFrequencyBandParametersJsonMixin.class);
4749
this.objectMapper.addMixIn(SiteFrequencyBandParameters.class, SiteFrequencyBandParametersJsonMixin.class);
4850

calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/AbstractMeasurementController.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ protected void reloadData() {
920920
for (final SpectraMeasurement meas : spectralMeasurements) {
921921
final String evid = meas.getWaveform().getEvent().getEventId();
922922
final Double freq = centerFreq(meas.getWaveform());
923-
evidStats.computeIfAbsent(evid, key -> new HashMap<>()).computeIfAbsent(freq, key -> new SummaryStatistics()).addValue(meas.getPathAndSiteCorrected());
923+
evidStats.computeIfAbsent(evid, key -> new HashMap<>()).computeIfAbsent(freq, key -> new SummaryStatistics()).addValue(meas.getPathAndSiteCorrected() - 7.0);
924924
}
925925

926926
for (final Map<Double, SummaryStatistics> freqStats : evidStats.values()) {
@@ -1048,7 +1048,7 @@ private List<EventSpectraReport> getFormattedValues(String eventId, List<Spectra
10481048
if (!eventId.equalsIgnoreCase("All")) {
10491049
filteredMeasurements = filterToEvent(eventId, measurements);
10501050
}
1051-
Map<String, Map<Double, Double>> averageValues = new HashMap<>();
1051+
Map<String, Map<Double, SummaryStatistics>> averageValues = new HashMap<>();
10521052
for (SpectraMeasurement meas : filteredMeasurements) {
10531053
String key = meas.getWaveform().getEvent().getEventId()
10541054
+ "-"
@@ -1063,17 +1063,20 @@ private List<EventSpectraReport> getFormattedValues(String eventId, List<Spectra
10631063
new ArrayList<>()));
10641064

10651065
Double freq = centerFreq(meas.getWaveform());
1066-
valuesMap.get(key).add(new Pair<>(freq, meas.getPathAndSiteCorrected()));
1067-
averageValues.computeIfAbsent(meas.getWaveform().getEvent().getEventId(), k -> new TreeMap<>()).merge(freq, meas.getPathAndSiteCorrected(), (l, r) -> (l + r) / 2.0);
1066+
valuesMap.get(key).add(new Pair<>(freq, meas.getPathAndSiteCorrected() - 7.0));
1067+
averageValues.computeIfAbsent(meas.getWaveform().getEvent().getEventId(), k -> new TreeMap<>()).computeIfAbsent(freq, x -> {
1068+
SummaryStatistics sum = new SummaryStatistics();
1069+
return sum;
1070+
}).addValue(meas.getPathAndSiteCorrected() - 7.0);
10681071
}
10691072

1070-
for (Entry<String, Map<Double, Double>> average : averageValues.entrySet()) {
1073+
for (Entry<String, Map<Double, SummaryStatistics>> average : averageValues.entrySet()) {
10711074
valuesMap.put(
10721075
"Average-" + average.getKey(),
10731076
new EventSpectraReport(average.getKey(),
10741077
null,
10751078
"Average",
1076-
average.getValue().entrySet().stream().map(e -> new Pair<>(e.getKey(), e.getValue())).collect(Collectors.toList())));
1079+
average.getValue().entrySet().stream().map(e -> new Pair<>(e.getKey(), e.getValue().getMean())).collect(Collectors.toList())));
10771080
}
10781081
}
10791082
return new ArrayList<>(valuesMap.values());

calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/CodaParamLoadingController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.slf4j.LoggerFactory;
2828
import org.springframework.beans.factory.annotation.Autowired;
2929
import org.springframework.stereotype.Component;
30-
import org.w3c.dom.events.Event;
3130

3231
import com.fasterxml.jackson.core.JsonProcessingException;
3332
import com.google.common.eventbus.EventBus;
@@ -46,6 +45,7 @@
4645
import gov.llnl.gnem.apps.coda.calibration.model.domain.ValidationMwParameters;
4746
import gov.llnl.gnem.apps.coda.calibration.model.domain.VelocityConfiguration;
4847
import gov.llnl.gnem.apps.coda.common.gui.converters.api.FileToWaveformConverter;
48+
import gov.llnl.gnem.apps.coda.common.model.domain.Event;
4949
import gov.llnl.gnem.apps.coda.common.model.domain.SharedFrequencyBandParameters;
5050
import reactor.core.publisher.Mono;
5151

0 commit comments

Comments
 (0)