Skip to content

Commit

Permalink
Left- and right-handed coordinate systems (#70)
Browse files Browse the repository at this point in the history
* Add example for LHS/RHS coordinate system
* Bugfix related to `pts_per_dec` being floats and used as inputs to `logspace`/`linspace`.
  • Loading branch information
prisae authored Feb 16, 2020
1 parent 87ed251 commit 70aaeb3
Show file tree
Hide file tree
Showing 9 changed files with 356 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ matrix:
- python: 3.7 # => without matplotlib, numexpr
env: PYTHON=3.7 CHAN="defaults" PCKGS="" TEST="" INST=""
- python: 3.7 # => just linkcheck
env: PYTHON=3.7 CHAN="defaults" CHCKLNKS=true PCKGS="" TEST="" INST="sphinx numpydoc sphinx_rtd_theme sphinx_numfig sphinx_gallery"
env: PYTHON=3.7 CHAN="defaults" CHCKLNKS=true PCKGS="" TEST="" INST="sphinx numpydoc sphinx_rtd_theme sphinx_numfig sphinx_gallery memory_profiler"

jobs:
allow_failures: # env must be EXACTLY as env allowed to fail.
- env: PYTHON=3.7 CHAN="defaults" CHCKLNKS=true PCKGS="" TEST="" INST="sphinx numpydoc sphinx_rtd_theme sphinx_numfig sphinx_gallery"
- env: PYTHON=3.7 CHAN="defaults" CHCKLNKS=true PCKGS="" TEST="" INST="sphinx numpydoc sphinx_rtd_theme sphinx_numfig sphinx_gallery memory_profiler"

install:
- sudo apt-get update
Expand Down
8 changes: 7 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
"filename_pattern": r"\.py",
# Sort gallery example by file name instead of number of lines (default)
"within_subsection_order": FileNameSortKey,
# Remove the settings (e.g., sphinx_gallery_thumbnail_number)
'remove_config_comments': True,
# Show memory
'show_memory': True,
# Custom first notebook cell
'first_notebook_cell': '%matplotlib notebook',
}

# https://github.com/sphinx-gallery/sphinx-gallery/pull/521/files
Expand All @@ -52,7 +58,7 @@

# Intersphinx configuration
# intersphinx_mapping = {
# "numpy": ("https://docs.scipy.org/doc/numpy/", None),
# "numpy": ("https://numpy.org", None),
# "scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
# }

Expand Down
14 changes: 14 additions & 0 deletions docs/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@ calculation. It could also be used in the high-frequency range to model
dielectricity.
Coordinate system
'''''''''''''''''
The used coordinate system is either a
- Left-Handed System (LHS), where Easting is the :math:`x`-direction, Northing
the :math:`y`-direction, and positive :math:`z` is pointing downwards;
- Right-Handed System (RHS), where Easting is the :math:`x`-direction, Northing
the :math:`y`-direction, and positive :math:`z` is pointing upwards.
Have a look at the example :ref:`sphx_glr_examples_coordinate_system.py` for
further explanations.
Contributing
------------
Expand Down
12 changes: 6 additions & 6 deletions empymod/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ def bipole(src, rec, depth, res, freqtime, signal=None, aniso=None,
different angles, you have to use the bipole-method (with
srcpts/recpts = 1, so it is calculated as dipoles).
Angles (coordinate system is left-handed, positive z down
(East-North-Depth):
Angles (coordinate system is either left-handed with positive z down or
right-handed with positive z up; East-North-Depth):
- azimuth (°): horizontal deviation from x-axis, anti-clockwise.
- dip (°): vertical deviation from xy-plane downwards.
- +/-dip (°): vertical deviation from xy-plane down/up-wards.
Sources or receivers placed on a layer interface are considered in the
upper layer.
Expand Down Expand Up @@ -1010,11 +1010,11 @@ def loop(src, rec, depth, res, freqtime, signal=None, aniso=None, epermH=None,
recpts = 1, so it is calculated as dipoles). Note that srcpts is
fixed to 1, as the source is a loop.
Angles (coordinate system is left-handed, positive z down
(East-North-Depth):
Angles (coordinate system is either left-handed with positive z down or
right-handed with positive z up; East-North-Depth):
- azimuth (°): horizontal deviation from x-axis, anti-clockwise.
- dip (°): vertical deviation from xy-plane downwards.
- +/-dip (°): vertical deviation from xy-plane down/up-wards.
Sources or receivers placed on a layer interface are considered in the
upper layer.
Expand Down
2 changes: 1 addition & 1 deletion empymod/scripts/fdesign.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ def _calculate_filter(n, spacing, shift, fI, r_def, reim, name):
# r :: Start/end is defined by base AND r_def[0]/r_def[1]
# Overdetermined system if r_def[2] > 1
r = np.logspace(np.log10(1/np.max(base)) - r_def[0],
np.log10(1/np.min(base)) + r_def[1], r_def[2]*n)
np.log10(1/np.min(base)) + r_def[1], int(r_def[2]*n))

# k :: Get required k-values (matrix of shape (r.size, base.size))
k = base/r[:, None]
Expand Down
2 changes: 1 addition & 1 deletion empymod/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def hquad(zsrc, zrec, lsrc, lrec, off, factAng, depth, ab, etaH, etaV, zetaH,
# Get required lambdas
la = np.log10(a)
lb = np.log10(b)
ilambd = np.logspace(la, lb, (lb-la)*pts_per_dec + 1)
ilambd = np.logspace(la, lb, int((lb-la)*pts_per_dec + 1))

# Call the kernel
PJ0, PJ1, PJ0b = kernel.wavenumber(zsrc, zrec, lsrc, lrec, depth, etaH,
Expand Down
Loading

0 comments on commit 70aaeb3

Please sign in to comment.