DataAnalysis2021/07-Receiver_Functions/receiverFuntionCalculation.ipynb

655 lines
459 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Calculation of receiver functions\n",
"In this notebook, we calculate a receiver function for a 3-component record of one event at a single station. It is a modification of the minimal example provided by Tom Eulenfeld (Richter) on Github."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pylab as plt\n",
"from obspy.core import read, Stream, Trace, UTCDateTime\n",
"from obspy.taup import TauPyModel\n",
"from obspy import read_events\n",
"from obspy.signal.filter import lowpass\n",
"plt.style.use(\"ggplot\")\n",
"plt.rcParams['figure.figsize'] = 15, 4"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We first read the QuakeML file which contains information about the avaiable seismic events using ObsPy. We get a catalogue object whih can be iterated through events and from which information can be extracted. Here, we are interested in the origin time."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2011-05-15T13:08:15.420000Z\n",
"2011-05-13T22:47:55.340000Z\n",
"2011-04-30T08:19:16.720000Z\n",
"2011-04-18T13:03:04.360000Z\n",
"2011-04-07T13:11:23.430000Z\n",
"2011-03-31T00:11:58.880000Z\n",
"2011-03-06T14:32:36.940000Z\n",
"2011-03-01T00:53:45.350000Z\n",
"2011-02-25T13:07:26.980000Z\n",
"2011-02-21T23:51:42.340000Z\n",
"2011-02-21T10:57:51.760000Z\n",
"2011-02-12T17:57:56.170000Z\n",
"2011-01-31T06:03:26.330000Z\n"
]
}
],
"source": [
"cat = read_events(\"example_events.xml\")\n",
"for ev in cat:\n",
" print(ev.origins[0].time)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the minimal example by Tom Eulenfeld, data of the following three events are provided in the SAC format (a fairly widespread format used with SAC (seismological analysis code) software In the following cell, you can choose one of the three events by setting the variable \"evnum\"."
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Origin(resource_id=ResourceIdentifier(id=\"smi:service.iris.edu/fdsnws/event/1/query?originid=9925460\"), time=UTCDateTime(2011, 3, 6, 14, 32, 36, 940000), longitude=-27.0253, latitude=-56.3864, depth=92000.0, creation_info=CreationInfo(author='ISC'))]\n"
]
}
],
"source": [
"evnum = 1 # coose an event (0,1,2)\n",
"avail_events = (cat[1],cat[6],cat[8]) # pick available events from catalogue\n",
"event_dates = (\"20110513\",\"20110306\",\"20110225\") # hack for reading associated SAC files\n",
"event = avail_events[evnum] # select an event\n",
"evdate = event_dates[evnum]\n",
"print(event.origins)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here, we read the SAC files, detrend and taper the data and then apply a bandpass filter. Afterwards, the traces are trimmed to a 90 seconds time window."
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"st = read(\"data/PB01.BH?.\"+evdate+\".sac\", format = \"SAC\") # read data using ObsPy\n",
"st.detrend(\"linear\") # detrending\n",
"st.taper(0.05,type = \"hann\") # tapering\n",
"st.filter('bandpass', freqmin=0.4, freqmax=1.0) # bandpass filter\n",
"dt = st[0].stats.delta\n",
"for tr in st: # trim to 90 s window\n",
" ta = tr.stats.starttime\n",
" tr.trim(ta+5.,ta+95.)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The \"stats\"-attribute of the data stream contains pretty much details about the traces and the event such as backazimuth, epicentral distance and other useful things."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" network: CX\n",
" station: PB01\n",
" location: \n",
" channel: BHE\n",
" starttime: 2011-03-06T14:40:44.719539Z\n",
" endtime: 2011-03-06T14:42:14.719539Z\n",
" sampling_rate: 5.0\n",
" delta: 0.2\n",
" npts: 451\n",
" calib: 1.0\n",
" _format: SAC\n",
" processing: [\"ObsPy 1.1.0: detrend(options={}::type='linear')\", \"ObsPy 1.1.0: taper(max_length=None::max_percentage=0.05::side='both'::type='hann')\", \"ObsPy 1.1.0: filter(options={'freqmin': 0.4, 'freqmax': 1.0}::type='bandpass')\", 'ObsPy 1.1.0: trim(endtime=UTCDateTime(2011, 3, 6, 14, 42, 14, 719539)::fill_value=None::nearest_sample=True::pad=False::starttime=UTCDateTime(2011, 3, 6, 14, 40, 44, 719539))']\n",
" sac: AttribDict({'delta': 0.2, 'depmin': -4753.0, 'depmax': 7559.0, 'scale': 1.0, 'b': 0.00053899997, 'e': 120.00054, 'o': -482.77899, 'stla': -21.04323, 'stlo': -69.487396, 'stel': 900.0, 'evla': -56.386398, 'evlo': -27.025299, 'evdp': 92.0, 'mag': 6.5, 'dist': 5242.6309, 'az': 300.62534, 'baz': 149.24416, 'gcarc': 47.148113, 'depmen': 523.57239, 'nzyear': 2011, 'nzjday': 65, 'nzhour': 14, 'nzmin': 40, 'nzsec': 39, 'nzmsec': 719, 'nvhdr': 6, 'npts': 601, 'iftype': 1, 'iztype': 9, 'leven': 1, 'lpspol': 0, 'lovrok': 1, 'lcalda': 1, 'kstnm': 'PB01', 'kcmpnm': 'BHE', 'knetwk': 'CX'})\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAwkAAALhCAYAAAAU++jXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzs3XlcVGX/P/7XsA7DIooCyqaioIBLruVummmZpmZa5nJX\nLm12m7ZpX7U7Ne12yfKTlGWppWamlWYuuYSm5a4IgiAK4gKCDusMDDPX7w9+59wcmBlmQEXo9Xw8\nfBRzljln5gxcr3lf13VUQggBIiIiIiKi/59DTR8AERERERHdXxgSiIiIiIhIgSGBiIiIiIgUGBKI\niIiIiEiBIYGIiIiIiBQYEoiIiIiISIEhgYiIiIiIFBgSiIiIiIhIgSGBiIiIiIgUG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p27Iiw\nsDCb1h84cCCio6ORmpoKrVYrjyuQPgvr16/H5cuXkZSUhODgYAwdOhQmk0lxTube24EDB2L9+vU4\nd+4cdDod5s6dC5VKpfiMEZHtGBKI7GAwGDBy5Ei0aNFC0Qjz8PBAbm6u/HNubi48PDyq/XyRkZHy\n4L20tLQKz2PpuVQqFbp27Ypr167hiy++sHtfbm5uAIC33noL3t7eaNq0KSZPnowdO3ZU63ykRtbE\niRMrXddkMmHq1Kn4+OOPoVKpKiy39bUASht6q1evxnvvvWf2uaZNm4YPPvgAarXaxjMBjEYjNmzY\ngHHjxtm8zaxZs9C2bVu0b98e3bt3x/DhwxXfDPfs2RPOzs5o1KgRPvnkE+zYsQN6vV6xD3Pv7fvv\nv4/4+HhkZmYiLy8PvXr
"text/plain": [
"<matplotlib.figure.Figure at 0x7f00ff600518>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print(st[0].stats)\n",
"st.plot()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next, we rotate the ZNE-components into the LQT-system. To do this, we need the backazimuth and the incidence angle of the P-wave. Both are not perfectly known but can be estimated assuming the P-wave propagates in the plane of the source-receiver great circle and using a standard earth model to calculate travel time and incidence angle. The obspy.taup module helps us with this task. "
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3 Trace(s) in Stream:\n",
"CX.PB01..BHT | 2011-03-06T14:40:44.719539Z - 2011-03-06T14:42:14.719539Z | 5.0 Hz, 451 samples\n",
"CX.PB01..BHQ | 2011-03-06T14:40:44.719538Z - 2011-03-06T14:42:14.719538Z | 5.0 Hz, 451 samples\n",
"CX.PB01..BHL | 2011-03-06T14:40:44.719539Z - 2011-03-06T14:42:14.719539Z | 5.0 Hz, 451 samples"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model = TauPyModel(model=\"iasp91\") # create a model object for ray tracing\n",
"evdep = st[0].stats.sac[\"evdp\"] # extract event depth from trace stats\n",
"epidis = st[0].stats.sac[\"gcarc\"] # extract epicentral distance in degrees from trace stats\n",
"baz = tr.stats.sac[\"baz\"] # extract backazimuth from trace stats\n",
"arrivals = model.get_travel_times( # get travel time, incidence angle stored in arrivals-object\n",
" source_depth_in_km = evdep,distance_in_degree=epidis,phase_list=\"P\")\n",
"incl = arrivals[0].incident_angle # extract incidence angle\n",
"ttime = arrivals[0].time # extract arrival time\n",
"st.rotate('ZNE->LQT',back_azimuth=baz, inclination=incl) # rotate components"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAwkAAADtCAYAAAD0pjmFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzs3XlcVNX/P/DXsM4GosiibCoIypYKYqYsJrmUVkqpiaZm\nrqXlkmtf01xSS9Psk5S5L5UfxcpyFxXIDTQ3QGURAUUQlH2GGZjz+4Pf3A+XmYEZFkl6Px+PeSh3\nOffcbea871mugDHGQAghhBBCCCH/n1FzZ4AQQgghhBDyz0JBAiGEEEIIIYSHggRCCCGEEEIIDwUJ\nhBBCCCGEEB4KEgghhBBCCCE8FCQQQgghhBBCeChIIIQQQgghhPBQkEAIIYQQQgjhoSCBEEIIIYQQ\nwkNBAiGEEEIIIYSHggRC9FBeXo733nsPzs7OsLS0xIsvvogLFy7wllm9ejVsbGzQpk0bzJs3D4wx\nbt7UqVPh5uYGgUCAs2fP8tY7cOAAXnzxRQiFQowfP77OvMTFxcHX1xdisRjBwcG4f/8+N++zzz6D\nk5MTLCws0LlzZ2zbtq3eaQHAjh070LlzZ0ilUnTt2hWpqalYtWoVpFIppFIpzM3NYWpqyv09depU\nVFRU4K233oKTkxMEAgHS09O1bvvChQswMjLCihUr6tzniooK+Pj4wM3NzaD8a5Oeng6RSIT3339f\n6/zBgwfDxMRE5/p79+7l9lcqlUIkEsHIyAh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qFt27aYPXt2g++Duq7HmvS5PouLizF48GCMHDkS48aNq1e+li5d\niilTpsDW1tag9Xbv3m3
"text/plain": [
"<matplotlib.figure.Figure at 0x7f00ff6a5828>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"st[2].plot() # plot new L-component"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next, we trim the traces to a 40 s window around the P-onset which we estimate by adding the travel time to the event origin time. We could also pick the arrival time. The resulting trace is again tapered to avoid artifacts in the discrete Fourier transform."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2011-03-06T14:40:59.816249Z\n",
"3 Trace(s) in Stream:\n",
"CX.PB01..BHT | 2011-03-06T14:40:49.719539Z - 2011-03-06T14:41:29.719539Z | 5.0 Hz, 201 samples\n",
"CX.PB01..BHQ | 2011-03-06T14:40:49.719538Z - 2011-03-06T14:41:29.719538Z | 5.0 Hz, 201 samples\n",
"CX.PB01..BHL | 2011-03-06T14:40:49.719539Z - 2011-03-06T14:41:29.719539Z | 5.0 Hz, 201 samples\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAwIAAADtCAYAAAAMRsJyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzs3XdYFFf7P/73UneXBcEG0kQwNsTHgiUKluijYjSKJnZj\nwRajPrEnYCxRY/lEY4pKTGzRGGMQjF0TiaKJNWhQbCgqVVQMdXdh2b2/f/jb+bGwsAUQI/fruva6\n2Dlnzjkzs7PMvXPOGRERERhjjDHGGGM1ikV1N4AxxhhjjDH24nEgwBhjjDHGWA3EgQBjjDHGGGM1\nEAcCjDHGGGOM1UAcCDDGGGOMMVYDcSDAGGOMMcZYDcSBAGOMMcYYYzUQBwKMMcYYY4zVQBwIMMYY\nY4wxVgNxIMAYY4wxxlgNxIEAY0YoKCjAhAkT4OnpCQcHB3Tq1Annzp3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u1FvXhAkTMHToUHTr1g0t\nW7ZEr169YG1tDWdn5zLbp1ar8eOPP+Ldd981uC1aYWFhaNWqFVq3bo0uXbpg8ODBOr/wBgYGwtra\nGvXq1cOXX36JI0eOQKlU6pSh79ia036t4gM+TTFt2jRkZ2cjPDxcp6yS54F2eUUEBQUJbdQOUjX2\n2Lds2RJSqRSffPKJWWVJJBLMmDEDDRo0QN26dTF79uwKnweGPo8lzZo1C8uWLYNYLK5QvcWtXLkS\n0dHRiIiIEM6vXr16YdGiRQgODoaXl5cwKNzQXYidO3eadB4Y+rx27twZYrEYDg4OWLduHe7evYt7\n9+6VKqfksTW3/YzVZBw
"text/plain": [
"<matplotlib.figure.Figure at 0x7f00ff7dbbe0>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"onset = event.origins[0].time+ttime # onset time = origin time + travel time\n",
"print(onset)\n",
"st.trim(onset-10.,onset+30.)\n",
"st.taper(0.125,type = \"hann\")\n",
"print(st)\n",
"st[2].plot()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"zcomp = st[2].data # rename traces\n",
"rcomp = st[1].data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Deconvolution in the frequency domain using waterlevel method\n",
"Here comes the central routine for receiver function calculation which does the deconvolution, here using the water level method. Note that we add zeros to the traces to avoid the pitfalls when doing cross-correlation inthe frequency domain. We deconvolve both the Z- or L-component and the R-or Q-component."
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"def deconvWaterLevel(rsp, src, dt, waterlevel=0.05, alfa=2.,\n",
" tshift=None,length=None,normalize=False):\n",
" \"\"\"\n",
" Frequency-domain deconvolution using waterlevel method.\n",
" Deconvolve src from rsp.\n",
"\n",
" :param rsp: trace to be deconvolved (nominator)\n",
" :param src: trace to deconvolved with (denominator)\n",
" :param dt: sampling interval of data\n",
" :param waterlevel: waterlevel to stabilize the deconvolution\n",
" :param gauss: Gauss parameter of low-pass filter\n",
" :param tshift: shift zero lag of receiver function to the right by tshift\n",
" :param length: number of data points in results, optional\n",
" :param normalize: normalize to src (default = False)\n",
" :return: receiver function\n",
" \"\"\"\n",
" npts = len(rsp)\n",
" if length == None:\n",
" nout = npts\n",
" else:\n",
" nout = length # cut output to nout samples\n",
" nfft = int(pow(2, np.ceil(np.log(npts)/np.log(2)))) # next higher power of 2\n",
" nfft = 2*nfft # add zeros to avoid pitfalls with cc \n",
" freq = np.fft.rfftfreq(nfft,dt) # Fourier frequencies\n",
" spq = np.fft.rfft(rsp,nfft) # FT of R or Q component\n",
" spz = np.fft.rfft(src,nfft) # FT of Z or L component\n",
" spshift = np.exp(-1j*2.*np.pi*freq*tshift) # time shift (applied in the frequency domain)\n",
" cspz = np.conjugate(spz) # complex conjugate needed later\n",
" spzabs2 = np.abs(spz)**2 # absolute value squared\n",
" water = np.maximum(spzabs2,max(spzabs2)*waterlevel) # regularized denominator\n",
" gauss = np.exp((-np.pi*freq/alfa)**2) # Gaussian low-pass filter\n",
" sprfz = gauss*spshift*spzabs2/water # deconvolve Z or L component \n",
" rfz = np.fft.irfft(sprfz,nfft)[:npts] # Z or L receiver function intime domain\n",
" if normalize:\n",
" norm = 1.0/max(rfz)\n",
" else:\n",
" norm = 1.0\n",
" rfz = norm*rfz # normalize Z-receiver function to max of 1\n",
" sprfq = gauss*spshift*spq*cspz/water # spectrum of Q-receiver function\n",
" rfq = -np.fft.irfft(sprfq,nfft)*norm # Q-receiver function (normalized and sign reversed)\n",
" return rfq[0:nout],rfz[0:nout]"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"tshift = 5. # shift the zero lag to +5 seconds\n",
"rfq,rfl = deconvWaterLevel(rcomp, zcomp, dt, \n",
" waterlevel=0.05, alfa=20.,\n",
" length=150,tshift=tshift,normalize=True) # do the deconvolution\n",
"tr = np.arange(0,len(rfq))*dt-tshift # take shift into account when plotting time axis"
]
},
{
"cell_type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UBN\nNRTuCWw8xyqZGch/n0G+/UK3cSoLlZgCgKz7IXDr5uyEsI4Q3bPxxxP6w949yMHSwMVQz/59UFEO\nsR4mhz1jwbKgfk7RYGjnSG0t9kO3Y99zE7J+VcsnGAwGQyOY5NBgaCu2boD8XNT0MwC0GMzA4cgH\nryIH9gV+/cI8qK2B3n0bfVglpUDBbqTsQMBCqBejoV9Ks8cplyhNq8xAHoNIpvastO5/hqAHniPo\n9w9iXXc7pAxFAuhnKbsyoU+/JluG3S3LrVE9zNdJnmpBjKYeFRwCMbFInpl1NRwlZG6D8oOAwn76\nL9hvv6C9PQ0Gg8ELTHJoMLQR9jfzIbwLatyJgK7WWZfdCFVVyHuvBD4Al8CL6p3Q6MMqaaD+w870\nwMWwMwO6RaG6tWBd4zItN3OHPpKZAV26QmRDjyWVmAJ7cpGDZY4vKSKQm9m4GE09ruSwNeYOxZUc\n4mlbKejW0lauHIoI9guPYn/2bquuazj6ka0bQCmsPz+BOvks5KtPsB/+vZ61bYt47Dokda3uUjEY\nDEcNJjk0GNoAKd4L61agppyKCung/rmK7YM67XxkxTfIlvWBjSE3C5Ryz1YdQUJ/UFZAW0slcxu0\nMG8IoELDoEcvo1jqI5LZuOhPfWspgageFhXoNs74fk0eojp3geierSNKk58LoWHQPcrjU1RcPBTm\nIbWtWH3JTEdWLkE+fB174Yett67BMewfvqXusbmtq8QLyJYNEJ+E6haFdcmvsH59NxQXYv/11lZv\nM5XaWuTFx7D/+Wfkq49bdW2DweAfJjk0GNoA+W6hVnE86bQjHlNnXAg9emG/8VxAW4Jkdxb06IUK\nDW30cRXWEXonBCw5lIN
"text/plain": [
"<matplotlib.figure.Figure at 0x7f00ff509668>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.subplot(211)\n",
"plt.plot(tr,rfq)\n",
"plt.ylabel(\"Q-RF\")\n",
"plt.subplot(212)\n",
"plt.plot(tr,rfl)\n",
"plt.xlabel(\"Time\")\n",
"plt.ylabel(\"L-RF\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Deconvolution in the time domain using Wiener filter\n",
"Now, we do the deconvolution in the time domain using the Wiener filter method. We need the cross-correlation and the autocorrelation to form the Toeplitz matrix and the right hand side of the equation system."
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"length of z: 201\n",
"length of czr: 401\n",
"Center of correlation: 200\n"
]
}
],
"source": [
"p = len(zcomp) # length of z and r\n",
"czr = np.correlate(rcomp,zcomp,mode = \"full\") # correlation of z with r according to our definition\n",
"azz = np.correlate(zcomp,zcomp,mode = \"full\") # auto-correlation of z\n",
"q = len(czr) # length of correlations = 2*p-1\n",
"jc = q//2 # center of autocorrelation sits at j=q//2 = p-1\n",
"print(\"length of z: \",p)\n",
"print(\"length of czr: \",q)\n",
"print(\"Center of correlation: \",jc)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA4cAAAEUCAYAAACYgENSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3Xd8VFX6x/HPuekFUulVQJoKiCBNBIW1oLurK2LFrquu\nfVFRdy2LiqgIuj8UEUXXsnbW3hBBBRQEsYCiNOmkkd5zz++Pm0zaJBkQMgG+79eLF5k79945c2Yy\nmeee5zzHWGstIiIiIiIiclBzgt0AERERERERCT4FhyIiIiIiIqLgUERERERERBQcioiIiIiICAoO\nRUREREREBAWHIiIiIiIiAoQGuwGN4fHHH2fFihXExcUxderUevdNTU3liSeeIDs7m9jYWK699lqS\nkpIaqaUiIiIiIiLBcVCMHI4cOZLbb789oH2ff/55jj32WB5++GHGjh3LSy+9tI9bJyIiIiIiEnwH\nxchh7969SUlJqbZtx44dPP3002RnZxMREcFf//pX2rVrx5YtW7jgggsAOOyww3jooYeC0WQRERER\nEZFGdVCMHPoza9Y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xdc/cvj9Mu+H/DxYtRz6Da57\nX2uxP38P/YdgOnXDzn0edmyBNh3qbpOIiBxUGiWt1N/IYNu2bbn//vtJSkqipERrOImIyB765Uco\nLcUMGIY5/CiwLjSQWmqXfg7GwQweCWt+wBbm+98xOxOaxWOcKn8uY8oDuLrmHRYV+A0OTWQAI4c1\ng8Pm8XWmf1prveDw8KO
"text/plain": [
"<matplotlib.figure.Figure at 0x7f00ff3f0ba8>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"tm = np.arange(0,q)*dt-jc*dt # shift times for plotting\n",
"plt.subplot(211)\n",
"plt.xlabel(\"Time\")\n",
"plt.ylabel(\"AZZ\")\n",
"plt.plot(tm,azz)\n",
"plt.subplot(212)\n",
"plt.plot(tm,czr)\n",
"plt.xlabel(\"Time\")\n",
"plt.ylabel(\"CZR\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"m = 150 # length of receiver function with m <= p\n",
"toeplmat = np.zeros((m,m))\n",
"for i in range(0,m):\n",
" for j in range(0,m): \n",
" toeplmat[i,j] = azz[jc+i-j] # negative values of k-j are OK because we used \"full\"\n",
" if j == i:\n",
" toeplmat[i,j] = toeplmat[i,j]+0.05*azz[jc] # regularization of solution\n",
"if m <= 4: \n",
" print(toeplmat)\n",
"rfq = -np.linalg.solve(toeplmat,czr[jc:jc+m]) # solve equation system for receiver function\n",
"rfl = np.linalg.solve(toeplmat,azz[jc:jc+m]) # solve for deconvolution of z with itself\n",
"rfl = lowpass(rfl,0.75,3,zerophase = True) # low-pass filter result\n",
"rfq = lowpass(rfq,0.75,3,zerophase = True)\n",
"norm = np.max(rfl)\n",
"rfq = rfq/norm # normalize result\n",
"rfl = rfl/norm"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA40AAAENCAYAAACre4DIAAAABHNCSVQICAgIfAhkiAAAAAlwS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96GkBHX6uXDmBfDQOAr++J2ift73+QaCvXAuREax\nu0kMqrr7plUclO5nx9KFqI6dg6KrOmTzBmRvASVtO/r0nNodOiP7itixeD4qvosr2urifWY4ugjV\nPWb//A0U7kWdcCqqcbOg/3xDcDHvZQa3CfU91ratd8Z+daI8tXPnzmzevJlt27ZRVlbG7Nmz6d+/\n/0HH9O/fnxkzZiAiZGVlER0dTbNmzSguLmbfvn0AFBcXk5aWRocOHULxa4QEpRTExSNBLE8VEexJ\nL0NRIeqym7CenYR1/lWoFq2hbQdoGoMsD23Z55+mQkOrPUalpOpjly8OlixDFcj2LdhP3oVMfgM6\ndMZ6+BWsc65ARdVDpfSFlWmIxxMcLVnLoHM3VHhEtcdUBFl1oURVcjMAUJ27+XSeSqroazQlqgaD\nL0hJMfLpJOSrydh3X4P9zsuIMaMzGAzHAHUi0xgWFsbVV1/NE088gW3bnHTSSbRv356pU6cCMGrU\nKPr27cuiRYsYP348kZGR3HTTTQDs3r2b559/HgCPx8OwYcPo06dPyH6XUKDadUR+n4rYnqrNO5xm\n6ybYlYe69Cas4087WItSqJS+yKI5iMeje8CCjIjooDG5d427wKpFa2jZRge4I0YHUaHhQOT7z3Qf\n4bV3ogYMP6hUWHXvg/w+FdZkg4+Bkc86CvfChjWov1xU84GxraBhY22Gc8JpNR/rNqsyILoBtI7z\n6TTVNEbf+1nLYdRfXRJ
"text/plain": [
"<matplotlib.figure.Figure at 0x7f00ff450240>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"tm = np.arange(0,m)*dt # shift times for plotting\n",
"plt.subplot(211)\n",
"plt.plot(tm,rfq)\n",
"plt.ylabel(\"Q-RF\")\n",
"plt.subplot(212)\n",
"plt.plot(tm,rfl)\n",
"plt.xlabel(\"Time\")\n",
"plt.ylabel(\"L-RF\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Iterative deconvolution\n",
"Finally, we try iterative deconvolution where the time of the conversions is determined experimentally by searching for maxima of the cross-correlation between radial and vertical component."
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Iteration: 0 Location of max correlation: 45 Coefficient: -0.188064932852 RMS: 0.808067884685\n",
"Iteration: 10 Location of max correlation: 56 Coefficient: 0.0232878399425 RMS: 0.236482738022\n",
"Iteration: 20 Location of max correlation: 26 Coefficient: -0.0132327288213 RMS: 0.157940698442\n",
"Iteration: 30 Location of max correlation: 55 Coefficient: 0.00682842269855 RMS: 0.127478308995\n",
"Iteration: 40 Location of max correlation: 96 Coefficient: -0.00547868539688 RMS: 0.113284892005\n",
"Iteration: 50 Location of max correlation: 117 Coefficient: -0.00491286692813 RMS: 0.0989209837833\n",
"Iteration: 60 Location of max correlation: 45 Coefficient: 0.00363439542244 RMS: 0.0911542901353\n",
"Iteration: 70 Location of max correlation: 56 Coefficient: 0.00285406937047 RMS: 0.084300593319\n",
"Iteration: 80 Location of max correlation: 44 Coefficient: 0.00276115316265 RMS: 0.0791800623638\n",
"Iteration: 90 Location of max correlation: 45 Coefficient: 0.0022053005175 RMS: 0.0752592825827\n",
"Iteration: 100 Location of max correlation: 37 Coefficient: -0.00211030980769 RMS: 0.0713918083254\n",
"Iteration: 110 Location of max correlation: 92 Coefficient: 0.0022716970582 RMS: 0.0684080863292\n",
"Iteration: 120 Location of max correlation: 53 Coefficient: -0.00184308153988 RMS: 0.0657632835901\n",
"Iteration: 130 Location of max correlation: 124 Coefficient: 0.00138745498748 RMS: 0.0637757664872\n",
"Iteration: 140 Location of max correlation: 30 Coefficient: 0.00138958532611 RMS: 0.0622412721775\n",
"Iteration: 150 Location of max correlation: 45 Coefficient: 0.00145676616742 RMS: 0.0602417928777\n",
"Iteration: 160 Location of max correlation: 14 Coefficient: 0.0010268119389 RMS: 0.0586738835766\n",
"Iteration: 170 Location of max correlation: 12 Coefficient: -0.00139735070189 RMS: 0.0571199966087\n",
"Iteration: 180 Location of max correlation: 4 Coefficient: 0.00151602625314 RMS: 0.0553731496016\n",
"Iteration: 190 Location of max correlation: 45 Coefficient: 0.00130031181716 RMS: 0.0540243403414\n",
"Iteration: 200 Location of max correlation: 4 Coefficient: 0.00103009869364 RMS: 0.0528147877942\n",
"Iteration: 210 Location of max correlation: 37 Coefficient: -0.000981396173385 RMS: 0.0516961431046\n",
"Iteration: 220 Location of max correlation: 22 Coefficient: -0.000948845430963 RMS: 0.0504874410121\n"
]
}
],
"source": [
"itmax = 1000 # stop after itmax iterations\n",
"eps = 0.1 # or if coeff less than eps\n",
"zcomp = st[2] # rename traces\n",
"rcomp = st[1]\n",
"p = len(zcomp) # length of z and r\n",
"it = 0 # start with iteration 0\n",
"rnew = rcomp[:] # copy of radial component\n",
"norm = np.dot(rnew,rnew) # initial energy in radial component\n",
"zsh = np.zeros(p) # shifted zcomp allocated here\n",
"a = np.zeros(itmax) # space allocated for coefficients a\n",
"jmax = np.empty(itmax,dtype = int) # space allocated for conversion samples\n",
"while it < itmax: # iteration loop\n",
" czr = np.correlate(rnew,zcomp,mode = \"full\") # correlation of z with r according to our definition\n",
" jc = len(czr)//2 # positive lags start at j=q//2 = p-1\n",
" jmax[it] = np.argmax(np.abs(czr[jc:])) # location of absolute maximum of czr\n",
" zsh[:] = 0.0 # zero shifted z(t)\n",
" zsh[jmax[it]:] = zcomp[0:p-jmax[it]] # shifted z(t-tmax) cut at end\n",
" a[it] = np.dot(rnew,zsh)/np.dot(zsh,zsh) # compute coeficient\n",
" rnew = rnew-a[it]*zsh # subtract shifted z(t-tmax) from radial component\n",
" mf = np.sqrt(np.dot(rnew,rnew)/norm) # normalized residual amplitude in radial component\n",
" if it%10 == 0:\n",
" print(\"Iteration: \",it,\" Location of max correlation: \",jmax[it],\n",
" \" Coefficient: \",a[it],\" RMS: \",mf)\n",
" if abs(mf) < eps: break\n",
" it = it+1"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAAN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y1RvhOSB+NoboHmlt778gqRn62k\ndmcpIjEprHG+K8iWZsz/+SNkZGHccC9ikPpui8S1Lzeo8+lacCH1wgYOBzI7n7bSbXRG4P/K3PYN\nAI1xiQgf/ckoVQxpz47tNA8fG/5425V3usEW22c8maK+3x0bv0KMCu8a1fedgUMf+4FDH/uB42A9\n9rm5fvLb9+GgCGGVUvLEE0+Ql5fHySef7N0+ffp0li9fDsDy5cs5/PDDvdtXr15NV1cXNTU1VFZW\nUlRURGpqKvHx8WzduhUpJStWrGD69OkD8pk0Go3mO8GuEkhJRaSk9t6emASx8REJYZX1db4lH9ib\nB8mhlAdZ/A1IE2oqMZ+4G9ndFbGuZVW5etEjxFTk5ENFWWQK21RXQHwCJPnx+A1KAZsNnBF6MKqp\nhMFpiNi4vvtyhgARDM/VaDQajSUOCg/kli1bWLFiBUOGDOF3v/sdAOeeey4//vGPeeCBB1i6dKlX\nxgOgoKCAmTNncv3112MYBpdccgmGu5z4pZdeyqJFi+js7GTy5MlMmTLF77gajUZzsGO+vxjqqsGe\nhbBnqmIieYURC+mXZSV98h/BXaTEnomsqw5/kHoH+MhhA6CwCIRAlmxFjJ8W/ljfAeS2jWCzIc67\nHPnso8gX/xd++uvIdF5VDmn23qHCuQWw8n1oaoQwQz1ldQVk5vq9/oRhqMWCCGlBylofEh4e0uxq\nkUMbkIck5mcr4Ms1EBMLsbEQG4+YOQ+RO2Sgp6bRfO8J2oCUUtLU1ERSUlLEHmDGjBnDK6/4Lhd/\nyy23+Ny+YMECFixY0Gf
"text/plain": [
"<matplotlib.figure.Figure at 0x7f00ff4b94a8>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"tm = np.arange(0,p)*dt\n",
"plt.subplot(211)\n",
"plt.plot(tm,rcomp)\n",
"plt.ylabel(\"Q-Comp\")\n",
"plt.subplot(212)\n",
"plt.plot(tm,rnew)\n",
"plt.xlabel(\"Time\")\n",
"plt.ylabel(\"Residual\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA40AAAENCAYAAACre4DIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3Xl81NW9P/7X+cxkD9ljQtiEAAIKQowbLkCJ2NaldPO6\ndLlarfenVa9e+1WsaC3SS69aqrVWb0Vate21dqHVosVolVZUsIAoLiyCbEHISpbZP+f3x5nP7JPM\nJDP5fDLzej4ePDIz+czMyclkmPfn/T7vI6SUEkREREREREQxaGYPgIiIiIiIiKyLQSMRERERERHF\nxaCRiIiIiIiI4mLQSERERERERHExaCQiIiIiIqK4GDQSERERERFRXAwaiYiIiIiIKC4GjURERERE\nRBQXg0YiIiIiIiKKi0EjERERERERxWU3ewBmOnTokNlDiFJVVYXW1lazh5GVOPfm4dybh3NvHs69\nuTj/5uHcm4dzbx6rzn1dXV1CxzHTSERERERERHExaCQiIiIiIqK4GDQSERERERFRXAwaiYiIiIiI\nKC4GjURERERERBQXg0YiIiIiIiKKi0EjERERERERxcWgkYiSJtuOQL77L7OHQURERETDgEEjESVN\nvvI89P/9H7OHQURERETDgEEjESXP6QRcLkgpzR4JEREREaUZg0YiSp7XA0gd8HnNHgkRERERpRmD\nRiJKnsft/+oxdxxERERElHYMGokoadIIFo3gkYiIiIgyFoNGIkqe18g0MmgkIiIiynQMGokoecw0\nEhEREWUNBo1ElDyvETRyTSMRERFRpmPQSETJ87A8lYiIiChbMGgkouSxPJWIiIgoazBoJKLkMdNI\nRERElDUYNBJR8rimkYiIiChr2M0egGHr1q1YvXo1dF3HwoULsXjx4rDvHzx4EI888gj27NmDSy+9\nFBdffHHge9dffz3y8/OhaRpsNhtWrFgx3MMnyi7+YFG6XRAmD4WIiIiI0ssSQaOu61i1ahXuvPNO\nVFZWYsmSJWhsbMTYsWMDxxQXF+PKK6/Epk2bYj7G3XffjZKSkuEaMlF2M8pSvcw0EhEREWU6S5Sn\n7tq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NBKlkxE0Sl2VqY50keWpObmAm2saiYiIiDIZg0aidHKFrGV0\n9Jk3jlSJKE8VOblc00hERESU4Rg0EqVTaAOcDFjXKI1Moz10yw2uaSQiIiLKZAwaLUwe3AfZ12P2\nMGgonBmWafRGNMLJYSMcIiIiokzHoNHC9PuWQL74R7OHQUMRuo4xE4LGyO6pLE8lIiIiyngMGi1K\netxAbzfQ2W72UGgIZEimUWZE0BhZnspMIxEREVGmY9BoVb2qLJXlqSNchq1pjO6emgN4PZC6bt6Y\niIiIiCitGDRalT9oDHylkSk0aHRmQKYxsE+jXX01gkfu1UhERESUsRg0WpWRYWSmcWRzOQCbDRAi\nc9Y02nMghFDXjaCR6xqJiIiIMpbd7AFQHL3d6iuDxpHN6QDyCgApMyNo9HqCgSIQEjS6ABSbMiQi\nIiIiSi8GjRYVWMvI8tSRzekE8gvU5UwIGj3uYOdUIHiZmUYiIiKijMWg0aqMoNHjhvS4IUKzOzRi\nSJdDBY1CQGZKI5ywTGNe8HYiIiIiykhc02hVoRlGZhtHLqcDyMsHCgozI9Po9YZlGkUg08igkYiI\niChTMWi0KgaNmcHlL08tKMqIoFF63IA9tDzVWNPIoJGIiIgoUzFotKrQQJHNcEYupypPFfkFGRE0\nRpensnsqERERUabjmkaLkn09aqsGn49B40jmdEDkFQC5eUBGrGn0RDTCYaaRiIiIKNMx02hVvd1A\nRTUAQBrbb9DIYzTCyZQ
"text/plain": [
"<matplotlib.figure.Figure at 0x7f00ff900630>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"rfq = np.zeros(p)\n",
"for j,v in zip(jmax[0:it+1],a[0:it+1]):\n",
" rfq[j] = rfq[j]-v\n",
"#rfq = lowpass(rfq,0.8,5,zerophase = True)\n",
"plt.plot(tm,rfq)\n",
"plt.xlabel(\"Time\")\n",
"plt.ylabel(\"Q-RF\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}