Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * Sets the percentiles used to compute clips for this view. The default percentiles are 0.0 and
  * 100.0, which correspond to the minimum and maximum values in the array of values to be clipped.
  *
  * <p>Calling this method enables the computation of clips from percentiles. Any clip min and max
  * specified or computed previously will be forgotten.
  *
  * <p>Clip min and max values can only be computed if an array of values has been specified. If
  * clips were constructed without such an array, then both percentiles and an array of values
  * should be set to enable the use of percentiles.
  *
  * @param percMin the percentile corresponding to clipMin.
  * @param percMax the percentile corresponding to clipMax.
  */
 public void setPercentiles(double percMin, double percMax) {
   Check.argument(0.0 <= percMin, "0<=percMin");
   Check.argument(percMin < percMax, "percMin<percMax");
   Check.argument(percMax <= 100.0, "percMax<=100");
   if (_percMin != (float) percMin || _percMax != (float) percMax || !_usePercentiles) {
     _usePercentiles = true;
     _percMin = (float) percMin;
     _percMax = (float) percMax;
     _clipsDirty = true;
   }
 }
Exemplo n.º 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 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;
 }
Exemplo n.º 4
0
 /**
  * Sets the clip min and max values explicitly. Calling this method disables the computation of
  * clips from percentiles. Any clip values computed or specified previously will be forgotten.
  *
  * @param clipMin values &lt; clipMin will be clipped to clipMin.
  * @param clipMax values &gt; clipMax will be clipped to clipMax.
  */
 public void setClips(double clipMin, double clipMax) {
   Check.argument(clipMin < clipMax, "clipMin<clipMax");
   if (_clipMin != (float) clipMin || _clipMax != (float) clipMax || _usePercentiles) {
     _usePercentiles = false;
     _clipMin = (float) clipMin;
     _clipMax = (float) clipMax;
     _clipsDirty = false;
   }
 }
Exemplo n.º 5
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;
  }