Skip to content

Commit c7b290d

Browse files
authored
Merge pull request #10 from geoscixyz/Fix_PF
Fix_PF
2 parents 9bbd4c9 + 125570a commit c7b290d

12 files changed

+59
-80
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ install:
2525

2626
# Run test
2727
script:
28-
- if [ $TEST = "style" ]; then
28+
- if [ $TEST == "style" ]; then
2929
make check ;
3030
else
3131
pytest tests/$TEST -v -s ;

geoscilabs/em/HarmonicVMDCylWidget.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,14 @@ def plotField(
379379
cb.set_label(label)
380380
xmax = self.mesh2D.gridCC[:, 0].max()
381381
if Geometry:
382-
if Scenario is "Layer":
382+
if Scenario == "Layer":
383383
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.srcLoc[2], "w-", lw=1)
384384
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z0, "w--", lw=1)
385385
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z1, "w--", lw=1)
386386
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z2, "w--", lw=1)
387387
ax.plot(0, self.srcLoc[2], "ko", ms=4)
388388
ax.plot(self.rxLoc[0, 0], self.srcLoc[2], "ro", ms=4)
389-
elif Scenario is "Sphere":
389+
elif Scenario == "Sphere":
390390
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.srcLoc[2], "k-", lw=1)
391391
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z0, "w--", lw=1)
392392
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z1, "w--", lw=1)

geoscilabs/em/MarineCSEM1D.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ def csem_layered_earth(
131131
rx = [rxlocs[:, 0], rxlocs[:, 1], rxlocs[:, 2], 0.0, 90.0]
132132
else:
133133
raise Exception("rx_direction should be x, y, or z")
134-
if rx_type is "electric":
134+
if rx_type == "electric":
135135
rx_type = None
136-
if src_type is "electric":
136+
if src_type == "electric":
137137
src_type = None
138138
if len(np.unique(np.array(res))) == 1:
139139
xdirect = True

geoscilabs/em/PlanewaveWidgetFD.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def foo(Field, Sigma, Scale, Fixed, Frequency, Time):
511511
yticksa = np.linspace(y.min(), y.max(), 3)
512512
ax1.yaxis.set_ticks(yticksa)
513513

514-
if Fixed and Field is not "Impedance":
514+
if Fixed and Field != "Impedance":
515515
vmax = np.r_[abs(valr), abs(vali)].max()
516516
vmin = -vmax
517517
ax1.set_ylim(vmin, vmax)

geoscilabs/em/ResponseFct.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ def plot_ResponseFct(h_boom, h_1, sigma_1, sigma_2, orientation="HCP"):
6262
sigvec = sigma_1 * np.ones(z.shape)
6363
sigvec[z > h_1] = sigma_2
6464

65-
if orientation is "HCP":
65+
if orientation == "HCP":
6666
phi = phi_v(z + h_boom)
6767
sig_a = sigma_av(h_boom, h_1, sigma_1, sigma_2)
6868
phi_title = "$\phi_V$"
69-
elif orientation is "VCP":
69+
elif orientation == "VCP":
7070
phi = phi_h(z + h_boom)
7171
sig_a = sigma_ah(h_boom, h_1, sigma_1, sigma_2)
7272
phi_title = "$\phi_H$"

geoscilabs/em/TDEMHorizontalLoopCylWidget.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,14 @@ def plotField(
400400
cb.set_label(label)
401401
xmax = self.mesh2D.gridCC[:, 0].max()
402402
if Geometry:
403-
if Scenario is "Layer":
403+
if Scenario == "Layer":
404404
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.srcLoc[2], "w-", lw=1)
405405
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z0, "w--", lw=1)
406406
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z1, "w--", lw=1)
407407
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z2, "w--", lw=1)
408408
ax.plot(0, self.srcLoc[2], "ko", ms=4)
409409
ax.plot(self.rxLoc[0, 0], self.srcLoc[2], "ro", ms=4)
410-
elif Scenario is "Sphere":
410+
elif Scenario == "Sphere":
411411
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.srcLoc[2], "k-", lw=1)
412412
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z0, "w--", lw=1)
413413
ax.plot(np.r_[-xmax, xmax], np.ones(2) * self.z1, "w--", lw=1)

geoscilabs/em/UXO_TEM_Widget.py

