Skip to content

Commit

Permalink
Replace SourceField for UniformBackgroundField
Browse files Browse the repository at this point in the history
  • Loading branch information
santisoler committed Sep 23, 2024
1 parent 632cf8c commit 9816731
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions geoscilabs/mag/Mag.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

class Simulation(object):
"""
Earth's field:
- Binc, Bdec : inclination and declination of Earth's mag field
- Bigrf : amplitude of earth's field in units of nT
Earth's field:
- Binc, Bdec : inclination and declination of Earth's mag field
- Bigrf : amplitude of earth's field in units of nT
Remnance:
- Q : Koenigsberger ratio
- Rinc, Rdec : inclination and declination of remnance in block
Remnance:
- Q : Koenigsberger ratio
- Rinc, Rdec : inclination and declination of remnance in block
"""

Expand Down Expand Up @@ -154,7 +154,7 @@ def calcRow(Xn, Yn, Zn, rxLoc):
@author: dominiquef
"""
"""

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

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

dx2dx2 = dx2 ** 2.0
dx1dx1 = dx1 ** 2.0
dx2dx2 = dx2**2.0
dx1dx1 = dx1**2.0

dy2dy2 = dy2 ** 2.0
dy1dy1 = dy1 ** 2.0
dy2dy2 = dy2**2.0
dy1dy1 = dy1**2.0

dz2dz2 = dz2 ** 2.0
dz1dz1 = dz1 ** 2.0
dz2dz2 = dz2**2.0
dz1dz1 = dz1**2.0

R1 = dy2dy2 + dx2dx2
R2 = dy2dy2 + dx1dx1
Expand Down Expand Up @@ -275,7 +275,6 @@ def calcRow(Xn, Yn, Zn, rxLoc):


def Intrgl_Fwr_Op(xn, yn, zn, rxLoc):

"""
Magnetic forward operator in integral form
Expand All @@ -289,7 +288,7 @@ def Intrgl_Fwr_Op(xn, yn, zn, rxLoc):
Return
_G = Linear forward modeling operation
"""
"""

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

def createMagSurvey(xyzd, B):
"""
Create SimPEG magnetic survey pbject
Create SimPEG magnetic survey pbject
INPUT
:param array: xyzd, n-by-4 array of observation points and data
:param array: B, 1-by-3 array of inducing field param [|B|, Inc, Dec]
INPUT
:param array: xyzd, n-by-4 array of observation points and data
:param array: B, 1-by-3 array of inducing field param [|B|, Inc, Dec]
"""

rxLoc = mag.receivers.Point(xyzd[:, :3])
source_field = mag.sources.SourceField(receiver_list=[rxLoc], parameters=B)
amplitude, inclination, declination = B[:]
source_field = mag.sources.UniformBackgroundField(
receiver_list=[rxLoc],
amplitude=amplitude,
inclination=inclination,
declination=declination,
)
survey = mag.Survey(source_field)
dobj = data.Data(survey, xyzd[:, 3])

Expand Down

0 comments on commit 9816731

Please sign in to comment.