Code Monkey home page Code Monkey logo

simpeg / simpeg Goto Github PK

View Code? Open in Web Editor NEW
468.0 54.0 256.0 88.34 MB

Simulation and Parameter Estimation in Geophysics - A python package for simulation and gradient based parameter estimation in the context of geophysical applications.

Home Page: http://simpeg.xyz

License: MIT License

Python 99.97% Makefile 0.03%
python finite-volume geophysics inversion linear-algebra partial-differential-equations optimization geoscience modelling simulation

simpeg's Introduction

SimPEG Logo

SimPEG

Latest PyPI version

Latest conda-forge version

MIT license

Coverage status

image

image

image

image

Simulation and Parameter Estimation in Geophysics - A python package for simulation and gradient based parameter estimation in the context of geophysical applications.

The vision is to create a package for finite volume simulation with applications to geophysical imaging and subsurface flow. To enable the understanding of the many different components, this package has the following features:

  • modular with respect to the spacial discretization, optimization routine, and geophysical problem
  • built with the inverse problem in mind
  • provides a framework for geophysical and hydrogeologic problems
  • supports 1D, 2D and 3D problems
  • designed for large-scale inversions

You are welcome to join our forum and engage with people who use and develop SimPEG at: https://simpeg.discourse.group/.

Weekly meetings are open to all. They are generally held on Wednesdays at 10:30am PDT. Please see the calendar (GCAL, ICAL) for information on the next meeting.

Overview Video

All of the Geophysics But Backwards

Working towards all the Geophysics, but Backwards - SciPy 2016

Citing SimPEG

There is a paper about SimPEG!

Cockett, R., Kang, S., Heagy, L. J., Pidlisecky, A., & Oldenburg, D. W. (2015). SimPEG: An open source framework for simulation and gradient based parameter estimation in geophysical applications. Computers & Geosciences.

BibTex:

@article{cockett2015simpeg,
  title={SimPEG: An open source framework for simulation and gradient based parameter estimation in geophysical applications},
  author={Cockett, Rowan and Kang, Seogi and Heagy, Lindsey J and Pidlisecky, Adam and Oldenburg, Douglas W},
  journal={Computers \& Geosciences},
  year={2015},
  publisher={Elsevier}
}

Electromagnetics

If you are using the electromagnetics module of SimPEG, please cite:

Lindsey J. Heagy, Rowan Cockett, Seogi Kang, Gudni K. Rosenkjaer, Douglas W. Oldenburg, A framework for simulation and inversion in electromagnetics, Computers & Geosciences, Volume 107, 2017, Pages 1-19, ISSN 0098-3004, http://dx.doi.org/10.1016/j.cageo.2017.06.018.

BibTex:

@article{heagy2017,
    title= "A framework for simulation and inversion in electromagnetics",
    author= "Lindsey J. Heagy and Rowan Cockett and Seogi Kang and Gudni K. Rosenkjaer and Douglas W. Oldenburg",
    journal= "Computers & Geosciences",
    volume = "107",
    pages = "1 - 19",
    year = "2017",
    note = "",
    issn = "0098-3004",
    doi = "http://dx.doi.org/10.1016/j.cageo.2017.06.018"
}

Questions

If you have a question regarding a specific use of SimPEG, the fastest way to get a response is by posting on our Discourse discussion forum: https://simpeg.discourse.group/. Alternatively, if you prefer real-time chat, you can join our Mattermost Team at https://mattermost.softwareunderground.org/simpeg. Please do not create an issue to ask a question.

Meetings

SimPEG hosts weekly meetings for users to interact with each other, for developers to discuss upcoming changes to the code base, and for discussing topics related to geophysics in general. Currently our meetings are held every Wednesday, alternating between a mornings (10:30 am pacific time) and afternoons (3:00 pm pacific time) on even numbered Wednesdays. Find more info on our Mattermost.

Website: https://simpeg.xyz

Forums: https://simpeg.discourse.group/

Mattermost (real time chat): https://mattermost.softwareunderground.org/simpeg

Documentation: https://docs.simpeg.xyz

Code: https://github.com/simpeg/simpeg

Tests: https://dev.azure.com/simpeg/simpeg/_build

Bugs & Issues: https://github.com/simpeg/simpeg/issues

Contributing

We always welcome contributions towards SimPEG whether they are adding new code, suggesting improvements to existing codes, identifying bugs, providing examples, or anything that will improve SimPEG. Please checkout the contributing guide for more information on how to contribute.

simpeg's People

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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simpeg's Issues

Rename Data to Survey

Survey I think fits what we are talking about more than a 'Data'. It is confusing to call this part of the framework 'Data'. We do a Survey, which has information about Tx, Rx, and has dobs, we then pair a problem and survey together to simulate dpred.

This naming convention is also confusing when we start having more complicated data-structures than just vectors, for example if you have many freqs or transmitters, and a ndarray just doesn't cut it anymore.

Talked about this with @sgkang and @lheagy today. @dwfmarchant do you agree? @lacmajedrez?

dtype when creating mesh

Mesh creation doesn't work with integers in the hx, hy, hz, vectors.

This code works:

#!python

hx = r_[1.,2.,3.]
hy = r_[1.,2.,3.]
hz = r_[1.,2.,3.]
m = SimPEG.mesh.TensorMesh((hx,hy,hz))
spy(m.cellGrad)

This code doesn't:

#!python

hx = r_[1,2,3]
hy = r_[1,2,3]
hz = r_[1,2,3]
m = SimPEG.mesh.TensorMesh((hx,hy,hz))
spy(m.cellGrad)

Averaging Matrices

