Exemple #1
0
def errcon(n, ievt, se, prax):
    #n - number of phases used to calculate error ellipse (??)
    #ievt - boolean whether depth was fixed or free (do I know this?)
    #se - std error from origin quality
    #prax - Matrix with values:
    #[minorazimuth minorplunge minorlength;
    # interazimuth interplunge interlength;
    # majorazimuth majorplunge majorlength]
    #output - 2x2

    #     /* initialize some values */
    nFree = 8
    tol = 1.0e-15
    tol2 = 2.0e-15
    m = 3
    m1 = 2
    m2 = 4

    a = np.zeros((2, 2))
    s2 = (nFree + (n - m2) * se * se) / (nFree + n - m2)
    f10 = Fisher10(m, nFree + n - m2)
    fac = 1.0 / (m * s2 * f10)

    x = np.zeros((2, 1))
    for k in range(0, m):
        ce = np.cos(DEG2RAD * prax[k][1])
        x[0] = -ce * np.cos(DEG2RAD * prax[k][0])
        x[1] = ce * np.sin(DEG2RAD * prax[k][0])
        ce = fac * prax[k][2] * prax[k][2]
        for j in range(0, m1):
            for i in range(0, m1):
                a[j][i] = a[j][i] + ce * x[i] * x[j]

    ellipse2d = np.zeros((3, 3))
    #we're running into a problem with jacobi - namely, the diagonal values aren't exactly
    #equal (differ at 15th decimal).  We'll round them both to nearest billionth.
    a[0][1] = text.roundToNearest(a[0][1], 1e-9)
    a[1][0] = text.roundToNearest(a[0][1], 1e-9)
    eigenvalue, eigenvector, sweeps = jacobi.jacobi(a)
    idx = eigenvalue.argsort()[::-1]
    eigenvalue = eigenvalue[idx]
    eigenvector = eigenvector[:, idx]

    for i in range(0, m1):
        ce = 1.0
        if np.fabs(eigenvector[0][i]) + np.fabs(eigenvector[1][i]) > tol2:
            ellipse2d[i][0] = RAD2DEG * np.arctan2(ce * eigenvector[1][i],
                                                   -ce * eigenvector[0][i])
        if (ellipse2d[i][0] < 0.0):
            ellipse2d[i][0] += 360.0
        ellipse2d[i][2] = np.sqrt(fac * max(eigenvalue[i], 0.0))

    return ellipse2d
Exemple #2
0
def errcon(n,ievt,se,prax):
    #n - number of phases used to calculate error ellipse (??)
    #ievt - boolean whether depth was fixed or free (do I know this?)
    #se - std error from origin quality
    #prax - Matrix with values:
    #[minorazimuth minorplunge minorlength;
    # interazimuth interplunge interlength;
    # majorazimuth majorplunge majorlength]
    #output - 2x2

    #     /* initialize some values */
    nFree = 8
    tol   = 1.0e-15
    tol2  = 2.0e-15
    m     = 3
    m1    = 2
    m2    = 4

    a = np.zeros((2,2))
    s2  = (nFree + (n-m2)*se*se)/(nFree + n - m2)
    f10 = Fisher10(m, nFree + n - m2)
    fac = 1.0/(m * s2 * f10)

    x = np.zeros((2,1))
    for k in range(0,m):
        ce = np.cos(DEG2RAD * prax[k][1])
        x[0] = -ce  * np.cos(DEG2RAD * prax[k][0])
        x[1] =  ce  * np.sin(DEG2RAD * prax[k][0])
        ce   =  fac * prax[k][2] * prax[k][2]  
        for j in range(0,m1):
            for i in range(0,m1):
                a[j][i] = a[j][i] + ce * x[i] * x[j]
                
    ellipse2d = np.zeros((3,3))
    #we're running into a problem with jacobi - namely, the diagonal values aren't exactly
    #equal (differ at 15th decimal).  We'll round them both to nearest billionth.
    a[0][1] = text.roundToNearest(a[0][1],1e-9)
    a[1][0] = text.roundToNearest(a[0][1],1e-9)
    eigenvalue,eigenvector,sweeps = jacobi.jacobi(a)
    idx = eigenvalue.argsort()[::-1]
    eigenvalue = eigenvalue[idx]
    eigenvector = eigenvector[:,idx]

    for i in range(0,m1):
        ce = 1.0
        if np.fabs(eigenvector[0][i]) + np.fabs(eigenvector[1][i]) > tol2:
            ellipse2d[i][0] = RAD2DEG * np.arctan2(ce * eigenvector[1][i], -ce * eigenvector[0][i])
        if (ellipse2d[i][0] < 0.0):
            ellipse2d[i][0] += 360.0
        ellipse2d[i][2] = np.sqrt(fac * max(eigenvalue[i], 0.0))

    return ellipse2d
Exemple #3
0
def getMapLines(dmin,dmax):
    NLINES = 4
    drange = dmax-dmin
    if drange > 4:
        near = 1
    else:
        if drange >= 0.5:
            near = 0.25
        else:
            near = 0.125
    inc = roundToNearest(drange/NLINES,near)
    if inc == 0:
        near = pow(10,round(log10(drange))) #make the increment the closest power of 10
        inc = ceilToNearest(drange/NLINES,near)
        newdmin = floorToNearest(dmin,near)
        newdmax = ceilToNearest(dmax,near)
    else:
        newdmin = ceilToNearest(dmin,near)
        newdmax = floorToNearest(dmax,near)
    darray = np.arange(newdmin,newdmax,inc)
    return darray
Exemple #4
0
def getMapLines(dmin, dmax, nlines):
    drange = dmax-dmin
    if drange > 4:
        near = 1
    else:
        if drange >= 0.5:
            near = 0.25
        else:
            near = 0.125
    inc = roundToNearest(drange/nlines, near)
    if inc == 0:
        near = np.power(10, round(math.log10(drange)))  # make the increment the closest power of 10
        inc = ceilToNearest(drange/nlines, near)
        newdmin = floorToNearest(dmin, near)
        newdmax = ceilToNearest(dmax, near)
    else:
        newdmin = ceilToNearest(dmin, near)
        newdmax = floorToNearest(dmax, near)
    darray = np.arange(newdmin, newdmax+inc, inc)
    if darray[-1] > dmax:
        darray = darray[0:-1]
    return darray