+36-36
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def ImageDataWidget(TxType):
164164

165165
# TxType MUST be: "EM61", "TEMTADS" or "MPV"
166166

167-
if TxType is "EM61":
167+
if TxType == "EM61":
168168

169169
Out = interactive(
170170
fcnImageDataWidgetEM61,
@@ -338,7 +338,7 @@ def ImageDataWidget(TxType):
338338
),
339339
)
340340

341-
elif TxType is "TEMTADS":
341+
elif TxType == "TEMTADS":
342342
Out = interactive(
343343
fcnImageDataWidgetTEMTADS,
344344
x0=FloatSlider(
@@ -511,7 +511,7 @@ def ImageDataWidget(TxType):
511511
),
512512
)
513513

514-
elif TxType is "MPV":
514+
elif TxType == "MPV":
515515
Out = interactive(
516516
fcnImageDataWidgetMPV,
517517
x0=FloatSlider(
@@ -692,7 +692,7 @@ def InversionWidget(TxType):
692692

693693
# TxType MUST be: "EM61", "TEMTADS" or "MPV"
694694

695-
if TxType is "EM61":
695+
if TxType == "EM61":
696696

697697
Out = interactive(
698698
fcnInversionWidgetEM61,
@@ -906,7 +906,7 @@ def InversionWidget(TxType):
906906
),
907907
)
908908

909-
elif TxType is "TEMTADS":
909+
elif TxType == "TEMTADS":
910910

911911
Out = interactive(
912912
fcnInversionWidgetTEMTADS,
@@ -1120,7 +1120,7 @@ def InversionWidget(TxType):
11201120
),
11211121
)
11221122

1123-
elif TxType is "MPV":
1123+
elif TxType == "MPV":
11241124

