Exemple #1
0
 /**
  * Computes gammaS, a measure of the time delay between two split shear waves, from shifts between
  * PP-PS2 {@code u2} and PS1-PS2 {@code uS}.
  *
  * @param sf PP time Sampling.
  * @param u2 shifts between PP-PS2 in PP time.
  * @param uS shifts between PS1-PS2 in PP time.
  * @return gammaS
  */
 public static float[] gammaSu2S(Sampling sf, float[] u2, float[] uS) {
   int n1 = u2.length;
   Check.argument(n1 == sf.getCount(), "u2 consistent with sampling");
   Check.argument(n1 == uS.length, "u2.length==uS.length");
   float[] du2 = firstDerivative(sf, u2);
   float[] duS = firstDerivative(sf, uS);
   float[] gs = new float[n1];
   for (int i1 = 0; i1 < n1; i1++) gs[i1] = (2.0f * duS[i1]) / (1.0f + 2.0f * (du2[i1] - duS[i1]));
   return gs;
 }
Exemple #2
0
 /**
  * Computes the NRMS value of the warped PS trace {@code h} and the PP trace {@code f}. The NRMS
  * value is the RMS of the difference between {@code f} and {@code h} divided by the average RMS
  * of {@code f} and {@code h}.
  *
  * @param n1Max the length of {@code f} and {@code h} to use for this computation.
  * @param f the PP trace.
  * @param h the warped PS trace.
  * @return the NRMS value, this measure is between 0.0 and 2.0.
  */
 public static float computeNrms(int n1Max, float[] f, float[] h) {
   int n1f = f.length;
   int n1h = h.length;
   Check.argument(n1Max <= n1f, "n1Max<=n1f");
   Check.argument(n1Max <= n1h, "n1Max<=n1h");
   float[] fs = copy(n1Max, f);
   float[] hs = copy(n1Max, h);
   float scale = 1.0f / n1Max;
   float[] d = sub(hs, fs);
   float frms = sqrt(sum(mul(fs, fs)) * scale);
   float hrms = sqrt(sum(mul(hs, hs)) * scale);
   float drms = sqrt(sum(mul(d, d)) * scale);
   float nrms = (2.0f * drms) / (frms + hrms);
   return nrms;
 }
Exemple #3
0
  /**
   * Computes the NRMS value of the warped PS trace {@code h} and the PP trace {@code f}. The NRMS
   * value is the RMS of the difference between {@code f} and {@code h} divided by the average RMS
   * of {@code f} and {@code h}.
   *
   * @param n1Max the length of {@code f} and {@code h} to use for this computation.
   * @param f the PP traces.
   * @param h the warped PS traces.
   * @return the NRMS value, this measure is between 0.0 and 2.0.
   */
  public static float computeNrms(final int n1Max, final float[][][] f, final float[][][] h) {
    int n1f = f[0][0].length;
    int n1h = h[0][0].length;
    Check.argument(n1Max <= n1f, "n1Max<=n1f");
    Check.argument(n1Max <= n1h, "n1Max<=n1h");
    final int n3 = f.length;
    final int n2 = f[0].length;
    final int n23 = n2 * n3;
    float scale = 1.0f / (n1Max * n23);
    float[] rms =
        Parallel.reduce(
            n23,
            new Parallel.ReduceInt<float[]>() {
              @Override
              public float[] compute(int i23) {
                int i2 = i23 % n2;
                int i3 = i23 / n2;
                float[] fhdSq = new float[3];
                for (int i1 = 0; i1 < n1Max; i1++) {
                  float fv = f[i3][i2][i1];
                  float hv = h[i3][i2][i1];
                  fhdSq[0] += fv * fv;
                  fhdSq[1] += hv * hv;
                  fhdSq[2] += (hv - fv) * (hv - fv);
                }
                return fhdSq;
              }

              @Override
              public float[] combine(float[] fhdSq1, float[] fhdSq2) {
                float[] rms = new float[3];
                rms[0] = fhdSq1[0] + fhdSq2[0];
                rms[1] = fhdSq1[1] + fhdSq2[1];
                rms[2] = fhdSq1[2] + fhdSq2[2];
                return rms;
              }
            });
    float frms = sqrt(rms[0] * scale);
    float hrms = sqrt(rms[1] * scale);
    float drms = sqrt(rms[2] * scale);
    float nrms = (2.0f * drms) / (frms + hrms);
    return nrms;
  }