コード例 #1
0
def test_prolate_ellipsoid_copy():
    'Check the elements of a duplicated ellipsoid'
    orig = ProlateEllipsoid(31, 2, 83, 56, 54, 1, 29, 70,
                            props={'remanent magnetization': [10, 25, 40],
                                   'principal susceptibilities': [0.562, 0.485,
                                                                  -0.25],
                                   'susceptibility angles': [90, 0, 0]})
    cp = orig.copy()
    assert orig is not cp
    assert orig.x == cp.x
    assert orig.y == cp.y
    assert orig.z == cp.z
    assert orig.large_axis == cp.large_axis
    assert orig.small_axis == cp.small_axis
    assert orig.props == cp.props

    cp.x = 4
    cp.y = 6
    cp.z = 7
    cp.props['principal susceptibilities'] = [0.7, 0.9, 1]
    assert orig.x != cp.x
    assert orig.y != cp.y
    assert orig.z != cp.z
    assert orig.props['principal susceptibilities'] != \
        cp.props['principal susceptibilities']
コード例 #2
0
def test_confocal_prolate_ellipsoids():
    "Confocal bodies with properly scaled suscep produce the same field"
    # Reference ellipsoid
    a, b, = 1000., 400.  # semi-axes
    chi = 1.2  # reference susceptibility
    ellipsoid = ProlateEllipsoid(
        0., 0., 1500., a, b, 45., 10., -30., {
            'principal susceptibilities': [chi, chi, chi],
            'susceptibility angles': [0., 0., 0.]
        })
    # Intensity of the local-geomagnetic field (in nT)
    B0 = 23500.
    # Direction parallel to the semi-axis a
    _, inc, dec = utils.vec2ang(ellipsoid.transf_matrix.T[0])
    # Magnetic moment of the reference ellipsoid
    volume = ellipsoid.volume
    mag = prolate_ellipsoid.magnetization(ellipsoid, B0, inc, dec, demag=True)
    moment = volume * mag
    # Confocal ellipsoid
    u = 2.0e6
    a_confocal = np.sqrt(a * a + u)
    b_confocal = np.sqrt(b * b + u)
    xc = ellipsoid.x
    yc = ellipsoid.y
    zc = ellipsoid.z
    strike = ellipsoid.strike
    dip = ellipsoid.dip
    rake = ellipsoid.rake
    confocal_ellipsoid = ProlateEllipsoid(
        xc, yc, zc, a_confocal, b_confocal, strike, dip, rake,
        {'susceptibility angles': [0., 0., 0.]})
    n11, n22 = prolate_ellipsoid.demag_factors(confocal_ellipsoid)
    H0 = B0 / (4 * np.pi * 100)
    volume_confocal = confocal_ellipsoid.volume
    # Equivalent susceptibility
    moment_norm = np.sqrt(np.sum(moment * moment))
    chi_confocal = moment_norm / (volume_confocal * H0 - n11 * moment_norm)
    confocal_ellipsoid.addprop('principal susceptibilities',
                               [chi_confocal, chi_confocal, chi_confocal])
    # Magnetic moment of the confocal ellipsoid
    mag_confocal = prolate_ellipsoid.magnetization(confocal_ellipsoid,
                                                   B0,
                                                   inc,
                                                   dec,
                                                   demag=True)
    moment_confocal = volume_confocal * mag_confocal
    # Total-field anomalies
    tf = prolate_ellipsoid.tf(x, y, z, [ellipsoid], B0, inc, dec)
    tf_confocal = prolate_ellipsoid.tf(x, y, z, [confocal_ellipsoid], B0, inc,
                                       dec)
    # Comparison between the moments and total-field anomalies
    assert_almost_equal(moment, moment_confocal, decimal=5)
    assert_almost_equal(tf, tf_confocal, decimal=12)
コード例 #3
0
def test_prolate_ellipsoid_principal_susceptibilities_signal():
    'principal susceptibilities must be all positive'
    e = ProlateEllipsoid(x=1, y=2, z=3, large_axis=6, small_axis=4,
                         strike=10, dip=20, rake=30,
                         props={'remanent magnetization': [10, 25, 40],
                                'principal susceptibilities': [0.562, 0.485,
                                                               -0.2],
                                'susceptibility angles': [90, 0]})
    with raises(AssertionError):
        e.susceptibility_tensor
コード例 #4
0
inc = 2
dec = -27

gm = 1000  # geometrical factor
area = [-5. * gm, 5. * gm, -5. * gm, 5. * gm]
x, y, z = gridder.scatter(area, 300, z=0.)
axis_ref = gm  # reference semi-axis

# Prolate ellipsoids used for testing
model = [
    ProlateEllipsoid(x=-3 * gm,
                     y=-3 * gm,
                     z=3 * axis_ref,
                     large_axis=axis_ref,
                     small_axis=0.6 * axis_ref,
                     strike=78,
                     dip=92,
                     rake=135,
                     props={
                         'principal susceptibilities': [0.7, 0.7, 0.7],
                         'susceptibility angles': [90., 47., 13.]
                     }),
    ProlateEllipsoid(x=-gm,
                     y=-gm,
                     z=2.4 * axis_ref,
                     large_axis=1.1 * axis_ref,
                     small_axis=0.3 * axis_ref,
                     strike=4,
                     dip=10,
                     rake=5,
                     props={
                         'principal susceptibilities': [0.2, 0.15, 0.05],