Exemple #1
0
    def createFOP(verbose=False):
        """Create default forward operator for Traveltime modelling.
        base api

        Dijkstra, later FMM.
        """
        #        if not hasattr(self, 'mesh'):  # self.mesh is None:
        #        self.createMesh()
        fop = pg.TravelTimeDijkstraModelling(verbose=verbose)
        return fop
Exemple #2
0
    def createFOP(verbose=False, usefmm=False):
        """Create default forward operator for Traveltime modelling.

        usefmm forces Fast Marching Method, otherwise Dijkstra is used.
        """
        if usefmm:
            from .FMModelling import TravelTimeFMM
            fop = TravelTimeFMM(verbose=verbose)
        else:
            fop = pg.TravelTimeDijkstraModelling(verbose=verbose)

        return fop
Exemple #3
0
    def createFOP(verbose=False, **kwargs):
        """Create default forward operator for Traveltime modelling.
        base api

        Dijkstra, later FMM.
        """
        if kwargs.pop('method', None):
            from FMModelling import TravelTimeFMM
            fop = TravelTimeFMM(verbose=verbose)
        else:
            fop = pg.TravelTimeDijkstraModelling(verbose=verbose)

        return fop
Exemple #4
0
def test_Jacobian():
    mesh2 = mesh.createMeshWithSecondaryNodes(n=5)
    fop = pg.TravelTimeDijkstraModelling(mesh2, data)
    fop.createJacobian(slo)
    J = fop.jacobian()
    np.testing.assert_allclose(J * slo, np.sqrt(5))
Exemple #5
0
def test_withSecNodes():
    mesh2 = mesh.createMeshWithSecondaryNodes(n=3)
    fop = pg.TravelTimeDijkstraModelling(mesh2, data)
    t_refined = fop.response(slo)
    np.testing.assert_allclose(
        t_refined, np.sqrt(5))  # only works if n_secNodes is odd number
Exemple #6
0
def test_withoutSecNodes():
    fop = pg.TravelTimeDijkstraModelling(mesh, data)
    t_normal = fop.response(slo)
    np.testing.assert_allclose(t_normal, 1 + np.sqrt(2))
px = np.sort(mx(fi))

###############################################################################
# A data container with index arrays named s (shot) and g (geophones) is
# created and filled with the positions and shot/geophone indices.
data = pg.DataContainer()
data.registerSensorIndex('s')
data.registerSensorIndex('g')
for pxi in px:
    data.createSensor(pg.RVector3(pxi, 0.0))

ndata = len(px) - 1
data.resize(ndata)
data.set('s', pg.RVector(ndata, 0))  # only one shot at first sensor
data.set('g', pg.utils.grange(1, ndata, 1))  # all others and geophones
fop = pg.TravelTimeDijkstraModelling(mesh, data)
tDijkstra = fop.response(mesh.cellAttributes())

###############################################################################
# We plot the calculated and measured travel times and relative differences
fig, ax = plt.subplots()
ax.plot(x, tAna * 1000, 'r-', label='analytical')
ax.plot(x, tFMM * 1000, 'b+-', label='FMM')
ax.plot(px[1:], tDijkstra * 1000, 'gx-', label='Dijkstra')
ax.set_xlabel('x [m]')
ax.set_ylabel('t [s]')
ax.grid(True)
ax.legend()
ax2 = ax.twinx()
dtFMM = (tFMM - tAna) * 1000
tAnaD = analyticalSolution2Layer(px[1:])