Giter Site home page Giter Site logo

geoscixyz / em-apps Goto Github PK

View Code? Open in Web Editor NEW
31.0 3.0 18.0 78.44 MB

Interactive applications for electromagnetics in geophysics

Home Page: http://em.geosci.xyz

License: MIT License

Python 1.11% Jupyter Notebook 98.89%
geophysics notebook physics visualization education open-science electromagnetics

em-apps's People

Contributors

dccowan avatar dougoldenburg avatar fourndo avatar lheagy avatar micmitch avatar prisae avatar sgkang avatar thast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

em-apps's Issues

"Run Interact"

In the plots that we manually update, the button that does the update says "Run Interact", but all of our instructions say that the button says "Run Plot". This has the potential to cause confusion.

So either, the instructions should be updated to say "Run Interact" or the button updated to say "Run Plot"

cc @thast

Resistivity sounding curve

The em apps are great and I will start using them in my class this week!
The only app that I cannot find and would be useful is to calculate resistivity sounding curves for 1D layered models (using either Wenner and or Schlumberger measurements). I have a matlab code that calculates these curves for arbitrary layered models that I could contribute.

ex3

Organization of Apps

Naming Conventions

The nested folder structure is difficult to navigate. To overcome this, I propose bringing all notebooks into the notebooks directory. In this case, we need a reasonable naming convention to be able to easily navigate through the apps. Overall, I think the naming convention in the dcApps is intuitive and easy to navigate, so I suggest we use

Physics_Model(_Assumption).ipynb

eg. for the DC apps, the Physics is DC, the Model is Plate or Cylinder and the Assumption is 2D or 2_5D (assumption might not be applicable in all cases).

thoughts @sgkang, @thast, @micmitch, @dccowan ?

Images

can we put all images in the images folder instead of including them in the notebooks folder?

Index.ipynb

to make sure that people can navigate to the apps from the index notebook, the index notebook should contain the title of the app and a short description of the app (can include an image!). Links are relative links eg:

[DC_Cylinder_2D.ipynb](notebooks/DC_Cylinder_2D.ipynb)

No module named 'em_examples'

Dear,

I followed instructions regarding running em-apps on Azure Notebooks but it didn't work. There's the output. Should I have some "!pip install ..." somewhere?

image

I could ran previous version of em-apps (cloned from Lindsey personal repo) very sound. What can I be doing wrong?

Thanks in advance,
Leonardo

VMD over a sphere (FDEM)

Similar to #39. The notebook FDEM_vmd_sounding_over_sphere.ipynb provides a good starting point

  • sphere in a halfspace - with a single layer above the sphere - on the 2D cylindrical mesh
  • user should be able to change
    • depth, radius of sphere
    • conductivity of sphere, halfspace
    • height, frequency of source
  • for viewing: currents, electric field, magnetic field / flux

HMD app

App for a horizontal magnetic dipole over a halfspace (TDEM)

  • 3D tensor mesh
  • user can define conductivity of the half-space
  • solve 3D problem
  • viewer / app on the fields object (view currents, electric and magnetic fields, db/dt) through time

em_examples

em_examples is not in the environment.yml, so the following notebook fails and needs installation of em_examples: http://localhost:8889/notebooks/notebooks/GPR_Attenuation.ipynb

VMD over a sphere - TDEM

Time Domain EM sounding over a sphere with a vertical magnetic dipole source and step-off waveform (eventually, it would be fun to play with other waveforms... but that is out-of-scope for now). This can be built from the tutorial notebook showing a TDEM_vmd_sounding_over_sphere.ipynb in the simpeg/em_notebooks:

  • sphere in a halfspace - with a single layer above the sphere - on the 2D cylindrical mesh
  • user should be able to change
    • depth, radius of sphere
    • conductivity of sphere, halfspace
    • height of source
  • for viewing: currents, electric field, magnetic field / flux / db/dt through time

VMD Wholespace - B, dBdt

For both FDEM_MagneticDipole_Wholespace.ipynb, TDEM_MagneticDipole_Wholespace.ipynb, it would be nice to include B (and dBdt for TDEM) for completeness.

@sgkang or @dccowan: would you be willing to take this on?

image

No Jx component for VMD over a halfspace?

