|
| 1 | +# coding: utf-8 |
| 2 | +# |
| 3 | +# SConstruct (Madagascar script) |
| 4 | +# |
| 5 | +# Purpose: Simulate and migrate diffraction hiperbolas |
| 6 | +# in the stacked section. |
| 7 | +# |
| 8 | +# Site: http://www.dirackslounge.online |
| 9 | +# |
| 10 | +# Version 1.0 |
| 11 | +# |
| 12 | +# Programer: Rodolfo Dirack 01/03/2020 |
| 13 | +# |
| 14 | +# Email: rodolfo_profissional@hotmail.com |
| 15 | +# |
| 16 | +# License: GPL-3.0 <https://www.gnu.org/licenses/gpl-3.0.txt>. |
| 17 | + |
| 18 | +from rsf.proj import * |
| 19 | +from diff import diffmig as diff |
| 20 | +import math |
| 21 | + |
| 22 | +# Return a list of spike positions in a |
| 23 | +# string format suitable for sfspike |
| 24 | +def formatListSpikes(lst): |
| 25 | + |
| 26 | + return str(lst).strip('[]').replace(' ','') |
| 27 | + |
| 28 | +# Generate a simulated zero offset section making a convolution of a line |
| 29 | +# of spikes with a ricker pulse |
| 30 | +Flow("spike",None, |
| 31 | + """ |
| 32 | + spike n1=1000 n2=1000 d1=0.004 d2=0.0125 o1=0 o2=0 k1=250 k2=0 l2=1000 mag=1 nsp=1 |
| 33 | + """) |
| 34 | + |
| 35 | +Flow("simulatedZeroOffset","spike", |
| 36 | + """ |
| 37 | + ricker1 frequency=10 |
| 38 | + """) |
| 39 | + |
| 40 | +Plot("simulatedZeroOffset", |
| 41 | + """ |
| 42 | + grey title="Simulated zero offset section" |
| 43 | + """) |
| 44 | + |
| 45 | +# Generate a diffraction hiperbola with a convolution |
| 46 | +# between a set of spikes with a ricker pulse |
| 47 | +t0 = 1 |
| 48 | +v = 1.5 |
| 49 | +td = [] |
| 50 | +dt = 0.004 |
| 51 | +dx = 0.0125 |
| 52 | +x0 = 1.5 |
| 53 | +xd = [] |
| 54 | + |
| 55 | +# Calculate the first hiperbola |
| 56 | +for i in range(200): |
| 57 | + |
| 58 | + x = x0 + dx*(i-100) |
| 59 | + |
| 60 | + xd.append(round(x/dx)) |
| 61 | + td.append(round((t0*t0 + ((x-x0)*(x-x0))/(v*v))/dt)) |
| 62 | + |
| 63 | +# shift the hiperbola to form the linearized reflection event |
| 64 | +# the hiperbolas shift sampling is 0.5km = 40 * 0.0125km |
| 65 | +spikeFiles = [] |
| 66 | +hiperbolaFiles = [] |
| 67 | +for j in range(15): |
| 68 | + |
| 69 | + hiperbolaSpikes = "hiperbolaSpikes%d" % j |
| 70 | + |
| 71 | + hiperbolas = "hiperbola%d" % j |
| 72 | + |
| 73 | + xd = map(lambda l: l + 40,xd) |
| 74 | + |
| 75 | + Flow(hiperbolaSpikes,None, |
| 76 | + """ |
| 77 | + spike n1=1000 n2=1000 d1=0.004 d2=0.0125 o1=0 o2=0 k1=%s k2=%s nsp=%d |
| 78 | + """ % (formatListSpikes(td),formatListSpikes(xd),len(xd))) |
| 79 | + |
| 80 | + Flow(hiperbolas,hiperbolaSpikes, |
| 81 | + """ |
| 82 | + ricker1 frequency=10 |
| 83 | + """) |
| 84 | + |
| 85 | + hiperbolaFiles.append(hiperbolas) |
| 86 | + |
| 87 | +# Add generated hiperbolas in just one section |
| 88 | +Flow("hiperbola", hiperbolaFiles, |
| 89 | + """ |
| 90 | + add ${SOURCES[0:%d]} |
| 91 | + """ % len(hiperbolaFiles)) |
| 92 | + |
| 93 | +Plot("hiperbola", |
| 94 | + """ |
| 95 | + grey title="Diffraction hiperbola" |
| 96 | + """) |
| 97 | + |
| 98 | +# Add reflection and diffraction hiperbolas |
| 99 | +Flow("diffResponse","simulatedZeroOffset hiperbola", |
| 100 | + """ |
| 101 | + add ${SOURCES[1]} scale=1,1 |
| 102 | + """) |
| 103 | + |
| 104 | +Plot("diffResponse", |
| 105 | + """ |
| 106 | + grey title="Simulated diffraction response" |
| 107 | + """) |
| 108 | + |
| 109 | +diff("diff", |
| 110 | + "hiperbola", |
| 111 | + v0=1.5, |
| 112 | + nv=200, |
| 113 | + dv=0.1, |
| 114 | + nx=1000, |
| 115 | + padx=1000, |
| 116 | + nt=1000, |
| 117 | + tmin=0, |
| 118 | + tmax=10, |
| 119 | + rect1=10, |
| 120 | + rect2=10, |
| 121 | + srect1=1, |
| 122 | + srect2=3, |
| 123 | + vslope=None, |
| 124 | + units='Km', |
| 125 | + f1=1, |
| 126 | + j3=1, |
| 127 | + dx=1, |
| 128 | + x0=0, |
| 129 | + beg1=0, |
| 130 | + frect1=0, |
| 131 | + frect2=0, |
| 132 | + an=1, |
| 133 | + nout=2048, |
| 134 | + vx0=None) |
| 135 | + |
| 136 | + |
| 137 | +End() |
0 commit comments