Skip to content

Commit

Permalink
Merge pull request #406 from pmpowers-usgs/ngae-tests-124
Browse files Browse the repository at this point in the history
Ngae tests 124
  • Loading branch information
pmpowers-usgs authored May 5, 2019
2 parents dbf5172 + 743bea3 commit aaf9d1c
Show file tree
Hide file tree
Showing 30 changed files with 24,881 additions and 17,489 deletions.
4 changes: 2 additions & 2 deletions test/gov/usgs/earthquake/nshmp/gmm/CeusHardRock.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
@RunWith(Parameterized.class)
public class CeusHardRock extends GmmTest {

private static String GMM_INPUTS = "CEUS_vs2000_inputs.csv";
private static String GMM_RESULTS = "CEUS_vs2000_results.csv";
private static String GMM_INPUTS = "ceus-vs2000-inputs.csv";
private static String GMM_RESULTS = "ceus-vs2000-results.csv";

@Parameters(name = "{index}: {0} {2} {1}")
public static Collection<Object[]> data() throws IOException {
Expand Down
4 changes: 2 additions & 2 deletions test/gov/usgs/earthquake/nshmp/gmm/CeusSoftRock.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
@RunWith(Parameterized.class)
public class CeusSoftRock extends GmmTest {

private static String GMM_INPUTS = "CEUS_vs760_inputs.csv";
private static String GMM_RESULTS = "CEUS_vs760_results.csv";
private static String GMM_INPUTS = "ceus-vs760-inputs.csv";
private static String GMM_RESULTS = "ceus-vs760-results.csv";

@Parameters(name = "{index}: {0} {2} {1}")
public static Collection<Object[]> data() throws IOException {
Expand Down
6 changes: 3 additions & 3 deletions test/gov/usgs/earthquake/nshmp/gmm/GmmTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public abstract class GmmTest {

private static final String DATA_DIR = "data/";
private static final double TOL = 1e-6;
private static final double TOL = 1e-10;

private int index;
private Gmm gmm;
Expand Down Expand Up @@ -77,8 +77,8 @@ static void generateResults(
ScalarGroundMotion sgm = gmModel.calc(input);
String result = Parsing.join(
Lists.newArrayList(modelIndex++ + "-" + id,
String.format("%.6f", Math.exp(sgm.mean())),
String.format("%.6f", sgm.sigma())),
String.format("%.10f", Math.exp(sgm.mean())),
String.format("%.10f", sgm.sigma())),
Delimiter.COMMA);
lines.add(result);
}
Expand Down
4 changes: 2 additions & 2 deletions test/gov/usgs/earthquake/nshmp/gmm/LegacySoftRock.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class LegacySoftRock extends GmmTest {
* currently used in the 2007 Alaska NSHM.
*/

private static String GMM_INPUTS = "CEUS_vs760_inputs.csv";
private static String GMM_RESULTS = "LEGACY_vs760_results.csv";
private static String GMM_INPUTS = "ceus-vs760-inputs.csv";
private static String GMM_RESULTS = "legacy-vs760-results.csv";

@Parameters(name = "{index}: {0} {2} {1}")
public static Collection<Object[]> data() throws IOException {
Expand Down
47 changes: 47 additions & 0 deletions test/gov/usgs/earthquake/nshmp/gmm/NgaEast.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package gov.usgs.earthquake.nshmp.gmm;

import static gov.usgs.earthquake.nshmp.gmm.Gmm.NGA_EAST_USGS;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.NGA_EAST_USGS_SEEDS;
import static gov.usgs.earthquake.nshmp.gmm.Imt.PGA;
import static gov.usgs.earthquake.nshmp.gmm.Imt.SA0P02;
import static gov.usgs.earthquake.nshmp.gmm.Imt.SA0P1;
import static gov.usgs.earthquake.nshmp.gmm.Imt.SA0P2;
import static gov.usgs.earthquake.nshmp.gmm.Imt.SA1P0;
import static gov.usgs.earthquake.nshmp.gmm.Imt.SA3P0;
import static gov.usgs.earthquake.nshmp.gmm.Imt.SA5P0;
import static gov.usgs.earthquake.nshmp.gmm.Imt.SA10P0;

import java.io.IOException;
import java.util.Collection;
import java.util.EnumSet;
import java.util.Set;

import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

@SuppressWarnings("javadoc")
@RunWith(Parameterized.class)
public class NgaEast extends GmmTest {

private static String GMM_INPUTS = "nga-east-inputs.csv";
private static String GMM_RESULTS = "nga-east-results.csv";

@Parameters(name = "{index}: {0} {2} {1}")
public static Collection<Object[]> data() throws IOException {
return loadResults(GMM_RESULTS);
}

public NgaEast(int index, Gmm gmm, Imt imt, double exMedian, double exSigma) {
super(index, gmm, imt, exMedian, exSigma, GMM_INPUTS);
}

/* Result generation sets */
private static Set<Gmm> gmms = EnumSet.of(NGA_EAST_USGS, NGA_EAST_USGS_SEEDS);
private static Set<Imt> imts = EnumSet.of(PGA, SA0P02, SA0P1, SA0P2, SA1P0, SA3P0, SA5P0, SA10P0);

public static void main(String[] args) throws IOException {
GmmTest.generateResults(gmms, imts, GMM_INPUTS, GMM_RESULTS);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@

@SuppressWarnings("javadoc")
@RunWith(Parameterized.class)
public class Ngaw1 extends GmmTest {
public class NgaWest1 extends GmmTest {

private static String GMM_INPUTS = "NGA_inputs.csv";
private static String GMM_RESULTS = "NGAW1_results.csv";
private static String GMM_INPUTS = "nga-west-inputs.csv";
private static String GMM_RESULTS = "nga-west1-results.csv";

@Parameters(name = "{index}: {0} {2} {1}")
public static Collection<Object[]> data() throws IOException {
return loadResults(GMM_RESULTS);
}

public Ngaw1(int index, Gmm gmm, Imt imt, double exMedian, double exSigma) {
public NgaWest1(int index, Gmm gmm, Imt imt, double exMedian, double exSigma) {
super(index, gmm, imt, exMedian, exSigma, GMM_INPUTS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@

@SuppressWarnings("javadoc")
@RunWith(Parameterized.class)
public class Ngaw2 extends GmmTest {
public class NgaWest2 extends GmmTest {

private static String GMM_INPUTS = "NGA_inputs.csv";
private static String GMM_RESULTS = "NGAW2_results.csv";
private static String GMM_INPUTS = "nga-west-inputs.csv";
private static String GMM_RESULTS = "nga-west2-results.csv";

@Parameters(name = "{index}: {0} {2} {1}")
public static Collection<Object[]> data() throws IOException {
return loadResults(GMM_RESULTS);
}

public Ngaw2(int index, Gmm gmm, Imt imt, double exMedian, double exSigma) {
public NgaWest2(int index, Gmm gmm, Imt imt, double exMedian, double exSigma) {
super(index, gmm, imt, exMedian, exSigma, GMM_INPUTS);
}

Expand Down
4 changes: 2 additions & 2 deletions test/gov/usgs/earthquake/nshmp/gmm/SubInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
@RunWith(Parameterized.class)
public class SubInterface extends GmmTest {

private static String GMM_INPUTS = "INTERFACE_inputs.csv";
private static String GMM_RESULTS = "INTERFACE_results.csv";
private static String GMM_INPUTS = "interface-inputs.csv";
private static String GMM_RESULTS = "interface-results.csv";

@Parameters(name = "{index}: {0} {2} {1}")
public static Collection<Object[]> data() throws IOException {
Expand Down
4 changes: 2 additions & 2 deletions test/gov/usgs/earthquake/nshmp/gmm/SubSlab.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
@RunWith(Parameterized.class)
public class SubSlab extends GmmTest {

private static String GMM_INPUTS = "SLAB_inputs.csv";
private static String GMM_RESULTS = "SLAB_results.csv";
private static String GMM_INPUTS = "slab-inputs.csv";
private static String GMM_RESULTS = "slab-results.csv";

@Parameters(name = "{index}: {0} {2} {1}")
public static Collection<Object[]> data() throws IOException {
Expand Down
Loading

0 comments on commit aaf9d1c

Please sign in to comment.