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

Add possibility for e-current #220

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
16 changes: 13 additions & 3 deletions empymod/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ def bipole(src, rec, depth, res, freqtime, signal=None, aniso=None,
If True, the output is squeezed. If False, the output will always be of
``ndim=3``, (nfreqtime, nrec, nsrc).

ecurrent : bool, default: False
TODO description ecurrent


Returns
-------
Expand All @@ -310,6 +313,7 @@ def bipole(src, rec, depth, res, freqtime, signal=None, aniso=None,

- If rec is electric, returns E [V/m].
- If rec is magnetic, returns H [A/m].
- TODO description ecurrent; check for msrc=True

EMArray is a subclassed ndarray with `.pha` and `.amp` attributes
(only relevant for frequency-domain data).
Expand Down Expand Up @@ -379,10 +383,11 @@ def bipole(src, rec, depth, res, freqtime, signal=None, aniso=None,
"""
# Get kwargs with defaults.
out = get_kwargs(
['verb', 'ht', 'htarg', 'ft', 'ftarg', 'xdirect', 'loop', 'squeeze'],
[2, 'dlf', {}, 'dlf', {}, False, None, True], kwargs,
['verb', 'ht', 'htarg', 'ft', 'ftarg', 'xdirect', 'loop', 'squeeze',
'ecurrent'],
[2, 'dlf', {}, 'dlf', {}, False, None, True, False], kwargs,
)
verb, ht, htarg, ft, ftarg, xdirect, loop, squeeze = out
verb, ht, htarg, ft, ftarg, xdirect, loop, squeeze, ecurrent = out

# === 1. LET'S START ============
t0 = printstartfinish(verb)
Expand Down Expand Up @@ -528,6 +533,11 @@ def bipole(src, rec, depth, res, freqtime, signal=None, aniso=None,
src_rec_w *= np.tile(rec_w, isrc)
sEM *= src_rec_w

# Multiply with eta of the rec-layer if ecurrent.
if ecurrent:
print(sEM.shape, etaH.shape, etaH[:, lrec, None].shape)
sEM *= etaH[:, lrec, None]

# Add this src-rec signal
if nrec == nrecz:
if nsrc == nsrcz: # Case 1: Looped over each src and each rec
Expand Down
3 changes: 2 additions & 1 deletion empymod/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,8 @@ def get_kwargs(names, defaults, kwargs):
known_keys = set([
'depth', 'ht', 'htarg', 'ft', 'ftarg', 'xdirect', 'loop', 'signal',
'ab', 'freqtime', 'freq', 'wavenumber', 'solution', 'cf', 'gain',
'msrc', 'srcpts', 'mrec', 'recpts', 'strength', 'squeeze'
'msrc', 'srcpts', 'mrec', 'recpts', 'strength', 'squeeze',
'ecurrent',
])

# Loop over wanted parameters.
Expand Down
Loading