aveCC2F should take into account the length scale. This can be tested by using a randomTensorMesh.

The other averaging matrices should be tested more rigorously as well.

Scanned sushi menu

I know there was a menu around here somewhere. If someone has one, can we scan it and attach it to the Wiki? It would make life easier to change it up when ordering sushi (unless we like the same stuff over and over again).


Tensor Mesh interpolation algorithm

This should live in the mesh class. Or be inherited by each mesh class.

should provide an interpolation matrix that can take data (on cc, n, f, or e) and return the interpolated value.

This is needed for generating data (dpred) from the fields etc.

Implementation should have a few test cases as well.


TimeDomain Problem

Make a base class for a time domain problem.

Some things to keep in mind:

timeStep = [1e-4, (1e-5, 50), 10]
assert getDt(30)==1e-5

use the 1D mesh code, superclass, and get rid of some methods?

checkpointing?

CG in CG not possible in Scipy?

I ran into an issue in the scipy.linalg.cg algorithm.

The code does not allow you to run two CG loops at once. For example, if you want to use an iterative preconditioner (perhaps solving regularization WtW x = -g) inside inexact gauss newton. The code breaks, because scipy doesn't let you use two CG algorithms at the same time.

https://github.com/scipy/scipy/blob/master/scipy/sparse/linalg/isolve/iterative.py#L82

This might be a big issue if we are going to large-scale simulations where we cannot directly solve anything inside our inexact gauss newton, and have to use CG in a lot of other places while inside a big CG iteration.

Also, it might be bad if we need to parallelize a lot of CG algorithms at once?

Has any one else run into these problems? Should we be using another package for our iterative solvers?

Thoughts?


Annoyed with Utils.meshTensors

This example is bit annoying for me.

Current example
h1 = ( (numPad, sizeStart [, increaseFactor]), (numCore, sizeCore), (numPad, sizeStart [, increaseFactor]) )

We may just say
in 1D
hx = Utils.meshTensor( (numPad, sizeStart,increaseFactor), (numCore, sizeCore), (numPad, sizeStart,increaseFactor) )

2D and 3D .. and so on

Slice through model

Be able to create a figure of a 3D field sliced in various diections.

Z-slices, equally spaced, edges, faces, cell centers

overlay mesh

quiver plots

real, imag, amplitude

downsampling

change axes, get rid of padding

(make them into videos!!)

innerProducts vs MassMatrices

h = [4,np.r_[1,2], np.random.rand(2)]
for dim in [2,3]:
    M = Mesh.TensorMesh(h[:dim])
    Mf = M.getFaceInnerProduct()
    Af = M.getFaceMass()
    print np.linalg.norm(Mf.diagonal()/dim - Af.diagonal())
    Me = M.getEdgeInnerProduct()
    Ae = M.getEdgeMass()
    print np.linalg.norm(Me.diagonal()/dim - Ae.diagonal())
1.30185189291e-16
1.30185189291e-16
1.95397176322e-17
1.9664450708e-17

It looks like the faceMass is 2 or 3 times the getFaceMass, but otherwise these methods are identical.

It would be good to remove one of the methods if they are indeed duplicates.
I would remove the Innerproduct code that is user facing, and make Mass code point to that instead, as it works for anisotropic properties.

__init__.py and Naming Conventions

I am having some problems with the file directory and importing things.

This is especially the case when importing something of the same name as the file:

#!python

from SimPEG.forward.LinearProblem import example  #  Works!
import SimPEG.forward.LinearProblem as LinearProblem
LinearProblem.example   #  does not exist

This is because LinearProblem is a Class inside the file called LinearProblem.

Things to think about:

  • I think we should avoid having file names and the classes inside named the same thing
  • This may mean that we have to shuffle some things around or combine files
  • We need to figure out how to put all of the different forward problems in the directory.

Thoughts?
Does anyone have experience setting up the structure of python directories? and knows what actually goes in the init.py file?

I am kinda lost.


python matrix vector products

There is a serious issue multiplying matrices time vectors in numpy and the action of numpy matrices times numpy vectors.

Consider the following

#!python

from SimPEG import utils as ut
import numpy as np
import matplotlib.pyplot as plt
from SimPEG import TensorMesh
from scipy import sparse as sp
from SimPEG import utils as ut
import scipy.sparse.linalg.dsolve as dsl

generate a sparse matrix A and a dense matrix C

#!python

h = [np.array([1,1,1,1]),np.array([1,1,1,1]),np.array([1,1,1,1])]
M = TensorMesh(h)
G = M.nodalGrad
I = sp.eye(125)
A = G.T*G
A = A+I
C = np.matrix(np.random.randn(4,125))
b = np.random.randn(125)

can do that

#!python

z = A*b

cannot do that

#!python

y = C*b

If on the other hand we set

#!python

b = mkvc(b,2)

then

#!python

b = ut.mkvc(b,2)

can do that

#!python

z = A*b

cannot do that

#!python

y = C*b

Then it all works

Now, we still need to be careful as

#!python

print np.shape(b.T*b), np.shape(np.inner(b,b)), np.shape(np.outer(b,b))

all gives 125 times 125 arrays

sigh ...

We need to come up with a solution to this!


Interpolation Bugs

There is a bug in interpolation in TensorMesh if x0 is set to <0
and if the interpolated point is on the boundary of the domain.

For Example:

mesh = Mesh.TensorMesh([4, 4],x0=[0, 0])
spy(mesh.getInterpolationMat([[0,1]],'CC'))

These need to be documented with test cases.

checkDeriv

Want starting and stopping h values

clean up the headers

take function for first value

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.