Skip to content

Commit e2b3fde

Browse files
authored
Merge branch 'main' into imports
2 parents faa0062 + ad4fcf1 commit e2b3fde

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

geoscilabs/mag/Mag.py

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
class Simulation(object):
1010
"""
11-
Earth's field:
12-
- Binc, Bdec : inclination and declination of Earth's mag field
13-
- Bigrf : amplitude of earth's field in units of nT
11+
Earth's field:
12+
- Binc, Bdec : inclination and declination of Earth's mag field
13+
- Bigrf : amplitude of earth's field in units of nT
1414
15-
Remnance:
16-
- Q : Koenigsberger ratio
17-
- Rinc, Rdec : inclination and declination of remnance in block
15+
Remnance:
16+
- Q : Koenigsberger ratio
17+
- Rinc, Rdec : inclination and declination of remnance in block
1818
1919
"""
2020

@@ -154,7 +154,7 @@ def calcRow(Xn, Yn, Zn, rxLoc):
154154
155155
@author: dominiquef
156156
157-
"""
157+
"""
158158

159159
eps = 1e-8 # add a small value to the locations to avoid /0
160160

@@ -174,14 +174,14 @@ def calcRow(Xn, Yn, Zn, rxLoc):
174174
dx2 = Xn[:, 1] - rxLoc[0] + eps
175175
dx1 = Xn[:, 0] - rxLoc[0] + eps
176176

177-
dx2dx2 = dx2 ** 2.0
178-
dx1dx1 = dx1 ** 2.0
177+
dx2dx2 = dx2**2.0
178+
dx1dx1 = dx1**2.0
179179

180-
dy2dy2 = dy2 ** 2.0
181-
dy1dy1 = dy1 ** 2.0
180+
dy2dy2 = dy2**2.0
181+
dy1dy1 = dy1**2.0
182182

183-
dz2dz2 = dz2 ** 2.0
184-
dz1dz1 = dz1 ** 2.0
183+
dz2dz2 = dz2**2.0
184+
dz1dz1 = dz1**2.0
185185

186186
R1 = dy2dy2 + dx2dx2
187187
R2 = dy2dy2 + dx1dx1
@@ -275,7 +275,6 @@ def calcRow(Xn, Yn, Zn, rxLoc):
275275

276276

277277
def Intrgl_Fwr_Op(xn, yn, zn, rxLoc):
278-
279278
"""
280279
281280
Magnetic forward operator in integral form
@@ -289,7 +288,7 @@ def Intrgl_Fwr_Op(xn, yn, zn, rxLoc):
289288
Return
290289
_G = Linear forward modeling operation
291290
292-
"""
291+
"""
293292

294293
yn2, xn2, zn2 = np.meshgrid(yn[1:], xn[1:], zn[1:])
295294
yn1, xn1, zn1 = np.meshgrid(yn[0:-1], xn[0:-1], zn[0:-1])
@@ -316,15 +315,21 @@ def Intrgl_Fwr_Op(xn, yn, zn, rxLoc):
316315

317316
def createMagSurvey(xyzd, B):
318317
"""
319-
Create simpeg magnetic survey pbject
318+
Create SimPEG magnetic survey object
320319
321-
INPUT
322-
:param array: xyzd, n-by-4 array of observation points and data
323-
:param array: B, 1-by-3 array of inducing field param [|B|, Inc, Dec]
320+
INPUT
321+
:param array: xyzd, n-by-4 array of observation points and data
322+
:param array: B, 1-by-3 array of inducing field param [|B|, Inc, Dec]
324323
"""
325324

326325
rxLoc = mag.receivers.Point(xyzd[:, :3])
327-
source_field = mag.sources.SourceField(receiver_list=[rxLoc], parameters=B)
326+
amplitude, inclination, declination = B[:]
327+
source_field = mag.sources.UniformBackgroundField(
328+
receiver_list=[rxLoc],
329+
amplitude=amplitude,
330+
inclination=inclination,
331+
declination=declination,
332+
)
328333
survey = mag.Survey(source_field)
329334
dobj = data.Data(survey, xyzd[:, 3])
330335

0 commit comments

Comments
 (0)