Open leonfoks opened 6 years ago
Here is a different example for WalkTEM data.
from SimPEG import Mesh, Maps, Utils
%matplotlib notebook
%load_ext autoreload
%autoreload 2
import matplotlib.pyplot as plt
from simpegEM1D import (
EM1D, EM1DSurveyTD, EM1DAnalytics, piecewise_pulse, set_mesh_1d,
skytem_HM_2015, skytem_LM_2015, get_vertical_discretization_time
)
import numpy as np
from scipy import io
from scipy.interpolate import interp1d
mesh1D = set_mesh_1d(np.asarray([30.0, np.inf]))
depth = -mesh1D.gridN[:-1]
LocSigZ = -mesh1D.gridCC
time_LM = np.asarray([1.149E-05, 1.350E-05, 1.549E-05, 1.750E-05, 2.000E-05, 2.299E-05, 2.649E-05, 3.099E-05, 3.700E-05, 4.450E-05, 5.350E-05, 6.499E-05, 7.949E-05, 9.799E-05, 1.215E-04, 1.505E-04, 1.875E-04, 2.340E-04, 2.920E-04, 3.655E-04, 4.580E-04, 5.745E-04, 7.210E-04])
time_input_currents_LM = np.asarray([-8.333e-03, -8.033e-03, 0.0, 5.6000e-06])
input_currents_LM = np.asarray([0.0, 1.0, 1.0, 0.0])
time_HM = np.asarray([9.810E-05, 1.216E-04, 1.506E-04, 1.876E-04, 2.341E-04, 2.921E-04, 3.656E-04, 4.581E-04, 5.746E-04, 7.211E-04, 9.056E-04, 1.138E-03, 1.431E-03, 1.799E-03, 2.262E-03, 2.846E-03, 3.580E-03, 4.505E-03, 5.670E-03, 7.135E-03 ])
time_input_currents_HM = np.asarray([ -1.041e-03, -9.850e-04, 0.0,4.0000e-06])
input_currents_HM = np.asarray([0.0, 1.0, 1.0, 0.0])
TDsurvey = EM1DSurveyTD(
rx_location=np.array([0., 0., 0.]),
src_location=np.array([0., 0., 0.]),
topo=np.r_[0., 0., 0.],
depth=depth,
rx_type='dBzdt',
wave_type='general',
src_type='CircularLoop',
a=22.5675833419,
I=1.,
time=time_HM,
time_input_currents=time_input_currents_HM,
input_currents=input_currents_HM,
n_pulse=1,
base_frequency=30.,
use_lowpass_filter=True,
high_cut_frequency=450000,
moment_type='dual',
time_dual_moment=time_LM,
time_input_currents_dual_moment=time_input_currents_LM,
input_currents_dual_moment=input_currents_LM,
base_frequency_dual_moment=240,
# half_switch = True
)
expmap = Maps.ExpMap(mesh1D)
m_1D = np.log(np.asarray([10.0, 1.0]))
chi = np.zeros(TDsurvey.n_layer)
prob = EM1D(
mesh1D, sigmaMap=expmap, chi=chi
)
prob.pair(TDsurvey)
dBzdtTD = TDsurvey.dpred(m_1D)
Hi @leonfoks: thanks for these issues! @sgkang is away at the moment (he gets back next week), and he is the most well-suited to address these. Sorry for the delay!
I'll reply this asap.
This was due to a bug when computing time range for interpolation. It is fixed now in #22
Ill attach two examples causing this to fail.
The first is the example in simpegEM1D but with the order of the HM and LM information switched during instantiation of the TDsurvey. The second is a custom walkTEM system, I simply specified the time gate center times and waveforms using numpy arrays.
Each causes an out of bounds error in Scipy's interpolate.
Example 1
Notebook cell
Error message
Produces the following with not much to go by.