def main():
    fault = geoprobe.swfault('/data/nankai/data/swFaults/jdk_oos_splay_large_area_depth.swf')

    faultxyz = data.to_world(data.to_xyz(data.fault))

    horxyz = data.to_world(data.to_xyz(data.horizons[0]))[::100]

    slip = invert_slip(faultxyz, horxyz, alpha=data.alpha)

    azimuth = np.degrees(np.arctan2(*slip[::-1]))
    azimuth = 90 - azimuth
    mag = np.linalg.norm(slip) / 1000

    f = FaultModel(fault, horxyz, origxyz=horxyz, ve=3, azimuth=azimuth, 
                   slip=mag, alpha=data.alpha, calc_fault=faultxyz)
    f.configure_traits()
def main():
    fault = geoprobe.swfault(
        '/data/nankai/data/swFaults/jdk_oos_splay_large_area_depth.swf')

    faultxyz = data.to_world(data.to_xyz(data.fault))

    horxyz = data.to_world(data.to_xyz(data.horizons[0]))[::100]

    slip = invert_slip(faultxyz, horxyz, alpha=data.alpha)

    azimuth = np.degrees(np.arctan2(*slip[::-1]))
    azimuth = 90 - azimuth
    mag = np.linalg.norm(slip) / 1000

    f = FaultModel(fault,
                   horxyz,
                   origxyz=horxyz,
                   ve=3,
                   azimuth=azimuth,
                   slip=mag,
                   alpha=data.alpha,
                   calc_fault=faultxyz)
    f.configure_traits()
def _invert_inclined_shear(args):
    """Dummy function to work around multiprocessing.pool only accepting
    one iterable argument and needing functions to be visible from __main__."""
    args = list(args)
    numsamples = args[-1]
    args = args[:-1]

    # "Nudge" solution down-dip (give it a starting direction of downdip)
    dipdir = np.radians(data.fault_strike + 90)
    dx, dy = np.cos(dipdir), np.sin(dipdir)
    direc = np.array([[dx,0],[0,dy]], dtype=np.float)

    # Randomly resample fault with replacement
    args[0] = subsample(args[0])

    # Randomly resample horizon (potentially not with replacement, depending 
    # on numsamples) (Horizon is over-sampled anwyay. It's okay to subsample)
    args[1] = subsample(args[1], numsamples)

    kwargs = dict(direc=direc, return_metric=True, overlap_thresh=1)
    (dx,dy), var = homogeneous_simple_shear.invert_slip(*args, **kwargs)

    return dx, dy, var
def _invert_inclined_shear(args):
    """Dummy function to work around multiprocessing.pool only accepting
    one iterable argument and needing functions to be visible from __main__."""
    args = list(args)
    numsamples = args[-1]
    args = args[:-1]

    # "Nudge" solution down-dip (give it a starting direction of downdip)
    dipdir = np.radians(data.fault_strike + 90)
    dx, dy = np.cos(dipdir), np.sin(dipdir)
    direc = np.array([[dx, 0], [0, dy]], dtype=np.float)

    # Randomly resample fault with replacement
    args[0] = subsample(args[0])

    # Randomly resample horizon (potentially not with replacement, depending
    # on numsamples) (Horizon is over-sampled anwyay. It's okay to subsample)
    args[1] = subsample(args[1], numsamples)

    kwargs = dict(direc=direc, return_metric=True, overlap_thresh=1)
    (dx, dy), var = homogeneous_simple_shear.invert_slip(*args, **kwargs)

    return dx, dy, var
models = [[0, 0]]

i = 0
for hor in data.horizons[::-1]:
    print hor.name
    # Downsample horizon for faster solution...
    xyz = data.to_xyz(hor)[::50,:]
    xyz = data.to_world(xyz)

    # Move this horizon to the last horizon's best fit offset.
    # Following the path of all previous horizons...
    for model in models:
        dx, dy = model
        xyz = inclined_shear(fault, xyz, (dx,dy), data.alpha)

    model = invert_slip(fault, xyz, data.alpha, guess=(0,0))
    models.append(model)
    i += 1

models = np.array(models)
movement = models[:,:2].cumsum(axis=0)

x, y = movement.T

plt.plot(x, y, marker='o')

utilities.plot_plate_motion(time=3e5)

plt.axis('equal')
plt.show()
Esempio n. 6
0
def forced_direction_inversion(fault, xyz, alpha, azimuth, **kwargs):
    azimuth = np.radians(90 - azimuth)
    dx, dy = np.cos(azimuth), np.sin(azimuth)
    direc = [[dx, dy], [dx, dy]]
    return invert_slip(fault, xyz, alpha, direc=direc, **kwargs)
Esempio n. 7
0
fault = data.to_world(data.to_xyz(data.fault))

slips = [(0,0)]
guess = (0,0)

heaves = [(0,0,0)]
planar_variances = []
variances = []

for i, hor in enumerate(data.horizons[::-1]):
    print hor.name
    xyz = data.to_xyz(hor)[::50]
    xyz = data.to_world(xyz)

    slip, metric = invert_slip(fault, xyz, alpha=data.alpha, guess=guess, 
                               overlap_thresh=1, return_metric=True)
    heave = utilities.calculate_heave(slip, hor)

    variances.append(metric)
    planar_var = planar_variance(xyz)
    planar_variances.append(planar_var)
    print metric / planar_var

    slips.append(slip)
    heaves.append(heave)


x, y = np.array(slips).T
plt.plot(x, y, 'bo-')

x, y, z = np.array(heaves).T
def forced_direction_inversion(fault, xyz, alpha, azimuth, **kwargs):
    azimuth = np.radians(90 - azimuth)
    dx, dy = np.cos(azimuth), np.sin(azimuth)
    direc = [[dx, dy], [dx, dy]]
    return invert_slip(fault, xyz, alpha, direc=direc, **kwargs)
def forced_direction_inversion(fault, xyz, alpha, azimuth, **kwargs):
    azimuth = np.radians(90 - azimuth)
    dx, dy = np.cos(azimuth), np.sin(azimuth)
    direc = [[dx, dy], [dx, dy]]
    return invert_slip(fault, xyz, alpha, direc=direc, **kwargs)

def visualize(slip, faultxyz, horxyz):
    fault = geoprobe.swfault('/data/nankai/data/swFaults/jdk_oos_splay_large_area_depth.swf')

    azimuth = np.degrees(np.arctan2(*slip[::-1]))
    azimuth = 90 - azimuth
    mag = np.linalg.norm(slip) / 1000

    f = FaultModel(fault, horxyz, origxyz=horxyz, ve=3, azimuth=azimuth, 
                   slip=mag, alpha=data.alpha, calc_fault=faultxyz)
    f.configure_traits()

fault = data.world_xyz(data.fault)
for i, hor in enumerate(data.horizons[::-1]):
    print hor.name
    xyz = data.to_world(data.to_xyz(hor))[::50]

    slip, metric = invert_slip(fault, xyz, alpha=data.alpha, guess=(0,0), 
                               overlap_thresh=1, return_metric=True)
#    slip, metric = forced_direction_inversion(fault, xyz, data.alpha, data.fault_strike+90,
#                                              guess=guess, return_metric=True)

    visualize(slip, fault, xyz)

Esempio n. 10
0
def invert(fault, xyz, alpha):
    return invert_slip(fault, xyz, alpha, overlap_thresh=1, return_metric=True)
Esempio n. 11
0
def planar_variance(xyz):
    vecs, vals = geoprobe.utilities.principal_axes(*xyz.T, return_eigvals=True)
    return vals[-1]

hor = data.horizons[0]
fault = data.to_world(data.to_xyz(data.fault))
xyz = data.to_xyz(hor)[::100]
xyz = data.to_world(xyz)

alpha = data.alpha

func = _Shear(fault, xyz, alpha=alpha, overlap_thresh=0.1)

planar_var = planar_variance(xyz)
slip, thresh = invert_slip(fault, xyz, alpha=alpha, return_metric=True)
print planar_var, thresh


dx, dy = slip
width = 2000
height = 2000
xx, yy = np.mgrid[dx-width:dx+width:100, dy-height:dy+height:100]
roughness = np.zeros(xx.shape, dtype=np.float)

for i, j in np.ndindex(xx.shape):
    roughness[i,j] = func((xx[i,j],yy[i,j]))
roughness = np.ma.masked_greater(roughness, 1.1 * thresh)

flat_point = np.unravel_index(roughness.argmin(), roughness.shape)
plt.pcolormesh(xx, yy, roughness)
Esempio n. 12
0
def invert(fault, xyz, alpha):
    return invert_slip(fault, xyz, alpha, overlap_thresh=1, return_metric=True)
models = [[0, 0]]

i = 0
for hor in data.horizons[::-1]:
    print hor.name
    # Downsample horizon for faster solution...
    xyz = data.to_xyz(hor)[::50, :]
    xyz = data.to_world(xyz)

    # Move this horizon to the last horizon's best fit offset.
    # Following the path of all previous horizons...
    for model in models:
        dx, dy = model
        xyz = inclined_shear(fault, xyz, (dx, dy), data.alpha)

    model = invert_slip(fault, xyz, data.alpha, guess=(0, 0))
    models.append(model)
    i += 1

models = np.array(models)
movement = models[:, :2].cumsum(axis=0)

x, y = movement.T

plt.plot(x, y, marker='o')

utilities.plot_plate_motion(time=3e5)

plt.axis('equal')
plt.show()
Esempio n. 14
0
def planar_variance(xyz):
    vecs, vals = geoprobe.utilities.principal_axes(*xyz.T, return_eigvals=True)
    return vals[-1]


hor = data.horizons[0]
fault = data.to_world(data.to_xyz(data.fault))
xyz = data.to_xyz(hor)[::100]
xyz = data.to_world(xyz)

alpha = data.alpha

func = _Shear(fault, xyz, alpha=alpha, overlap_thresh=0.1)

planar_var = planar_variance(xyz)
slip, thresh = invert_slip(fault, xyz, alpha=alpha, return_metric=True)
print planar_var, thresh

dx, dy = slip
width = 2000
height = 2000
xx, yy = np.mgrid[dx - width:dx + width:100, dy - height:dy + height:100]
roughness = np.zeros(xx.shape, dtype=np.float)

for i, j in np.ndindex(xx.shape):
    roughness[i, j] = func((xx[i, j], yy[i, j]))
roughness = np.ma.masked_greater(roughness, 1.1 * thresh)

flat_point = np.unravel_index(roughness.argmin(), roughness.shape)
plt.pcolormesh(xx, yy, roughness)
plt.plot(dx, dy, 'ro')
def forced_direction_inversion(azimuth, fault, xyz, alpha, **kwargs):
    """Forces the inversion to only consider slip along the given azimuth."""
    azimuth = np.radians(90 - azimuth)
    dx, dy = np.cos(azimuth), np.sin(azimuth)
    direc = [[dx, dy], [dx, dy]]
    return invert_slip(fault, xyz, alpha, direc=direc, **kwargs)