Skip to content

Commit

Permalink
CCT 1.0.6 Bugfixes and stability release.
Browse files Browse the repository at this point in the history
Site calibration incorrectly handled weighting when three conditions are met on loaded data, see SiteCalibrationServiceImplTest.java for details.
Envelope tool was not blocking correctly while file IO was finishing which could lead to dropped channels during stacking under certain circumstances.
Envelope tool was interpolating too early in the processing chain and producing oversmoothing if using the default configuration.
Fixed a series of unnecessary overhead objects being created during signal processing which was using more RAM than needed (especially noticable while making envelopes).
Fixed a very rare synchronization bug with map icon painting.
Fixed a path optimization dimension mismatch introduced by parallelizing code that was incorrectly caching a shared variable.
  • Loading branch information
justinbarno committed Aug 22, 2019
1 parent b45fa48 commit 2e33bbf
Show file tree
Hide file tree
Showing 40 changed files with 408 additions and 92 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.5-runnable.jar
java -jar coda-calibration/calibration-standalone/target/calibration-standalone-1.0.6-runnable.jar
```

#### **GUI alone**

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

```shell
java -jar coda-calibration/calibration-service/application/target/application-1.0.5-runnable.jar
java -jar coda-calibration/calibration-service/application/target/application-1.0.6-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.5</version>
<version>1.0.6</version>
</parent>