I was exploring the app TDEM_HorizontalLoop_LayeredEarth. The parameters that I used are summarized in the following figure.
tdem

How come there is no Jx component, if the induced current is flowing in a circular fashion, as shown below?
If only Jy exists, then current would only flow in y direction, then the current would not flow in a circular manner.

picture1

(I have the exact same problem with the app FDEM_VMD_LayeredEarth.ipynb)

FDEM_Planewave_Reflection

  • Can "Type" in this app be organized: angle, reflection, transmission? This parallels the fact we introduce Snell's law, followed by the Fresnel equations.

  • We should introduce magnetic permeability and dielectric permittivity. That way, we can extend this app to the wave regime and no just the quasi-static.

simplify the marine CSEM app

  • extract large code blocks into em_examples
  • add a few instructions / text giving an overview of the app and what users are looking at

Induction logging example

  • cylindrically symmetric example, no casing, 3 zones modelled by concentric cylinders in the model
    image
  • be able to change:
    • the resistivity and radius of each of these zones,
    • operating frequency
  • view currents and see how the earth is sampled differently depending on the freq employed (e.g. showing the concept of apparent resistivity, but we don't necessarily have to compute it)

linear inverse problem app

Linear inverse problem in app form
image

Model

boxcar + gaussian

  • user should be able to adjust model parameters: height width and location of both boxcar and gaussian

Kernels

decaying exponentials

  • user should be able to set number of kernels, j0, jn, rate of decay (or growth), rate of oscillation
  • plot kernels

Data

  • plot data
  • add noise

Regularization function

  • change reference model
  • change alphas

Inverse problem

  • change trade-off parameter
  • view tikhonov curve, where the model is on that curve
  • plot pred, obs data
  • true and recovered model

Jupyter links broken

The links to both Binder and Azure in the readme both don't work and need updating.

DC figures are not aligned anymore

While they were before, panels in figures from some DC apps (DC_cylinder_2D for example) are no longer aligned with each other anymore (probably due to update to either the code itself or matplotlib library)

image

Linear inversion app

  • kernels - dynamic ylim by default
  • j is always an integer
  • 1 datum case
  • bug for 2 data
  • multiply phid by 2

Not found

The link TDEM_Inductivesource.ipynb in the index.ipynb ends up in a 404 : Not Found error.

Ready -to-go apps missing

In the past I constructed many exercises using apps, but now I can't find the apps anymore. I used the following sequence:

  1. Open Menu Start (bottom left on the desktop of a Windows computer) and open the folder Anaconda3 (32-bit)
  2. Click Jupyter Notebook
  3. Two things will be opened:
  4. a terminal window called (rather confusingly) Jupyter Notebook
  5. a browser window called Home.
  6. In the browser window you will see the content of your computer. It is a explorer like window.
  7. Click on the names of the folders to open them. And find your way to the Jupyter Notebook you want to open.
  8. Click the Jupyter Notebook ( recognisible by the extension .ipynb ) to open it.
  9. The Jupyter Notebook will open in a new window, leaving the ‘Home’ window in tact.
  10. Often an old, saved version will be shown.
  11. To run the Jupyter Notebook click Cell → Run All
    What should I do?
    If I use Google Colab and load a .ipynb file from em-masters it tells me that it misses many pieces.

InductionRLCircuit apps

Thanks @dccowan for your work on these! I have gone through the notebooks with @dougoldenburg and @sgkang and here is the synthesis of that conversation

Summary of Requested Changes

Two notebooks should suffice for explaining the 2 loop example:

  • InductionRLcircuit_Harmonic.ipynb
  • InductionRLcircuit_Transient.ipynb
    The additional plot that shows the response function (currently in InductionRLcircuit_FDEM_Harmonic) can be moved to InductionRLcircuit_Harmonic.ipynb.

Harmonic

  • Most of the supporting mathematical theory should be moved to EM geosci and not included in the app. The final form of the solution can still be there
    image
    the rest should be in EM geosci and a link provided for the derivation. To include a link:
<a href="http://em.geosci.xyz">text to link</a>
  • a few requests on layout / visualization...

    • put a light grey line through 0 on both plots
      image
    • please make the vertical extent of the above plots a bit smaller
  • for layout, could you please

    • move the info currently listed in the top right panel (Bp, Bn, Area) to a semi-transparent box in the top left hand corner of the fields plot
    • the response function plot can be made square and replace the plot in the top right hand corner plot. The text info from this plot can be removed (it is either in the widgets or shown in the plots below).
      image

Transient

  • again, most of the Mathematical Theory can be moved to em geosci and linked. Just the main governing equation can be kept
    image

3 loop coil app

The EM_ThreeLoopModel.ipynb notebook would also be valuable to have in em_apps. Lets copy it over here.

  • copy EM_ThreeLoopModel.ipynb to em_apps
  • ensure necessary code is in the em_examples repository
  • have the copy of EM_ThreeLoopModel.ipynb that is in gpgLabs import from em_examples so that there is only one copy of the python code being maintained (and delete the code from gpgLabs)

UXO notebook: TypeError: object of type 'zip' has no len()

TDEM_UXO.ipynb

After installing cvxopt in Python 3.7, the UXO-notebook still fails with the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/ipywidgets/widgets/interaction.py in update(self, *args)
    254                     value = widget.get_interact_value()
    255                     self.kwargs[widget._kwarg] = value
--> 256                 self.result = self.f(**self.kwargs)
    257                 show_inline_matplotlib_plots()
    258                 if self.auto_display and self.result is not None:

~/anaconda3/lib/python3.7/site-packages/geoscilabs/em/UXO_TEM_Widget.py in fcnImageUXOWidget(psi, theta, phi, k1, alpha1, beta1, gamma1, k2, alpha2, beta2, gamma2, k3, alpha3, beta3, gamma3, tn)
   1507     # Orientation plot
   1508     ax1.add_collection3d(
-> 1509         Poly3DCollection(v1, facecolors="k", linewidths=0.25, edgecolors="k")
   1510     )
   1511     ax1.add_collection3d(

~/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py in __init__(self, verts, zsort, *args, **kwargs)
    595         and _edgecolors properties.
    596         """
--> 597         super().__init__(verts, *args, **kwargs)
    598         self.set_zsort(zsort)
    599         self._codes3d = None

~/anaconda3/lib/python3.7/site-packages/matplotlib/collections.py in __init__(self, verts, sizes, closed, **kwargs)
   1044         Collection.__init__(self, **kwargs)
   1045         self.set_sizes(sizes)
-> 1046         self.set_verts(verts, closed)
   1047         self.stale = True
   1048 

~/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py in set_verts(self, verts, closed)
    650     def set_verts(self, verts, closed=True):
    651         """Set 3D vertices."""
--> 652         self.get_vector(verts)
    653         # 2D verts will be updated at draw time
    654         PolyCollection.set_verts(self, [], False)

~/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py in get_vector(self, segments3d)
    634         for p in segments3d:
    635             points.extend(p)
--> 636             ei = si + len(p)
    637             segis.append((si, ei))
    638             si = ei

TypeError: object of type 'zip' has no len()

Python 3.8

This should be a temporary issue.

The command

conda env create -f environment.yml

will now install a Python 3.8 environment. However, not all the dependencies are capable of that yet. So, for instance, the notebook http://localhost:8888/notebooks/notebooks/em/TDEM_UXO.ipynb will fail, because cvxopt cannot be installed in Python 3.8 yet,

try:
    import cvxopt
except ImportError:
    import sys
    !{sys.executable} -m pip install cvxopt

So maybe we could fix the version currently with something like

conda env create python=3.7 -f environment.yml

TDEM grounded bipole at the surface

App for a grounded bipole over a halfspace (TDEM)

  • 3D tensor mesh
  • user can define conductivity of the half-space
  • solve 3D problem
  • viewer / app on the fields object (view currents, electric and magnetic fields, db/dt) through time

image

geoscilabs

geoscilabs is not in the environment, I had to install it additionally.

It would throw an error in at least the following notebooks (maybe in more):

  • TDEM_HorizontalLoop_Sphere.ipynb
  • FDEM_VMD_Sphere.ipynb
  • FDEM_VMD_LayeredEarth.ipynb

ModuleNotFoundError: No module named 'geoscilabs'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.