11251125
Out = interactive(
11261126
fcnInversionWidgetMPV,
@@ -1887,22 +1887,22 @@ def fcnImageDataWidgetMPV(
18871887
# Anomaly
18881888
titlestr1 = "Anomaly at t = " + "{:.3e}".format(uxoObj.times[tn - 1]) + " s"
18891889

1890-
if dComp is "X":
1890+
if dComp == "X":
18911891
k = 0
1892-
elif dComp is "Y":
1892+
elif dComp == "Y":
18931893
k = 1
1894-
elif dComp is "Z":
1894+
elif dComp == "Z":
18951895
k = 2
18961896

18971897
di = 1e6 * np.reshape(data[6 + k : 15 * N ** 2 : 15, tn - 1], (N, N))
18981898
Cplot = ax1.contourf(X, Y, di.T, 40, cmap="viridis")
18991899
cbar = plt.colorbar(Cplot, ax=ax1, pad=0.02)
19001900

1901-
if dComp is "X":
1901+
if dComp == "X":
19021902
cbar.set_label("dBx/dt [$\mu$V]", rotation=270, labelpad=25, size=FS)
1903-
elif dComp is "Y":
1903+
elif dComp == "Y":
19041904
cbar.set_label("dBy/dt [$\mu$V]", rotation=270, labelpad=25, size=FS)
1905-
elif dComp is "Z":
1905+
elif dComp == "Z":
19061906
cbar.set_label("dBz/dt [$\mu$V]", rotation=270, labelpad=25, size=FS)
19071907
cbar.ax.tick_params(labelsize=FS - 2)
19081908

@@ -2026,12 +2026,12 @@ def fcnInversionWidgetEM61(
20262026

20272027
# PREDICT TRUE DATA
20282028
uxoObj2 = EM61problem(rt, phi, L, times, I)
2029-
if Nx is 1:
2029+
if Nx == 1:
20302030
Xn = 0.0
20312031
else:
20322032
Xn = np.linspace(-Dx / 2, Dx / 2, Nx)
20332033

2034-
if Ny is 1:
2034+
if Ny == 1:
20352035
Yn = 0.0
20362036
else:
20372037
Yn = np.linspace(-Dy / 2, Dy / 2, Ny)
@@ -2059,7 +2059,7 @@ def fcnInversionWidgetEM61(
20592059
COUNT = 0
20602060
m_vec = [Misfit]
20612061

2062-
while Misfit > 1.001 and COUNT < 100 and dMis > 1e-5 or COUNT is 0:
2062+
while Misfit > 1.001 and COUNT < 100 and dMis > 1e-5 or COUNT == 0:
20632063

20642064
MisPrev = Misfit
20652065

@@ -2164,7 +2164,7 @@ def fcnInversionWidgetEM61(
21642164
+ ")"
21652165
)
21662166
fm_str = "Final Misfit = " + "{:.2f}".format(m_vec[-1])
2167-
if COUNT is 1:
2167+
if COUNT == 1:
21682168
ax21.text(0.1, 0.92 * m_vec[0], rt_str, fontsize=FS)
21692169
ax21.text(0.1, 0.83 * m_vec[0], rn_str, fontsize=FS)
21702170
ax21.text(0.1, 0.74 * m_vec[0], fm_str, fontsize=FS)
@@ -2267,12 +2267,12 @@ def fcnInversionWidgetTEMTADS(
22672267

22682268
# PREDICT TRUE DATA
22692269
uxoObj2 = TEMTADSproblem(rt, phi, L, times, I)
2270-
if Nx is 1:
2270+
if Nx == 1:
22712271
Xn = 0.0
22722272
else:
22732273
Xn = np.linspace(-Dx / 2, Dx / 2, Nx)
22742274

2275-
if Ny is 1:
2275+
if Ny == 1:
22762276
Yn = 0.0
22772277
else:
22782278
Yn = np.linspace(-Dy / 2, Dy / 2, Ny)
@@ -2299,7 +2299,7 @@ def fcnInversionWidgetTEMTADS(
22992299
COUNT = 0
23002300
m_vec = [Misfit]
23012301

2302-
while Misfit > 1.001 and COUNT < 100 and dMis > 1e-5 or COUNT is 0:
2302+
while Misfit > 1.001 and COUNT < 100 and dMis > 1e-5 or COUNT == 0:
23032303

23042304
MisPrev = Misfit
23052305

@@ -2402,7 +2402,7 @@ def fcnInversionWidgetTEMTADS(
24022402
+ ")"
24032403
)
24042404
fm_str = "Final Misfit = " + "{:.2f}".format(m_vec[-1])
2405-
if COUNT is 1:
2405+
if COUNT == 1:
24062406
ax21.text(0.1, 0.92 * m_vec[0], rt_str, fontsize=FS)
24072407
ax21.text(0.1, 0.83 * m_vec[0], rn_str, fontsize=FS)
24082408
ax21.text(0.1, 0.74 * m_vec[0], fm_str, fontsize=FS)
@@ -2506,12 +2506,12 @@ def fcnInversionWidgetMPV(
25062506

25072507
# PREDICT TRUE DATA
25082508
uxoObj2 = MPVproblem(rt, phi, L, times, I)
2509-
if Nx is 1:
2509+
if Nx == 1:
25102510
Xn = 0.0
25112511
else:
25122512
Xn = np.linspace(-Dx / 2, Dx / 2, Nx)
25132513

2514-
if Ny is 1:
2514+
if Ny == 1:
25152515
Yn = 0.0
25162516
else:
25172517
Yn = np.linspace(-Dy / 2, Dy / 2, Ny)
@@ -2540,7 +2540,7 @@ def fcnInversionWidgetMPV(
25402540
COUNT = 0
25412541
m_vec = [Misfit]
25422542

2543-
while Misfit > 1.001 and COUNT < 100 and dMis > 1e-5 or COUNT is 0:
2543+
while Misfit > 1.001 and COUNT < 100 and dMis > 1e-5 or COUNT == 0:
25442544

25452545
MisPrev = Misfit
25462546

@@ -2579,11 +2579,11 @@ def fcnInversionWidgetMPV(
25792579
ax22 = fig.add_axes([0.5, 0.0, 0.4, 0.45])
25802580
FS = 18
25812581

2582-
if dComp is "X":
2582+
if dComp == "X":
25832583
k = 0
2584-
elif dComp is "Y":
2584+
elif dComp == "Y":
25852585
k = 1
2586-
elif dComp is "Z":
2586+
elif dComp == "Z":
25872587
k = 2
25882588

25892589
# True Anomaly
@@ -2592,11 +2592,11 @@ def fcnInversionWidgetMPV(
25922592
) # 1e6 for uV
25932593
Cplot1 = ax11.contourf(X1, Y1, d11.T, 40, cmap="viridis")
25942594
cbar1 = plt.colorbar(Cplot1, ax=ax11, pad=0.02, format="%.2e")
2595-
if dComp is "X":
2595+
if dComp == "X":
25962596
cbar1.set_label("dBx/dt [$\mu$V]", rotation=270, labelpad=25, size=FS)
2597-
elif dComp is "Y":
2597+
elif dComp == "Y":
25982598
cbar1.set_label("dBy/dt [$\mu$V]", rotation=270, labelpad=25, size=FS)
2599-
elif dComp is "Z":
2599+
elif dComp == "Z":
26002600
cbar1.set_label("dBz/dt [$\mu$V]", rotation=270, labelpad=25, size=FS)
26012601
cbar1.ax.tick_params(labelsize=FS - 2)
26022602

@@ -2617,11 +2617,11 @@ def fcnInversionWidgetMPV(
26172617
) # 1e6 for uV
26182618
Cplot2 = ax12.contourf(X1, Y1, d12.T, 40, cmap="viridis")
26192619
cbar2 = plt.colorbar(Cplot2, ax=ax12, pad=0.02, format="%.2e")
2620-
if dComp is "X":
2620+
if dComp == "X":
26212621
cbar2.set_label("dBx/dt [$\mu$V]", rotation=270, labelpad=25, size=FS)
2622-
elif dComp is "Y":
2622+
elif dComp == "Y":
26232623
cbar2.set_label("dBy/dt [$\mu$V]", rotation=270, labelpad=25, size=FS)
2624-
elif dComp is "Z":
2624+
elif dComp == "Z":
26252625
cbar2.set_label("dBz/dt [$\mu$V]", rotation=270, labelpad=25, size=FS)
26262626
cbar2.ax.tick_params(labelsize=FS - 2)
26272627

@@ -2664,7 +2664,7 @@ def fcnInversionWidgetMPV(
26642664
+ ")"
26652665
)
26662666
fm_str = "Final Misfit = " + "{:.2f}".format(m_vec[-1])
2667-
if COUNT is 1:
2667+
if COUNT == 1:
26682668
ax21.text(0.1, 0.92 * m_vec[0], rt_str, fontsize=FS)
26692669
ax21.text(0.1, 0.83 * m_vec[0], rn_str, fontsize=FS)
26702670
ax21.text(0.1, 0.74 * m_vec[0], fm_str, fontsize=FS)
@@ -2788,9 +2788,9 @@ def computePolarVecs(self, karg=False):
27882788

27892789
if karg is False:
27902790
A = self.computeRotMatrix()
2791-
elif np.size(karg) is 3:
2791+
elif np.size(karg) == 3:
27922792
A = self.computeRotMatrix(karg)
2793-
elif np.size(karg) is 9:
2793+
elif np.size(karg) == 9:
27942794
A = karg
27952795

27962796
q = np.zeros((6, N))
@@ -3794,7 +3794,7 @@ def get_dobs_dunc(self, dpre, FloorVal, Pct):
37943794

37953795
Floor = FloorVal * np.max(np.abs(dpre)) * np.ones(np.shape(dpre))
37963796

3797-
if len(Pct) is 1:
3797+
if len(Pct) == 1:
37983798
dunc = Floor + Pct * np.abs(dpre)
37993799
else:
38003800
dunc = Floor

geoscilabs/mag/Mag.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def Intrgl_Fwr_Op(xn, yn, zn, rxLoc):
158158

159159
for ii in range(ndata):
160160

161-
tx, ty, tz = PF.Magnetics.get_T_mat(Xn, Yn, Zn, rxLoc[ii, :])
161+
tx, ty, tz = PF.Magnetics.calcRow(Xn, Yn, Zn, rxLoc[ii, :])
162162

163163
G[ii, :] = tx / 1e-9 * mu_0
164164
G[ii + ndata, :] = ty / 1e-9 * mu_0

geoscilabs/mag/MagDipoleApp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def plot_map(self):
336336
ax2.set_xlabel(("Halfwidth: %.1fm") % (abs(np.diff(x_half))))
337337
else:
338338
ax2.set_xlabel(" ")
339-
plt.tight_layout()
339+
# plt.tight_layout()
340340
if profile == "None":
341341
ax2.remove()
342342
else:

0 commit comments

Comments
 (0)