<artifactId>calibration-gui</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void setWaveform(Waveform waveform, SyntheticCoda synth) {
this.clear();
pickLineMap.clear();

if (waveform != null && waveform.getSegment() != null && waveform.getBeginTime() != null) {
if (waveform != null && waveform.hasData() && waveform.getBeginTime() != null) {
final TimeT beginTime = new TimeT(waveform.getBeginTime());
final float[] waveformSegment = doublesToFloats(waveform.getSegment());
final TimeSeries rawSeries = new TimeSeries(waveformSegment, waveform.getSampleRate(), beginTime);
Expand Down Expand Up @@ -200,7 +200,7 @@ public void setWaveform(Waveform waveform, SyntheticCoda synth) {
try {
velocityClient.getNoiseForWaveform(waveform.getId()).subscribe(measurement -> {
if (measurement != null && measurement.getNoiseEndSecondsFromOrigin() != 0.0) {
int lineLength = (int) (waveform.getSegment().length / waveform.getSampleRate()) + 10;
int lineLength = (int) (waveform.getSegmentLength() / waveform.getSampleRate()) + 10;
subplot.AddPlotObject(createFixedLine(measurement.getNoiseLevel(), lineLength, Color.BLACK, PenStyle.DASH), PLOT_ORDERING.NOISE_LINE.getZOrder());
subplot.AddPlotObject(createFixedLine(measurement.getNoiseLevel() + params.getMinSnr(), lineLength, Color.BLACK, PenStyle.SOLID), PLOT_ORDERING.NOISE_LINE.getZOrder());
repaint();
Expand Down
2 changes: 1 addition & 1 deletion calibration-service/calibration-application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>calibration-service</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion calibration-service/calibration-integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>calibration-service</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion calibration-service/calibration-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>calibration-service</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion calibration-service/calibration-repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>calibration-service</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion calibration-service/calibration-service-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>calibration-service</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion calibration-service/calibration-service-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>calibration-service</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class Joint1DPathCorrection implements PathCalibrationService {

private static final double efact = Math.log10(Math.E);
private PathCalibrationMeasurementService pathCalibrationMeasurementService;
private List<double[]> paramPoints;

@Value(value = "${path.use-aggressive-opt:true}")
private boolean agressiveOptimization;

Expand Down Expand Up @@ -387,9 +387,6 @@ public double costFunction(Map<Event, Map<Station, SpectraMeasurement>> evidStaD
* if optimizationBounds.length < 2
*/
private List<double[]> makeParamPoints(int numberOfTerms, boolean agressiveOptimization, double[]... optimizationBounds) {
if (paramPoints != null && !paramPoints.isEmpty() && paramPoints.get(0).length == numberOfTerms) {
return paramPoints;
}
if (optimizationBounds.length < 2) {
throw new IllegalStateException("Optmization bounds needs at least two entries for the low and high boundary conditions. Got: " + optimizationBounds.length);
}
Expand Down Expand Up @@ -421,8 +418,7 @@ private List<double[]> makeParamPoints(int numberOfTerms, boolean agressiveOptim
params.add(param);
}

paramPoints = params;
return paramPoints;
return params;
}

private int[] nextIndex(int[] selectionIndex, int base) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.util.stream.Collectors;

import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand All @@ -48,6 +50,8 @@
@Service
public class SiteCalibrationServiceImpl implements SiteCalibrationService {

private static final Logger log = LoggerFactory.getLogger(SiteCalibrationServiceImpl.class);

private static final double UNUSED_DISTANCE = -1d;
private static final double DYNE_LOG10_ADJUSTMENT = 7d;
private MdacCalculatorService mdac;
Expand Down Expand Up @@ -131,7 +135,7 @@ public Map<FrequencyBand, Map<Station, SiteFrequencyBandParameters>> measureSite
double centerFreq = (highFreq + lowFreq) / 2;
for (Entry<Event, Map<Station, SpectraMeasurement>> staMwMap : evidStaMap.getValue().entrySet()) {
Event evid = staMwMap.getKey();
if (refMws.containsKey(evid.getEventId())) {
if (refMws != null && refMws.containsKey(evid.getEventId())) {
List<ReferenceMwParameters> refMwsParams = refMws.get(evid.getEventId());
ReferenceMwParameters refMw = refMwsParams.stream().findFirst().orElse(null);
if (refMw != null) {
Expand Down Expand Up @@ -163,6 +167,7 @@ public Map<FrequencyBand, Map<Station, SiteFrequencyBandParameters>> measureSite
}
}
}
weightFunctionMapByEvent.putIfAbsent(evid, this::lowerFreqHigherWeights);
}
}

Expand Down Expand Up @@ -195,9 +200,6 @@ public Map<FrequencyBand, Map<Station, SiteFrequencyBandParameters>> measureSite
Event evid = evidStaEntry.getKey();
if (averageMapByEvent.containsKey(evid) && averageMapByEvent.get(evid).containsKey(freqBand)) {
for (Entry<Station, SpectraMeasurement> staMwEntry : evidStaEntry.getValue().entrySet()) {
if (!weightFunctionMapByEvent.containsKey(evid)) {
weightFunctionMapByEvent.put(evid, this::lowerFreqHigherWeights);
}
double amp = staMwEntry.getValue().getPathCorrected();
if (!staFreqBandSiteCorrectionMapAverage.containsKey(staMwEntry.getKey())) {
staFreqBandSiteCorrectionMapAverage.put(staMwEntry.getKey(), new HashMap<FrequencyBand, SummaryStatistics>());
Expand Down Expand Up @@ -315,10 +317,48 @@ public static Map<FrequencyBand, Map<Event, Map<Station, SpectraMeasurement>>> m
}
Map<Station, SpectraMeasurement> stationMap = eventMap.get(event);
stationMap.put(station, entry);
} else {
log.debug("No valid waveform for {}", entry);
}
}
}
}
return data;
}

public MdacCalculatorService getMdac() {
return mdac;
}

public SiteCalibrationServiceImpl setMdac(MdacCalculatorService mdac) {
this.mdac = mdac;
return this;
}

public SiteFrequencyBandParametersService getSiteParamsService() {
return siteParamsService;
}

public SiteCalibrationServiceImpl setSiteParamsService(SiteFrequencyBandParametersService siteParamsService) {
this.siteParamsService = siteParamsService;
return this;
}

public MeasuredMwsService getMeasuredMwsService() {
return measuredMwsService;
}

public SiteCalibrationServiceImpl setMeasuredMwsService(MeasuredMwsService measuredMwsService) {
this.measuredMwsService = measuredMwsService;
return this;
}

public SpectraCalculator getSpectraCalc() {
return spectraCalc;
}

public SiteCalibrationServiceImpl setSpectraCalc(SpectraCalculator spectraCalc) {
this.spectraCalc = spectraCalc;
return this;
}
}
Loading

0 comments on commit 2e33bbf

Please sign in to comment.