In [1]:
import sys
sys.path.append('../')

import numpy as np
from zephyr.backend import MiniZephyrHD
from zephyr.middleware import Helm2DViscoProblem, Helm2DSurvey, HelmFields
from SimPEG.DataMisfit import l2_DataMisfit

In [2]:
nx = 100
nz = 200
cBackground = 2500. * np.ones((nz,nx))
cAnomaly = -500.

cTrue = cBackground * np.ones((nz,nx))
cTrue[(nz/2)-10:(nz/2)+10,(nx/2)-10:(nx/2)+10] += cAnomaly

sz = np.arange(25, nz-24, 1)
sx = 25. * np.ones((len(sz),))
rz = np.arange(25, nz-24, 1)
rx = (nx - 25.) * np.ones((len(rz),))

geom = {
    'src':      np.vstack([sx, sz]).T,
    'rec':      np.vstack([rx, rz]).T,
}

systemConfig = {
    'dx':       1.,                     # m
    'dz':       1.,                     # m
    'c':        cBackground,            # m/s
    'rho':      1.,                     # kg/m^3
    'nx':       nx,                     # count
    'nz':       nz,                     # count
    'freqs':    np.arange(50, 450, 50), # Hz
    'Disc':     MiniZephyrHD,           # discretization
    'geom':     geom,                   # dictionary
    'nWorkers': 4,
    'parallel': False,
}

In [3]:
problem = Helm2DViscoProblem(systemConfig)
survey  = Helm2DSurvey(systemConfig)
problem.pair(survey)

In [4]:
dObs = survey.dpred()
survey.dobs = dObs
survey.std = 1.
misfit = l2_DataMisfit(survey)
misfit.Wd = 1.

In [5]:
# resid = survey.residual(cBackground)
# g = misfit.evalDeriv(cBackground)
# del problem.factors

In [6]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [7]:
from zephyr.backend import SimpleSource
ss = SimpleSource(systemConfig)

In [8]:
qj = ss(np.array([[50,100]]))

In [9]:
res = problem.Jvec(None, qj).reshape((survey.nrec, survey.nsrc, survey.nfreq))

In [10]:
imshow(res.real[:,:,0])


Out[10]:
<matplotlib.image.AxesImage at 0x7f1d906afad0>

In [ ]: