werthmuller.org

a dash of

2018 Roundup

22 December 2018

This blog seems to go down the road of many blogs. Lots of entries at the beginning, lots of enthusiasm, followed by a slow or sudden death. I started it in order to share a couple of mainly Python-related things from my Ph.D. And that explains to some extent at the same time why this blog has become dormant; most of the Python related stuff can be found on my GitHub-page. So in order for a last attempt to revive this blog here a quick and dry run-down on some of my activities.

empymod

A good portion of my open-source stuff was still focused around the electromagnetic modeller empymod, all of which can be found in the empymod-GitHub-repo:

  • Our article A tool for designing digital filters for the Hankel and Fourier transforms in potential, diffusive, and wavefield modeling got accepted by Geophysics. It is about how you can use empymod to design Digital Linear Filters (DLF), from very low to very high frequencies. The article can be found on the website of Geophysics or, together with all the notebooks and the code, in the GitHub-repo empymod/article-fdesign.

    The following figure is Figure 3 of the article, showing the solution spaces of four consecutive inversion runs for a 201 pt filter (see the article for more details). Each consecutive run zooms into a portion of the previous solution space, indicated by the square. The more in detail we obtain the solution space, the more random appears to be the distribution. fdesign-Figure-3.png

    The big novelty of the article, however, is not the design of a DLF per se. The novelty is the application of a DLF to a high frequency geophysical method, and therefore to wave phenomena. This is shown by Figure 9 in the article, which is a ground-penetrating radar example. The comparison of the traditional quadrature (b) and the DLF (c) shows the gained speed-up (over 11 hours versus less than 9 minutes). fdesign-Figure-9.png

     Reference:

    Werthmüller, D., K. Key, and E. C. Slob, 2019, A tool for designing digital filters for the Hankel and Fourier transforms in potential, diffusive, and wavefield modeling: Geophysics, 84, 10.1190/geo2018-0069.1.

  • Anton Ziolkowski and Evert Slob will publish their book Introduction to Controlled-Source Electromagnetic Methods coming May (ISBN: 9781107058620). I worked together with the authors to create a set of notebooks which can reproduce all of the numerical examples in the book using empymod. The notebooks are open-source and can be found on the website of the book (once released) or in the GitHub-repo empymod/csem-ziolkowski-and-slob.

    As an example here Figure 5.56 of the book, showing the electric field impulse response as a function of logarithmic time and offset for the land VTI model with the 40 m thick buried resistive layer at 1 km depth (left) and 3 km depth (right); see the book for all the details. ziol-slob-Figure-556.png

  • By explaining to someone the different possibilities how to speed-up the use of digital linear filters I created a notebook with an illustrative comparison of different implementations of DLF. The notebook 7a_DLF-Standard-Lagged-Splined.ipynb can be found in the repo empymod/example-notebooks. Here an example-figure from the notebook: SplinedDLF.png

Varia

But there where also a few things unrelated to empymod, and you can find these in the GitHub-repo prisae/tmp-share:

  • In my current project I work a lot with 3D volumes, and I was looking for an easy way to slice through it. I created a simple 3D-slicer using using matplotlib, which is now implemented in the module discretize of SimPEG. You can scroll through the volume with your mouse-wheel when hoovering over a subplot. Zooming and dragging is synchronized, and you can make regions transparent. Check-out the release-notes of discretize, or you can find an earlier, not so polished version in the notebook 3D-slices.ipynb. Here a demo of the 3D slicer: 3DSlicer.gif

  • From a question in the Swung channel on Slack came that 1D interpolation in SciPy was lacking the possibility to take the previous or next element. I decided to implement it, and since SciPy v.1.1.0 it is available. The pull request is 8572, and interp1d-left-right.ipynb is a notebook showing its use (also implemented in the SciPy-documentation).

  • If you like to run some Matlab-code in a Jupyter notebook in order to check something have a look at the notebook RunningMatlabInJupyter.ipynb.

  • And finally, if you are interested in a runtime-comparison of eight different possibilities to achieve the same goal with different methods using numpy, scipy, numexpr, numba, and Cython, have a look at the notebook multiply_volume.ipynb.