Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace SourceField for UniformBackgroundField #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading