|
@@ -7,6 +7,12 @@ from pylab import meshgrid
|
7
|
7
|
from akvo.tressel.logbarrier import *
|
8
|
8
|
import yaml,os
|
9
|
9
|
|
|
10
|
+import multiprocessing
|
|
11
|
+import itertools
|
|
12
|
+
|
|
13
|
+from scipy.linalg import svd
|
|
14
|
+
|
|
15
|
+from matplotlib.backends.backend_pdf import PdfPages
|
10
|
16
|
from matplotlib.colors import LogNorm
|
11
|
17
|
from matplotlib.colors import LightSource
|
12
|
18
|
from matplotlib.ticker import ScalarFormatter
|
|
@@ -134,46 +140,28 @@ def main():
|
134
|
140
|
K0[0] = np.concatenate( (K0[0].T, K0[ik].T) ).T
|
135
|
141
|
K0 = K0[0]
|
136
|
142
|
|
|
143
|
+ #np.save("ifaces", ifaces)
|
|
144
|
+ #exit()
|
|
145
|
+
|
137
|
146
|
#plt.matshow(np.real(K0))
|
138
|
147
|
#plt.show()
|
139
|
148
|
#exit()
|
140
|
149
|
|
141
|
|
- ###################
|
142
|
|
- # VERY Simple DOI #
|
|
150
|
+ ##########################################################
|
|
151
|
+ # VERY Simple Sensitivity based calc. of noise per layer #
|
143
|
152
|
maxq = np.argmax(np.abs(K0), axis=1)
|
144
|
153
|
maxK = .1 * np.abs(K0)[ np.arange(0,len(ifaces)-1), maxq ] # 10% water is arbitrary
|
145
|
154
|
SNR = maxK / (VS[0][0])
|
146
|
155
|
|
147
|
|
- #SNR[SNR>1] = 1
|
148
|
|
- SNRidx = len(ifaces)-3
|
149
|
|
- while SNR[SNRidx] > SNR[SNRidx+1] and SNRidx > 2:
|
150
|
|
- SNRidx -= 1
|
151
|
|
-
|
152
|
|
- #print("IDX", SNRidx)
|
153
|
|
- #plt.plot(ifaces[0:-1], SNR)
|
154
|
|
- #plt.plot(ifaces[0:-1][SNRidx], SNR[SNRidx], '.',markersize=12)
|
155
|
|
- #plt.gca().axhline(y=VS[0][0], xmin=0, xmax=ifaces[-1], color='r')
|
156
|
|
- #plt.gca().axhline(y=1, xmin=0, xmax=ifaces[-1], color='r')
|
157
|
|
- #K0T = np.dot(K0, K0.T)
|
158
|
|
- #K0T = np.dot(K0, np.dot( VS[0][0]* np.eye(len(ifaces)-1,1), K0.T) )
|
159
|
|
- #K0T = np.dot(K0, np.dot( 1/(VS[0][0]**2) * np.eye(np.shape(K0)[1]), K0.T) )
|
160
|
|
- #plt.matshow(0.05 * np.sqrt(K0T))
|
161
|
|
- #plt.colorbar()
|
162
|
|
- #plt.plot(ifaces[0:-1], np.diag( 0.01* np.sqrt(K0T)))
|
163
|
|
- #print(np.shape(K0T), len(ifaces)-1)
|
164
|
|
- #plt.show()
|
165
|
|
- #exit()
|
166
|
|
-
|
167
|
156
|
###############################################
|
168
|
157
|
# Build full kernel
|
169
|
158
|
###############################################
|
170
|
|
- T2Bins = np.logspace( np.log10(cont["T2Bins"]["low"]), np.log10(cont["T2Bins"]["high"]), cont["T2Bins"]["number"], endpoint=True, base=10)
|
171
|
|
- KQT = np.real(buildKQT(np.abs(K0),tg,T2Bins))
|
172
|
159
|
|
173
|
|
- # model resolution matrix
|
174
|
|
- np.linalg.svd(KQT)
|
|
160
|
+ T2Bins = np.logspace( np.log10(cont["T2Bins"]["low"]), np.log10(cont["T2Bins"]["high"]), cont["T2Bins"]["number"], endpoint=True, base=10)
|
|
161
|
+ T2Bins2 = np.append( T2Bins, T2Bins[-1] + (T2Bins[-1]-T2Bins[-2]) )
|
|
162
|
+ NT2 = len(T2Bins)
|
175
|
163
|
|
176
|
|
- exit()
|
|
164
|
+ KQT = np.real(buildKQT(np.abs(K0),tg,T2Bins))
|
177
|
165
|
|
178
|
166
|
###############################################
|
179
|
167
|
# Linear Inversion
|
|
@@ -181,66 +169,148 @@ def main():
|
181
|
169
|
print("Calling inversion", flush=True)
|
182
|
170
|
inv, ibreak, errn, phim, phid, mkappa, Wd, Wm, alphastar = logBarrier(KQT, np.ravel(V), T2Bins, "lcurve", MAXITER=150, sigma=np.ravel(VS), alpha=1e6, smooth="Smallest" )
|
183
|
171
|
|
184
|
|
- ###############################################
|
185
|
|
- # Non-linear refinement!
|
186
|
|
- ###############################################
|
187
|
|
-
|
188
|
|
- KQTc = buildKQT(K0, tg, T2Bins)
|
189
|
|
- prec = np.abs(np.dot(KQTc, inv))
|
190
|
|
- phidc = np.linalg.norm(np.dot(Wd,prec-np.ravel(V)))**2
|
191
|
|
- #PREc = np.reshape( prec, np.shape(V) )
|
192
|
|
- print("PHID linear=", errn, "PHID complex=", phidc/len(np.ravel(V)))
|
193
|
|
-
|
194
|
|
- res = nl.nonlinearinversion(inv, Wd, KQTc, np.ravel(V), Wm, alphastar )
|
195
|
|
- if res.success == True:
|
196
|
|
- INVc = np.reshape(res.x, (len(ifaces)-1,cont["T2Bins"]["number"]) )
|
197
|
|
- prec = np.abs(np.dot(KQTc, res.x))
|
198
|
|
- phidc = np.linalg.norm(np.dot(Wd,prec-np.ravel(V)))**2
|
199
|
|
- #PREc = np.reshape( prec, np.shape(V) )
|
200
|
|
- print("PHID linear=", errn, "PHID nonlinear=", phidc/len(np.ravel(V)))
|
201
|
|
-
|
202
|
|
- # Perform second fit around results of first
|
203
|
|
- res = nl.nonlinearinversion(res.x, Wd, KQTc, np.ravel(V), Wm, alphastar )
|
204
|
|
- if res.success == True:
|
205
|
|
- INVc = np.reshape(res.x, (len(ifaces)-1,cont["T2Bins"]["number"]) )
|
206
|
|
- prec = np.abs(np.dot(KQTc, res.x))
|
207
|
|
- phidc = np.linalg.norm(np.dot(Wd,prec-np.ravel(V)))**2
|
208
|
|
- #PREc = np.reshape( prec, np.shape(V) )
|
209
|
|
- print("PHID linear=", errn, "PHID nonlinear=", phidc/len(np.ravel(V)))
|
210
|
|
-
|
211
|
|
- #plt.matshow(INVc)
|
212
|
|
- #KQTc = buildKQT(K0,tg,T2Bins)
|
213
|
|
-
|
214
|
|
- #plt.matshow(PREc, cmap='Blues')
|
215
|
|
- #plt.gca().set_title("complex predicted")
|
216
|
|
- #plt.colorbar()
|
217
|
|
-
|
218
|
|
- ###############################################
|
219
|
|
- # Appraise
|
220
|
|
- ###############################################
|
221
|
|
-
|
222
|
172
|
|
223
|
|
-
|
224
|
|
-
|
225
|
|
-
|
|
173
|
+ ####################
|
|
174
|
+ # Summary plots #
|
|
175
|
+ ####################
|
|
176
|
+
|
226
|
177
|
pre = np.dot(KQT,inv)
|
227
|
178
|
PRE = np.reshape( pre, np.shape(V) )
|
228
|
179
|
plt.matshow(PRE, cmap='Blues')
|
229
|
|
- plt.gca().set_title("predicted")
|
|
180
|
+ plt.gca().set_title("linear predicted")
|
230
|
181
|
plt.colorbar()
|
231
|
182
|
|
232
|
183
|
DIFF = (PRE-V) / VS
|
233
|
184
|
md = np.max(np.abs(DIFF))
|
234
|
185
|
plt.matshow(DIFF, cmap=cmocean.cm.balance, vmin=-md, vmax=md)
|
235
|
|
- plt.gca().set_title("misfit / $\widehat{\sigma}$")
|
|
186
|
+ plt.gca().set_title("linear misfit / $\widehat{\sigma}$")
|
236
|
187
|
plt.colorbar()
|
237
|
188
|
|
238
|
189
|
plt.matshow(V, cmap='Blues')
|
239
|
190
|
plt.gca().set_title("observed")
|
240
|
191
|
plt.colorbar()
|
241
|
192
|
|
|
193
|
+ ###############################################
|
|
194
|
+ # Non-linear refinement!
|
|
195
|
+ ###############################################
|
|
196
|
+
|
|
197
|
+ nonLinearRefinement = cont['NonLinearRefinement']
|
|
198
|
+ if nonLinearRefinement:
|
|
199
|
+
|
|
200
|
+ KQTc = buildKQT(K0, tg, T2Bins)
|
|
201
|
+ prec = np.abs(np.dot(KQTc, inv))
|
|
202
|
+ phidc = np.linalg.norm(np.dot(Wd,prec-np.ravel(V)))**2
|
|
203
|
+ print("PHID forward linear=", errn, "PHID forward nonlinear=", phidc/len(np.ravel(V)))
|
|
204
|
+
|
|
205
|
+ res = nl.nonlinearinversion(inv, Wd, KQTc, np.ravel(V), Wm, alphastar )
|
|
206
|
+ if res.success == True:
|
|
207
|
+ INVc = np.reshape(res.x, (len(ifaces)-1,cont["T2Bins"]["number"]) )
|
|
208
|
+ prec = np.abs(np.dot(KQTc, res.x))
|
|
209
|
+ phidc = np.linalg.norm(np.dot(Wd,prec-np.ravel(V)))**2
|
|
210
|
+ PREc = np.reshape( prec, np.shape(V) )
|
|
211
|
+ print("PHID linear=", errn, "PHID nonlinear=", phidc/len(np.ravel(V)))
|
|
212
|
+
|
|
213
|
+ while phidc/len(np.ravel(V)) > errn:
|
|
214
|
+ phidc_old = phidc/len(np.ravel(V))
|
|
215
|
+ #alphastar *= .9
|
|
216
|
+ res = nl.nonlinearinversion(res.x, Wd, KQTc, np.ravel(V), Wm, alphastar )
|
|
217
|
+ if res.success == True:
|
|
218
|
+ INVc = np.reshape(res.x, (len(ifaces)-1,cont["T2Bins"]["number"]) )
|
|
219
|
+ prec = np.abs(np.dot(KQTc, res.x))
|
|
220
|
+ phidc = np.linalg.norm(np.dot(Wd,prec-np.ravel(V)))**2
|
|
221
|
+ PREc = np.reshape( prec, np.shape(V) )
|
|
222
|
+ print("PHID linear=", errn, "PHID nonlinear=", phidc/len(np.ravel(V)))
|
|
223
|
+ else:
|
|
224
|
+ break
|
|
225
|
+
|
|
226
|
+ if phidc_old - phidc/len(np.ravel(V)) < 0.005:
|
|
227
|
+ print("Not making progress reducing misfit in nonlinear refinement")
|
|
228
|
+ break
|
|
229
|
+
|
|
230
|
+ plt.matshow(PREc, cmap='Blues')
|
|
231
|
+ plt.gca().set_title("nonlinear predicted")
|
|
232
|
+ plt.colorbar()
|
|
233
|
+
|
|
234
|
+ DIFFc = (PREc-V) / VS
|
|
235
|
+ md = np.max(np.abs(DIFF))
|
|
236
|
+ plt.matshow(DIFFc, cmap=cmocean.cm.balance, vmin=-md, vmax=md)
|
|
237
|
+ plt.gca().set_title("nonlinear misfit / $\widehat{\sigma}$")
|
|
238
|
+ plt.colorbar()
|
|
239
|
+
|
|
240
|
+ ###############################################
|
|
241
|
+ # Appraise DOI using simplified MRM
|
|
242
|
+ ###############################################
|
|
243
|
+
|
|
244
|
+ CalcDOI = cont['CalcDOI']
|
|
245
|
+
|
|
246
|
+ if CalcDOI:
|
|
247
|
+
|
|
248
|
+ pdf = PdfPages('resolution_analysis' + '.pdf' )
|
|
249
|
+ MRM = np.zeros((len(ifaces)-1, len(ifaces)-1))
|
|
250
|
+
|
|
251
|
+ #with multiprocessing.Pool() as pool:
|
|
252
|
+ # invresults = pool.starmap(invert, zip(itertools.repeat(Time), GT[0:ni], GD[0:ni], SIG[0:ni], itertools.repeat(sys.argv[3]) ))
|
|
253
|
+
|
|
254
|
+ # This could be parallelized
|
|
255
|
+ for ilay in range(len(ifaces)-1):
|
|
256
|
+ iDeltaT2 = len(T2Bins)//2
|
|
257
|
+ deltaMod = np.zeros( (len(ifaces)-1, len(T2Bins)) )
|
|
258
|
+ deltaMod[ilay][iDeltaT2] = 0.3
|
|
259
|
+ dV = np.dot(KQT, np.ravel(deltaMod))
|
|
260
|
+ # invert
|
|
261
|
+ dinv, dibreak, derrn = logBarrier(KQT, dV, T2Bins, "single", MAXITER=1, sigma=np.ravel(VS), alpha=alphastar, smooth="Smallest" )
|
|
262
|
+ print("Sum dinv from", str(ifaces[ilay]), "to", str(ifaces[ilay+1]), "=", np.sum(dinv))
|
|
263
|
+
|
|
264
|
+ DINV = np.reshape(dinv, (len(ifaces)-1,cont["T2Bins"]["number"]) )
|
|
265
|
+ MRM[ilay,:] = np.sum(DINV, axis=1)
|
|
266
|
+
|
|
267
|
+ Y,X = meshgrid( ifaces, T2Bins2 )
|
|
268
|
+ fig = plt.figure( figsize=(pc2in(20.0),pc2in(22.)) )
|
|
269
|
+ ax1 = fig.add_axes( [.2,.15,.6,.7] )
|
|
270
|
+ im = ax1.pcolor(X, Y, DINV.T, cmap=cmocean.cm.tempo, shading='auto')
|
|
271
|
+ ax1.plot( T2Bins[iDeltaT2], (ifaces[ilay]+ifaces[ilay+1])/2, 's', markersize=6, markeredgecolor='black') #, markerfacecolor=None )
|
|
272
|
+ im.set_edgecolor('face')
|
|
273
|
+ ax1.set_xlabel(u"$T_2^*$ (ms)")
|
|
274
|
+ ax1.set_ylabel(u"depth (m)")
|
|
275
|
+ ax1.set_xlim( T2Bins2[0], T2Bins2[-1] )
|
|
276
|
+ ax1.set_ylim( ifaces[-1], ifaces[0] )
|
|
277
|
+
|
|
278
|
+ ax2 = ax1.twiny()
|
|
279
|
+ ax2.plot( np.sum(DINV, axis=1), (ifaces[1:]+ifaces[0:-1])/2 , color='red' )
|
|
280
|
+ ax2.set_xlabel(u"total water (m$^3$/m$^3$)")
|
|
281
|
+ ax2.set_ylim( ifaces[-1], ifaces[0] )
|
|
282
|
+ ax2.xaxis.set_major_locator( MaxNLocator(nbins = 3) )
|
|
283
|
+ ax2.get_xaxis().set_major_formatter(FormatStrFormatter('%0.2f'))
|
|
284
|
+
|
|
285
|
+ pdf.savefig(facecolor=[0,0,0,0])
|
|
286
|
+ plt.close(fig)
|
|
287
|
+
|
|
288
|
+ np.save("MRM", MRM)
|
|
289
|
+ centres = (ifaces[0:-1]+ifaces[1:])/2
|
|
290
|
+ X,Y = np.meshgrid(ifaces,ifaces)
|
|
291
|
+
|
|
292
|
+ fig = plt.figure( figsize=(pc2in(20.0),pc2in(22.)) )
|
|
293
|
+ ax1 = fig.add_axes( [.2,.15,.6,.7] )
|
|
294
|
+ ax1.pcolor(X,Y,MRM, cmap = cmocean.cm.ice)
|
|
295
|
+ ax1.set_ylim(ifaces[-1], ifaces[0])
|
|
296
|
+ maxDepth = np.argmax(MRM, axis=0)
|
|
297
|
+
|
|
298
|
+ plt.plot(centres[maxDepth], centres, color='white')
|
|
299
|
+
|
|
300
|
+ # Determine DOI
|
|
301
|
+ DOIMetric = centres[maxDepth]/centres #> 0.9
|
|
302
|
+ DOI = ifaces[ np.where(DOIMetric < 0.9 ) ][0]
|
|
303
|
+ plt.axhline(y=DOI, color='white', linestyle='-.')
|
|
304
|
+
|
|
305
|
+ ax1.set_ylim( ifaces[-1], ifaces[0] )
|
|
306
|
+ ax1.set_xlim( ifaces[0], ifaces[-1] )
|
|
307
|
+ ax1.set_xlabel(u"depth (m)")
|
|
308
|
+ ax1.set_ylabel(u"depth (m)")
|
|
309
|
+
|
|
310
|
+ pdf.close()
|
|
311
|
+
|
|
312
|
+
|
242
|
313
|
|
243
|
|
- T2Bins = np.append( T2Bins, T2Bins[-1] + (T2Bins[-1]-T2Bins[-2]) )
|
244
|
314
|
INV = np.reshape(inv, (len(ifaces)-1,cont["T2Bins"]["number"]) )
|
245
|
315
|
|
246
|
316
|
#alphas = np.tile(SNR, (len(T2Bins)-1,1))
|
|
@@ -254,7 +324,7 @@ def main():
|
254
|
324
|
|
255
|
325
|
############## LINEAR RESULT ##########################
|
256
|
326
|
|
257
|
|
- Y,X = meshgrid( ifaces, T2Bins )
|
|
327
|
+ Y,X = meshgrid( ifaces, T2Bins2 )
|
258
|
328
|
fig = plt.figure( figsize=(pc2in(20.0),pc2in(22.)) )
|
259
|
329
|
ax1 = fig.add_axes( [.2,.15,.6,.7] )
|
260
|
330
|
im = ax1.pcolor(X, Y, INV.T, cmap=cmocean.cm.tempo) #cmap='viridis')
|
|
@@ -264,7 +334,7 @@ def main():
|
264
|
334
|
#im = ax1.pcolormesh(X, Y, INV.T, alpha=alphas) #, cmap=cmocean.cm.tempo) #cmap='viridis')
|
265
|
335
|
#ax1.axhline( y=ifaces[SNRidx], xmin=T2Bins[0], xmax=T2Bins[-1], color='black' )
|
266
|
336
|
im.set_edgecolor('face')
|
267
|
|
- ax1.set_xlim( T2Bins[0], T2Bins[-1] )
|
|
337
|
+ ax1.set_xlim( T2Bins[0], T2Bins2[-1] )
|
268
|
338
|
ax1.set_ylim( ifaces[-1], ifaces[0] )
|
269
|
339
|
cb = plt.colorbar(im, label = u"PWC (m$^3$/m$^3$)") #, format='%1.1f')
|
270
|
340
|
cb.locator = MaxNLocator( nbins = 4)
|
|
@@ -286,7 +356,9 @@ def main():
|
286
|
356
|
ax2.set_ylim( ifaces[-1], ifaces[0] )
|
287
|
357
|
ax2.xaxis.set_major_locator( MaxNLocator(nbins = 3) )
|
288
|
358
|
ax2.get_xaxis().set_major_formatter(FormatStrFormatter('%0.2f'))
|
289
|
|
- ax2.axhline( y=ifaces[SNRidx], xmin=0, xmax=1, color='black', linestyle='dashed' )
|
|
359
|
+ #ax2.axhline( y=ifaces[SNRidx], xmin=0, xmax=1, color='black', linestyle='dashed' )
|
|
360
|
+ if CalcDOI:
|
|
361
|
+ ax2.axhline( y=DOI, xmin=0, xmax=1, color='black', linestyle='dashed' )
|
290
|
362
|
#ax2.xaxis.set_label_position('bottom')
|
291
|
363
|
|
292
|
364
|
plt.savefig("akvoInversion.pdf")
|
|
@@ -294,44 +366,45 @@ def main():
|
294
|
366
|
|
295
|
367
|
############## NONLINEAR RESULT ##########################
|
296
|
368
|
|
297
|
|
- Y,X = meshgrid( ifaces, T2Bins )
|
298
|
|
- fig = plt.figure( figsize=(pc2in(20.0),pc2in(22.)) )
|
299
|
|
- ax1 = fig.add_axes( [.2,.15,.6,.7] )
|
300
|
|
- im = ax1.pcolor(X, Y, INVc.T, cmap=cmocean.cm.tempo) #cmap='viridis')
|
301
|
|
- #im = ax1.pcolor(X[0:SNRidx,:], Y[0:SNRidx,:], INV.T[0:SNRidx,:], cmap=cmocean.cm.tempo) #cmap='viridis')
|
302
|
|
- #im = ax1.pcolor(X[SNRidx::,:], Y[SNRidx::,:], INV.T[SNRidx::,:], cmap=cmocean.cm.tempo, alpha=.5) #cmap='viridis')
|
303
|
|
- #im = ax1.pcolormesh(X, Y, INV.T, alpha=alphas) #, cmap=cmocean.cm.tempo) #cmap='viridis')
|
304
|
|
- #im = ax1.pcolormesh(X, Y, INV.T, alpha=alphas) #, cmap=cmocean.cm.tempo) #cmap='viridis')
|
305
|
|
- #ax1.axhline( y=ifaces[SNRidx], xmin=T2Bins[0], xmax=T2Bins[-1], color='black' )
|
306
|
|
- im.set_edgecolor('face')
|
307
|
|
- ax1.set_xlim( T2Bins[0], T2Bins[-1] )
|
308
|
|
- ax1.set_ylim( ifaces[-1], ifaces[0] )
|
309
|
|
- cb = plt.colorbar(im, label = u"PWC (m$^3$/m$^3$)") #, format='%1.1f')
|
310
|
|
- cb.locator = MaxNLocator( nbins = 4)
|
311
|
|
- cb.ax.yaxis.set_offset_position('left')
|
312
|
|
- cb.update_ticks()
|
|
369
|
+ if nonLinearRefinement:
|
|
370
|
+ Y,X = meshgrid( ifaces, T2Bins )
|
|
371
|
+ fig = plt.figure( figsize=(pc2in(20.0),pc2in(22.)) )
|
|
372
|
+ ax1 = fig.add_axes( [.2,.15,.6,.7] )
|
|
373
|
+ im = ax1.pcolor(X, Y, INVc.T, cmap=cmocean.cm.tempo) #cmap='viridis')
|
|
374
|
+ #im = ax1.pcolor(X[0:SNRidx,:], Y[0:SNRidx,:], INV.T[0:SNRidx,:], cmap=cmocean.cm.tempo) #cmap='viridis')
|
|
375
|
+ #im = ax1.pcolor(X[SNRidx::,:], Y[SNRidx::,:], INV.T[SNRidx::,:], cmap=cmocean.cm.tempo, alpha=.5) #cmap='viridis')
|
|
376
|
+ #im = ax1.pcolormesh(X, Y, INV.T, alpha=alphas) #, cmap=cmocean.cm.tempo) #cmap='viridis')
|
|
377
|
+ #im = ax1.pcolormesh(X, Y, INV.T, alpha=alphas) #, cmap=cmocean.cm.tempo) #cmap='viridis')
|
|
378
|
+ #ax1.axhline( y=ifaces[SNRidx], xmin=T2Bins[0], xmax=T2Bins[-1], color='black' )
|
|
379
|
+ im.set_edgecolor('face')
|
|
380
|
+ ax1.set_xlim( T2Bins[0], T2Bins[-1] )
|
|
381
|
+ ax1.set_ylim( ifaces[-1], ifaces[0] )
|
|
382
|
+ cb = plt.colorbar(im, label = u"PWC (m$^3$/m$^3$)") #, format='%1.1f')
|
|
383
|
+ cb.locator = MaxNLocator( nbins = 4)
|
|
384
|
+ cb.ax.yaxis.set_offset_position('left')
|
|
385
|
+ cb.update_ticks()
|
313
|
386
|
|
314
|
|
- ax1.set_xlabel(u"$T_2^*$ (ms)")
|
315
|
|
- ax1.set_ylabel(u"depth (m)")
|
|
387
|
+ ax1.set_xlabel(u"$T_2^*$ (ms)")
|
|
388
|
+ ax1.set_ylabel(u"depth (m)")
|
316
|
389
|
|
317
|
|
- ax1.get_xaxis().set_major_formatter(FormatStrFormatter('%1.0f'))
|
318
|
|
- ax1.get_yaxis().set_major_formatter(FormatStrFormatter('%1.0f'))
|
319
|
|
- ax1.xaxis.set_major_locator( MaxNLocator(nbins = 4) )
|
320
|
|
-
|
321
|
|
- #ax1.xaxis.set_label_position('top')
|
322
|
|
-
|
323
|
|
- ax2 = ax1.twiny()
|
324
|
|
- ax2.plot( np.sum(INVc, axis=1), (ifaces[1:]+ifaces[0:-1])/2 , color='red' )
|
325
|
|
- ax2.set_xlabel(u"total water (m$^3$/m$^3$)")
|
326
|
|
- ax2.set_ylim( ifaces[-1], ifaces[0] )
|
327
|
|
- ax2.xaxis.set_major_locator( MaxNLocator(nbins = 3) )
|
328
|
|
- ax2.get_xaxis().set_major_formatter(FormatStrFormatter('%0.2f'))
|
329
|
|
- #ax2.axhline( y=ifaces[SNRidx], xmin=0, xmax=1, color='black', linestyle='dashed' )
|
330
|
|
- #ax2.xaxis.set_label_position('bottom')
|
331
|
|
- fig.suptitle("Non linear inversion")
|
332
|
|
- plt.savefig("akvoInversionNL.pdf")
|
333
|
|
-
|
334
|
|
-
|
|
390
|
+ ax1.get_xaxis().set_major_formatter(FormatStrFormatter('%1.0f'))
|
|
391
|
+ ax1.get_yaxis().set_major_formatter(FormatStrFormatter('%1.0f'))
|
|
392
|
+ ax1.xaxis.set_major_locator( MaxNLocator(nbins = 4) )
|
|
393
|
+
|
|
394
|
+ #ax1.xaxis.set_label_position('top')
|
|
395
|
+
|
|
396
|
+ ax2 = ax1.twiny()
|
|
397
|
+ ax2.plot( np.sum(INVc, axis=1), (ifaces[1:]+ifaces[0:-1])/2 , color='red' )
|
|
398
|
+ ax2.set_xlabel(u"total water (m$^3$/m$^3$)")
|
|
399
|
+ ax2.set_ylim( ifaces[-1], ifaces[0] )
|
|
400
|
+ ax2.xaxis.set_major_locator( MaxNLocator(nbins = 3) )
|
|
401
|
+ ax2.get_xaxis().set_major_formatter(FormatStrFormatter('%0.2f'))
|
|
402
|
+ #ax2.axhline( y=ifaces[SNRidx], xmin=0, xmax=1, color='black', linestyle='dashed' )
|
|
403
|
+ if CalcDOI:
|
|
404
|
+ ax2.axhline( y=DOI, xmin=0, xmax=1, color='black', linestyle='dashed' )
|
|
405
|
+ #ax2.xaxis.set_label_position('bottom')
|
|
406
|
+ fig.suptitle("Non linear inversion")
|
|
407
|
+ plt.savefig("akvoInversionNL.pdf")
|
335
|
408
|
|
336
|
409
|
#############
|
337
|
410
|
# water plot#
|
|
@@ -340,7 +413,7 @@ def main():
|
340
|
413
|
ax = fig2.add_axes( [.2,.15,.6,.7] )
|
341
|
414
|
|
342
|
415
|
# Bound water cutoff
|
343
|
|
- Bidx = T2Bins[0:-1]<33.0
|
|
416
|
+ Bidx = T2Bins<33.0
|
344
|
417
|
twater = np.sum(INV, axis=1)
|
345
|
418
|
bwater = np.sum(INV[:,Bidx], axis=1)
|
346
|
419
|
|
|
@@ -357,18 +430,22 @@ def main():
|
357
|
430
|
ax.set_xlim( 0, ax.get_xlim()[1] )
|
358
|
431
|
|
359
|
432
|
#ax.axhline( y=ifaces[SNRidx], xmin=0, xmax=1, color='black', linestyle='dashed' )
|
|
433
|
+ if CalcDOI:
|
|
434
|
+ ax.axhline( y=DOI, xmin=0, xmax=1, color='black', linestyle='dashed' )
|
360
|
435
|
|
361
|
436
|
plt.savefig("akvoInversionWC.pdf")
|
362
|
437
|
plt.legend()
|
363
|
438
|
|
364
|
439
|
|
365
|
440
|
# Report results into a text file
|
366
|
|
- fr = pd.DataFrame( INV, columns=T2Bins[0:-1] )
|
|
441
|
+ fr = pd.DataFrame( INV, columns=T2Bins ) #[0:-1] )
|
367
|
442
|
fr.insert(0, "layer top", ifaces[0:-1] )
|
368
|
443
|
fr.insert(1, "layer bottom", ifaces[1::] )
|
369
|
444
|
fr.insert(2, "NMR total water", np.sum(INV, axis=1) )
|
370
|
445
|
fr.insert(3, "NMR bound water", bwater )
|
371
|
446
|
fr.insert(4, "Layer SNR", SNR )
|
|
447
|
+ if CalcDOI:
|
|
448
|
+ fr.insert(5, "Resolution", DOIMetric )
|
372
|
449
|
|
373
|
450
|
fr.to_csv("akvoInversion.csv")
|
374
|
451
|
#fr.to_excel("akvoInversion.xlsx")
|