Example #1
0
  private void validateStdDev(double vs30, String stdDevType, double[][] table) {
    String[] columnDescr = TABLE_HEADER_STD[0].trim().split("\\s+");
    // check for SA
    for (int i = 3; i < columnDescr.length - 2; i++) {
      for (int j = 0; j < table.length; j++) {
        double expectedStd = table[j][i];
        double computedStd = ll08AttenRel.getStdDev(i - 2, stdDevType, vs30);
        assertEquals(expectedStd, computedStd, TOLERANCE);
      }
    }
    // check for PGA
    for (int j = 0; j < table.length; j++) {
      double expectedStd = table[j][columnDescr.length - 1];
      double computedStd = ll08AttenRel.getStdDev(0, stdDevType, vs30);

      assertEquals(expectedStd, computedStd, TOLERANCE);
    }
  }
Example #2
0
 private void validateMedian(double hypoDepth, double vs30, String tectRegType, double[][] table) {
   String[] columnDescr = TABLE_HEADER_MEDIAN[0].trim().split("\\s+");
   // check for SA
   for (int i = 3; i < columnDescr.length - 1; i++) {
     for (int j = 0; j < table.length; j++) {
       int iper = i - 2;
       double mag = table[j][0];
       double rJB = table[j][1];
       double expectedMedian = table[j][i];
       double computedMedian =
           Math.exp(ll08AttenRel.getMean(iper, mag, rJB, hypoDepth, vs30, tectRegType));
       assertEquals(expectedMedian, computedMedian, TOLERANCE);
     }
   }
   // check for PGA
   for (int j = 0; j < table.length; j++) {
     double mag = table[j][0];
     double rJB = table[j][1];
     double expectedMedian = table[j][columnDescr.length - 1];
     double computedMedian =
         Math.exp(ll08AttenRel.getMean(0, mag, rJB, hypoDepth, vs30, tectRegType));
     assertEquals(expectedMedian, computedMedian, TOLERANCE);
   }
 }
Example #3
0
  /** Set up attenuation relationship object, and tables for tests. */
  @Before
  public final void setUp() throws Exception {

    ll08AttenRel = new LL_2008_AttenRel(this);
    ll08AttenRel.setParamDefaults();

    stdRockTable = new double[TABLE_NUM_ROWS][TABLE_NUM_COL_STD];
    AttenRelTestHelper.readNumericTableWithHeader(
        new File(ClassLoader.getSystemResource(SIGMA_TOTAL_ROCK_TABLE).toURI()),
        stdRockTable,
        TABLE_HEADER_STD);

    stdSoftTable = new double[TABLE_NUM_ROWS][TABLE_NUM_COL_STD];
    AttenRelTestHelper.readNumericTableWithHeader(
        new File(ClassLoader.getSystemResource(SIGMA_TOTAL_SOFT_TABLE).toURI()),
        stdSoftTable,
        TABLE_HEADER_STD);

    medianInslabRockTable = new double[TABLE_NUM_ROWS][TABLE_NUM_COL];
    AttenRelTestHelper.readNumericTableWithHeader(
        new File(ClassLoader.getSystemResource(MEDIAN_INSLAB_ROCK_TABLE).toURI()),
        medianInslabRockTable,
        TABLE_HEADER_MEDIAN);

    medianInslabSoftTable = new double[TABLE_NUM_ROWS][TABLE_NUM_COL];
    AttenRelTestHelper.readNumericTableWithHeader(
        new File(ClassLoader.getSystemResource(MEDIAN_INSLAB_SOFT_TABLE).toURI()),
        medianInslabSoftTable,
        TABLE_HEADER_MEDIAN);

    medianInterfaceRockTable = new double[TABLE_NUM_ROWS][TABLE_NUM_COL];
    AttenRelTestHelper.readNumericTableWithHeader(
        new File(ClassLoader.getSystemResource(MEDIAN_INTERFACE_ROCK_TABLE).toURI()),
        medianInterfaceRockTable,
        TABLE_HEADER_MEDIAN);

    medianInterfaceSoftTable = new double[TABLE_NUM_ROWS][TABLE_NUM_COL];
    AttenRelTestHelper.readNumericTableWithHeader(
        new File(ClassLoader.getSystemResource(MEDIAN_INTERFACE_SOFT_TABLE).toURI()),
        medianInterfaceSoftTable,
        TABLE_HEADER_MEDIAN);
  }