Ticket #43: DEC3.SHC

File DEC3.SHC, 2.2 KB (added by subhrajit.das10, 10 years ago)

decon RF

Line 
1! DEC.SHC
2!
3! deconvolvs all 3-comp-traces appeared in window.
4! traces must be displayed by L,Q,T for each record.
5! the invers-filter is generated from each L-comp,
6! then the L-Q-T traces are folded with the invers-filter.
7
8default 1 ;;          first time of decon window
9default 2 ;;          second time of decon window
10default 3 1           control parameter of decon
11default 4 1           norm. (-1) before dcv or (0) none or (+1) after dcv?
12
13sdef cnt 1
14sdef cnt1
15sdef ntr
16sdef ntr1
17sdef max
18sdef min
19sdef normfac
20
21nr
22dtw
23
24! NMREC before DCV
25if #4 eqi -1              goto/forward do_norm0:
26if #4 eqi  0              goto/forward nm_exit0:
27if #4 eqi +1              goto/forward nm_exit0:
28echo bad input (the 4th parameter must be -1, 0 or 1)
29rd
30return
31
32do_norm0:
33calc i &cnt = 1
34calc i &cnt1 = 3
35nm_start0:
36if "cnt gti $dsptrcs      goto/forward nm_exit0:
37am "cnt #1 #2 &min &max
38calc r &max = "max - "min
39calc r &normfac = 1.0 div "max
40trcfct |"cnt|-|"cnt1| mul "normfac
41calc i &cnt = "cnt + 3
42calc i &cnt1 = "cnt1 + 3
43goto nm_start0:
44nm_exit0:
45
46! Deconvolution
47del h:all
48calc i &cnt = 1
49calc i &ntr = $dsptrcs
50calc i &ntr1 = $dsptrcs + 1
51decon_start:
52if  "cnt gti "ntr      goto/forward decon_exit:
53spiking 1 #1 #2 #3
54fold 1-3 ;;; "ntr1
55shift _created ^t-origin(1)
56del "ntr1
57hide 1-3
58calc i &cnt = "cnt + 3
59goto decon_start:
60decon_exit:
61
62! Aligning traces by letting L spikes at 0 sec.
63calc i &cnt = 1
64shift_start:
65if  "cnt gti $dsptrcs      goto/forward shift_exit:
66calc i &cnt1 = "cnt + 2
67am "cnt #1 #2 ;;;;&max
68calc r &max = 0 - "max
69shift |"cnt|-|"cnt1| "max
70calc i &cnt = "cnt + 3
71goto shift_start:
72shift_exit:
73
74! Multiplying -1 to the deconvoluted Q traces.
75calc i &cnt = 2
76mul_start:
77if  "cnt gti $dsptrcs      goto/forward mul_exit:
78trcfct "cnt mul -1
79calc i &cnt = "cnt + 3
80goto mul_start:
81mul_exit:
82
83! NMREC after DCV
84if #4 eqi -1              goto/forward nm_exit:
85if #4 eqi  0              goto/forward nm_exit:
86if #4 eqi +1              goto/forward do_norm:
87
88do_norm:
89calc i &cnt = 1
90calc i &cnt1 = 3
91nm_start:
92if "cnt gti $dsptrcs      goto/forward nm_exit:
93am "cnt -5 5 ;; &max
94calc r &normfac = 1.0 div "max
95trcfct |"cnt|-|"cnt1| mul "normfac
96calc i &cnt = "cnt + 3
97calc i &cnt1 = "cnt1 + 3
98goto nm_start:
99nm_exit:
100
101rd
102return