1+ from rsf .proj import *
2+ import numpy as np
3+ import m8r
4+ import matplotlib .pyplot as plt
5+
6+
7+ def generateSynthetic (source = None , target = None , env = None ):
8+ nx = 27
9+ dt = .001
10+ nt = int (2 // dt ) + 1
11+ traces = np .zeros ((nx , nt ))
12+ timeIndex = np .arange (381 , 1006 , 24 , dtype = int )
13+ for ix in range (nx ):
14+ traces [ix , timeIndex [ix ]] = 1
15+
16+ timeIndex = np .arange (526 , 735 , 8 , dtype = int ) #np.linspace(.525//dt + 1, .73//dt + 1, 27, dtype=int)
17+ # print(timeIndex[25])
18+ for ix in range (nx ):
19+ traces [ix , timeIndex [ix ]] = 1
20+
21+ timeIndex = np .flip (np .arange (801 , 1634 , 32 , dtype = int ))
22+ for ix in range (nx ):
23+ traces [ix , timeIndex [ix ]] = 1
24+ traces [ix , timeIndex [ix ]- int (.025 // dt )] = 1
25+ traces [ix , timeIndex [ix ]- int (.05 // dt )] = 1
26+
27+ # plt.imshow(traces, aspect='auto', cmap="gray")
28+ # plt.show()
29+
30+ np .random .seed (2024 )
31+ indx1 = np .random .randint (100 , nt - 100 , size = 45 )
32+ indx2 = np .random .randint (0 , nx - 1 , size = 45 )
33+
34+ for i in range (45 ):
35+ traces [indx2 [i ], indx1 [i ]] = 1
36+
37+
38+ out = m8r .Output (str (target [0 ]))
39+ out .put ('n1' , nt )
40+ out .put ('n2' , nx )
41+ out .put ('d1' , dt )
42+ out .put ('d2' , 1 )
43+ out .put ('o1' , 0 )
44+ out .put ('o2' , 0 )
45+ out .write (traces )
46+ out .close ()
47+ return 0
48+
49+ Command ('synthetic1.rsf' , None , action = Action (generateSynthetic ))
50+
51+ Flow ('synthetic' , 'synthetic1.rsf' , 'ricker1 freq=.1 | noise seed=2024 var=1e-6' )
52+
53+ Plot ('synthetic' , 'synthetic' , 'wiggle transp=y yreverse=y title=Before poly=y zplot=.25 parallel2=y d1num=0.5 label1=Time label2=Trace unit1=s unit2= wheretitle=t wherexlabel=b' )
54+
55+ Flow ('synthFK' ,'synthetic' ,'spectra2' )
56+
57+ Result ('synthFK' ,'synthFK' ,'window max1=125 | wiggle transp=y yreverse=n xreverse=y screenwd=5 screenht=10 wanttitle=n poly=y plcip=100 parallel2=y d1num=0.5' )
58+
59+ Flow ('synthInt' ,'synthetic' ,'spitz verb=y' )
60+
61+ Plot ('synthInt' , 'wiggle transp=y yreverse=y title=After poly=y zplot=.25 parallel2=y d1num=0.5 label1=Time label2=Trace unit1=s unit2= wheretitle=t wherexlabel=b' )
62+
63+ Result ('synth' ,'synthetic synthInt' ,'SideBySideAniso' )
64+
65+ Flow ('synthIntFK' ,'synthInt' ,'spectra2' )
66+
67+ Result ('synthIntFK' ,'window max1=125 | wiggle transp=y yreverse=n xreverse=y screenwd=5 screenht=10 wanttitle=n poly=y plcip=100 parallel2=y d1num=0.5' )
68+
69+ Plot ('synthFK-grey' ,'synthFK' ,'window max1=125 | grey transp=y yreverse=n xreverse=y title=Before parallel2=y d1num=0.5 label1=Frequency label2="Wave number" unit1=Hz unit2=cycles wheretitle=t wherexlabel=b allpos=y' )
70+
71+ Plot ('synthIntFK-grey' ,'synthIntFK' ,'window max1=125 | grey transp=y yreverse=n xreverse=y title=After parallel2=y d1num=0.5 label1=Frequency label2="Wave number" unit1=Hz unit2=cycles wheretitle=t wherexlabel=b allpos=y' )
72+
73+ Result ('FK' , 'synthFK-grey synthIntFK-grey' ,'SideBySideAniso' )
74+
75+
76+ def generateSynthetic2 (source = None , target = None , env = None ):
77+ nx = 48
78+ dt = .001
79+ nt = int (2.5 // dt ) + 1
80+ traces = np .zeros ((nx , nt ))
81+ t0 = .1
82+ timeIndex = (np .sqrt ((t0 // dt )** 2 + np .power (np .arange (nx ), 2 ) / .01 )).astype (int )
83+ for ix in range (nx ):
84+ traces [ix , timeIndex [ix ]] = 1
85+
86+ timeIndex += int (.5 // dt )
87+ for ix in range (nx ):
88+ traces [ix , timeIndex [ix ]] = 1
89+
90+ timeIndex += int (.5 // dt )
91+ for ix in range (nx ):
92+ traces [ix , timeIndex [ix ]] = 1
93+
94+ timeIndex += int (.5 // dt )
95+ for ix in range (nx ):
96+ traces [ix , timeIndex [ix ]] = 1
97+
98+ timeIndex += int (.5 // dt )
99+ for ix in range (nx ):
100+ traces [ix , timeIndex [ix ]] = 1
101+
102+ t0 = 2
103+ timeIndex = (np .sqrt ((t0 // dt )** 2 + np .power (np .arange (nx ), 2 ) / .001 )).astype (int )
104+ for ix in range (nx ):
105+ traces [ix , timeIndex [ix ]] = 1
106+
107+ t0 = 2.3
108+ timeIndex = (np .sqrt ((t0 // dt )** 2 - np .power (np .arange (nx ), 2 ) / .001 )).astype (int )
109+ for ix in range (nx ):
110+ traces [ix , timeIndex [ix ]] = 1
111+
112+ timeIndex -= int (.3 // dt )
113+ for ix in range (nx ):
114+ traces [ix , timeIndex [ix ]] = 1
115+
116+ timeIndex -= int (.3 // dt )
117+ for ix in range (nx ):
118+ traces [ix , timeIndex [ix ]] = 1
119+
120+ timeIndex -= int (.3 // dt )
121+ for ix in range (nx ):
122+ traces [ix , timeIndex [ix ]] = 1
123+
124+ timeIndex -= int (.3 // dt )
125+ for ix in range (nx ):
126+ traces [ix , timeIndex [ix ]] = 1
127+
128+ timeIndex -= int (.3 // dt )
129+ for ix in range (nx ):
130+ traces [ix , timeIndex [ix ]] = 1
131+
132+ timeIndex -= int (.3 // dt )
133+ for ix in range (nx ):
134+ traces [ix , timeIndex [ix ]] = 1
135+
136+ timeIndex -= int (.3 // dt )
137+ for ix in range (20 ):
138+ traces [ix , timeIndex [ix ]] = 1
139+
140+ # plt.imshow(traces, aspect='auto', cmap="gray")
141+ # plt.show()
142+
143+ out = m8r .Output (str (target [0 ]))
144+ out .put ('n1' , nt )
145+ out .put ('n2' , nx )
146+ out .put ('d1' , dt )
147+ out .put ('d2' , 1 )
148+ out .put ('o1' , 0 )
149+ out .put ('o2' , 0 )
150+ out .write (traces )
151+
152+ Command ('synthetic2.rsf' , None , action = Action (generateSynthetic2 ))
153+
154+ Flow ('synth2' , 'synthetic2.rsf' , 'ricker1 freq=.1 | mutter v0=100 x0=5' )
155+
156+ Result ('synth2' , 'wiggle transp=y yreverse=y screenwd=5 screenht=10 wanttitle=n poly=y zplot=.25 parallel2=y d1num=0.5' )
157+
158+ Flow ('synthInt2' ,'synth2' ,'spitz' )
159+
160+ Result ('synthInt2' , 'wiggle transp=y yreverse=y screenwd=5 screenht=10 wanttitle=n poly=y zplot=.25 parallel2=y d1num=0.5' )
161+
162+ Flow ('synthInt2ns' ,'synth2' ,'spitzns' )
163+
164+ Result ('synthInt2ns' , 'wiggle transp=y yreverse=y screenwd=5 screenht=10 wanttitle=n poly=y zplot=.25 parallel2=y d1num=0.5' )
165+
166+
167+ End ()
0 commit comments