Name | okada-wrapper JSON |
Version |
24.6.15
JSON |
| download |
home_page | None |
Summary | Python and MATLAB wrappers for the Okada Green's function codes |
upload_time | 2024-06-15 18:43:50 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT |
keywords |
okada
elastic
halfspace
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
### Note: please consider using [cutde](https://github.com/tbenthompson/cutde) instead of `okada_wrapper`. Triangular dislocations are strictly more powerful than rectangles. In addition, `cutde` supports many features not supported by `okada_wrapper`, including built-in tools to build large matrices or construct hierarchical matrix approximations. If you need a rectangular dislocation, one can easily be composed from two triangles.
#### Okada wrapper (MATLAB, Python)
Okada dislocations in Python and MATLAB!
These files are MATLAB and Python wrappers for the Okada DC3D0 point source
and the DC3D rectangular dislocation surface fortran subroutines. The Matlab
wrappers are written using the MEX functions. The original subroutine was
written by Y. Okada as part of the paper:
**Okada, Y., 1992, Internal deformation due to shear and tensile faults in a half-space, Bull. Seism. Soc. Am., 82, 1018-1040.**
The inputs and outputs here are slightly different from the okada implementation,
though not in any substantial way. Look at the [original documentation webpage
here](http://www.bosai.go.jp/study/application/dc3d/DC3Dhtml_E.html) for more details
A different MATLAB mex wrapper for the Okada dislocation sources is available on [Paul Segall's website](https://pangea.stanford.edu/research/CDFM/software/index.html).
#### Common issues:
If you're having problems installing on a recent version of OSX, see here for some help: https://github.com/tbenthompson/okada_wrapper/issues/3
#### MATLAB
Download the code::
```
git clone https://github.com/tbenthompson/okada_wrapper.git
```
Make sure that MATLAB has a properly configured compiler. This [page on MATLAB's site has details](http://www.mathworks.com/help/matlab/ref/mex.html). It seem like GCC is automatically found if it is installed.
Open matlab and run::
```
mex 'DC3D0wrapper.F'
mex 'DC3Dwrapper.F'
```
##### DC3D0wrapper
Then, DC3D0wrapper can be treated like any other MATLAB function::
```
[success, u, grad_u] = DC3D0wrapper(0.6, [1.0, 1.0, -1.0],3.0,...
90, [1.0, 0.0, 0.0, 0.0]);
```
Five arguments are required:
* alpha = (lambda + mu) / (lambda + 2 * mu)
* xo = 3-vector representing the observation point (x, y, z in the
original)
* depth = the depth of the slip plane
* dip = the dip-angle of the slip plane in degrees
* potency = 4-vector (POT1,2,3,4 in original)
* index 1 = strike-slip = Moment of double-couple / mu
* index 2 = dip-slip = Moment of double-couple / mu
* index 3 = inflation = Intensity of isotropic part / lambda
* index 4 = tensile = Intensity of linear dipole / mu
Three outputs are provided:
* success - a return code from DC3D0=0 if normal, 1 if singular, 2 if a positive z value for the observation point was given
* u - 3-vector representing the displacement at the observation point. for example, u(2) = u_y
* grad_u = the 3x3 tensor representing the partial derivatives of the displacement, for example, grad_u(1, 2) = d(u_x)/dy
##### DC3Dwrapper
DC3Dwrapper can also be used for rectangular dislocation sources
```
[success, u, grad_u] = DC3Dwrapper(0.6, [1.0, 1.0, -1.0], 3.0,...
90, [-0.7, 0.7], [-0.7, 0.7],...
[1.0, 0.0, 0.0]);
```
Seven arguments are required:
* alpha = (lambda + mu) / (lambda + 2 * mu)
* xo = 3-vector representing the observation point (x, y, z in the
original)
* depth = the depth of the fault origin
* dip = the dip-angle of the rectangular dislocation surface
* strike_width = the along-strike range of the surface (al1,al2 in
the original)
* dip_width = the along-dip range of the surface (aw1, aw2 in the
original)
* dislocation = 3-vector representing the direction of motion on the
surface (DISL1 = strike-slip, DISL2 = dip-slip, DISL3 = opening/overlap)
The outputs are identical to DC3D0wrapper
#### Python
NEW: You can install `okada_wrapper` directly from the PyPI by running::
```
pip install okada_wrapper
```
For the old, manual installation method, download the code::
```
git clone https://github.com/tbenthompson/okada_wrapper.git
```
Make sure that a Fortran compiler is installed. The wrappers are tested using gcc/gfortran, but should hopefully work with other fortran compilers.
Then, run the install script::
```
pip install ./okada_wrapper
```
The syntax is almost identical to the MATLAB version::
```
from okada_wrapper import dc3d0wrapper, dc3dwrapper
success, u, grad_u = dc3d0wrapper(0.6, [1.0, 1.0, -1.0], 3.0,
1.0, [1.0, 0.0, 0.0, 0.0])
success, u, grad_u = dc3dwrapper(0.6, [1.0, 1.0, -1.0],
3.0, 90, [-0.7, 0.7], [-0.7, 0.7],
[1.0, 0.0, 0.0])
```
The arguments and outputs are identical to the MATLAB version.
Tests
----
To run the tests, from the root directory in MATLAB type::
test_okada.m
or, for python::
python test_okada.py
![Okada plot](image.png "")
Raw data
{
"_id": null,
"home_page": null,
"name": "okada-wrapper",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "okada, elastic, halfspace",
"author": null,
"author_email": "Ben Thompson <t.ben.thompson@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9a/c9/010fa37a6b83e6fd6afb9434d9b71d454ad3d420d35205aeb333f0227e65/okada_wrapper-24.6.15.tar.gz",
"platform": null,
"description": "### Note: please consider using [cutde](https://github.com/tbenthompson/cutde) instead of `okada_wrapper`. Triangular dislocations are strictly more powerful than rectangles. In addition, `cutde` supports many features not supported by `okada_wrapper`, including built-in tools to build large matrices or construct hierarchical matrix approximations. If you need a rectangular dislocation, one can easily be composed from two triangles. \n\n\n#### Okada wrapper (MATLAB, Python)\n\nOkada dislocations in Python and MATLAB! \n\nThese files are MATLAB and Python wrappers for the Okada DC3D0 point source\nand the DC3D rectangular dislocation surface fortran subroutines. The Matlab \nwrappers are written using the MEX functions. The original subroutine was \nwritten by Y. Okada as part of the paper:\n\n**Okada, Y., 1992, Internal deformation due to shear and tensile faults in a half-space, Bull. Seism. Soc. Am., 82, 1018-1040.**\n\nThe inputs and outputs here are slightly different from the okada implementation,\nthough not in any substantial way. Look at the [original documentation webpage\nhere](http://www.bosai.go.jp/study/application/dc3d/DC3Dhtml_E.html) for more details\n\nA different MATLAB mex wrapper for the Okada dislocation sources is available on [Paul Segall's website](https://pangea.stanford.edu/research/CDFM/software/index.html).\n\n#### Common issues:\nIf you're having problems installing on a recent version of OSX, see here for some help: https://github.com/tbenthompson/okada_wrapper/issues/3\n\n#### MATLAB\n\nDownload the code::\n\n```\ngit clone https://github.com/tbenthompson/okada_wrapper.git\n```\n\nMake sure that MATLAB has a properly configured compiler. This [page on MATLAB's site has details](http://www.mathworks.com/help/matlab/ref/mex.html). It seem like GCC is automatically found if it is installed.\n\nOpen matlab and run::\n\n```\nmex 'DC3D0wrapper.F'\nmex 'DC3Dwrapper.F'\n```\n\n##### DC3D0wrapper\n\nThen, DC3D0wrapper can be treated like any other MATLAB function::\n\n```\n[success, u, grad_u] = DC3D0wrapper(0.6, [1.0, 1.0, -1.0],3.0,...\n 90, [1.0, 0.0, 0.0, 0.0]);\n```\n\n\nFive arguments are required:\n\n* alpha = (lambda + mu) / (lambda + 2 * mu)\n* xo = 3-vector representing the observation point (x, y, z in the\n original)\n* depth = the depth of the slip plane\n* dip = the dip-angle of the slip plane in degrees\n* potency = 4-vector (POT1,2,3,4 in original)\n * index 1 = strike-slip = Moment of double-couple / mu\n * index 2 = dip-slip = Moment of double-couple / mu\n * index 3 = inflation = Intensity of isotropic part / lambda\n * index 4 = tensile = Intensity of linear dipole / mu\n\nThree outputs are provided:\n\n* success - a return code from DC3D0=0 if normal, 1 if singular, 2 if a positive z value for the observation point was given\n* u - 3-vector representing the displacement at the observation point. for example, u(2) = u_y\n* grad_u = the 3x3 tensor representing the partial derivatives of the displacement, for example, grad_u(1, 2) = d(u_x)/dy\n\n##### DC3Dwrapper\n\nDC3Dwrapper can also be used for rectangular dislocation sources\n```\n[success, u, grad_u] = DC3Dwrapper(0.6, [1.0, 1.0, -1.0], 3.0,...\n 90, [-0.7, 0.7], [-0.7, 0.7],...\n [1.0, 0.0, 0.0]);\n```\n\nSeven arguments are required:\n\n* alpha = (lambda + mu) / (lambda + 2 * mu)\n* xo = 3-vector representing the observation point (x, y, z in the\n original)\n* depth = the depth of the fault origin\n* dip = the dip-angle of the rectangular dislocation surface\n* strike_width = the along-strike range of the surface (al1,al2 in\n the original)\n* dip_width = the along-dip range of the surface (aw1, aw2 in the \n original)\n* dislocation = 3-vector representing the direction of motion on the\n surface (DISL1 = strike-slip, DISL2 = dip-slip, DISL3 = opening/overlap)\n\nThe outputs are identical to DC3D0wrapper\n\n#### Python\n\nNEW: You can install `okada_wrapper` directly from the PyPI by running::\n\n```\npip install okada_wrapper\n```\n\nFor the old, manual installation method, download the code::\n\n```\ngit clone https://github.com/tbenthompson/okada_wrapper.git\n```\n\nMake sure that a Fortran compiler is installed. The wrappers are tested using gcc/gfortran, but should hopefully work with other fortran compilers.\n\nThen, run the install script::\n\n```\npip install ./okada_wrapper\n```\n\nThe syntax is almost identical to the MATLAB version::\n\n```\nfrom okada_wrapper import dc3d0wrapper, dc3dwrapper\nsuccess, u, grad_u = dc3d0wrapper(0.6, [1.0, 1.0, -1.0], 3.0,\n 1.0, [1.0, 0.0, 0.0, 0.0])\nsuccess, u, grad_u = dc3dwrapper(0.6, [1.0, 1.0, -1.0],\n 3.0, 90, [-0.7, 0.7], [-0.7, 0.7],\n [1.0, 0.0, 0.0]) \n```\n\nThe arguments and outputs are identical to the MATLAB version.\n\nTests\n----\n\nTo run the tests, from the root directory in MATLAB type::\n\n test_okada.m\n\nor, for python::\n \n python test_okada.py\n\n![Okada plot](image.png \"\")\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python and MATLAB wrappers for the Okada Green's function codes",
"version": "24.6.15",
"project_urls": null,
"split_keywords": [
"okada",
" elastic",
" halfspace"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0f3543ead5d80e6ccac35812f371795993cee389f2edadadaf640c58c112cace",
"md5": "fc9832c0705bede962371729ca9ce695",
"sha256": "de3a65710c39fb0eb4cb347ba2d4c53fdff3bebbcd5fbaa3602c5e31d13f996c"
},
"downloads": -1,
"filename": "okada_wrapper-24.6.15-cp312-cp312-macosx_14_0_arm64.whl",
"has_sig": false,
"md5_digest": "fc9832c0705bede962371729ca9ce695",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 36989,
"upload_time": "2024-06-15T18:43:49",
"upload_time_iso_8601": "2024-06-15T18:43:49.240836Z",
"url": "https://files.pythonhosted.org/packages/0f/35/43ead5d80e6ccac35812f371795993cee389f2edadadaf640c58c112cace/okada_wrapper-24.6.15-cp312-cp312-macosx_14_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9ac9010fa37a6b83e6fd6afb9434d9b71d454ad3d420d35205aeb333f0227e65",
"md5": "40adfd1162a845674d1f19dcb7cbd3cb",
"sha256": "c19bacfc4336c59d94e3ece3ed378fe2ae3496a165412c47e08164fe8b66f307"
},
"downloads": -1,
"filename": "okada_wrapper-24.6.15.tar.gz",
"has_sig": false,
"md5_digest": "40adfd1162a845674d1f19dcb7cbd3cb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 93974,
"upload_time": "2024-06-15T18:43:50",
"upload_time_iso_8601": "2024-06-15T18:43:50.906408Z",
"url": "https://files.pythonhosted.org/packages/9a/c9/010fa37a6b83e6fd6afb9434d9b71d454ad3d420d35205aeb333f0227e65/okada_wrapper-24.6.15.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-15 18:43:50",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "okada-wrapper"
}