Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
kwinkunks committed Apr 6, 2022
2 parents 68997c0 + 71a5397 commit 24e2e79
Show file tree
Hide file tree
Showing 15 changed files with 1,573 additions and 43 deletions.
14 changes: 11 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Changelog

## 0.5.4 — 6 April 2022

- Fixed small issue with the Klauder wavelet not working when `autocorrelation` was `False`.
- Changed the names of the `convolve` arguments to `arr` and `v` to better match NumPy.
- The version number is now correctly stored in the `__version__` attribute.
- Added a User Guide notebook on [making wavelets](https://code.agilescientific.com/bruges/userguide/Making_wavelets.html).
- Added a User Guide notebook on [seismic attributes](https://code.agilescientific.com/bruges/userguide/Seismic_attributes.html).

## 0.5.3 — 21 February 2022

- Fixed [issue #92](https://github.com/agile-geoscience/bruges/issues/92): the Ormsby, Ormsby FFT and Klauder wavelets now behave as expected when 2D arrays (lists of frequency parameters, essentially) are passed. A filter bank (array of wavelets) is returned.
- Fixed [issue #93](https://github.com/agile-geoscience/bruges/issues/93): the Sinc, Cosine and Gabor wavelets now behave as expected when `sym` is passed.
- Fixed [issue #92](https://github.com/agilescientific/bruges/issues/92): the Ormsby, Ormsby FFT and Klauder wavelets now behave as expected when 2D arrays (lists of frequency parameters, essentially) are passed. A filter bank (array of wavelets) is returned.
- Fixed [issue #93](https://github.com/agilescientific/bruges/issues/93): the Sinc, Cosine and Gabor wavelets now behave as expected when `sym` is passed.
- `reflection.convolve()` now works properly when the axis is specified, and a verbose option was added to show the input and output array shapes (helps with troubleshooting).

## 0.5.2 — 18 February 2022
Expand Down Expand Up @@ -58,7 +66,7 @@
- Moved `rotate_phase()` to `bruges.filters` and it now should handle 2D and 3D seismic correctly. You can also pass an array-like of phases to get a 'phase bank' of rotations, similar to how this works with frequencies and wavelet banks.

## v0.4 — 27 November 2020
- **Breaking change:** fixed numerous minor issues with `attribute.energy()`, see [issue 78](https://github.com/agile-geoscience/bruges/issues/78). Note that it now expects time to be in the last dimension of the array. The function now runs on n-D data and is also about 15 times faster.
- **Breaking change:** fixed numerous minor issues with `attribute.energy()`, see [issue 78](https://github.com/agilescientific/bruges/issues/78). Note that it now expects time to be in the last dimension of the array. The function now runs on n-D data and is also about 15 times faster.
- Multiple fixes to the documentation, thanks especially to Jesper Dramsch and Adriana Gordon.
- Added the `filters.berlage()` wavelet, a causal, minimum phase wavelet good for marine airgun sources.
- Added the `filters.generalized()` wavelet, of which the Ricker is a special case, as defined by Wang 2015, Geophys J Int 203, p1172ff.
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

There are several important ways you can help; here are some examples:

- Submitting bug reports and feature requests: see [Issues](https://github.com/agile-geoscience/bruges/issues).
- Submitting bug reports and feature requests: see [Issues](https://github.com/agilescientific/bruges/issues).
- Proposing code for bug fixes and new features, then [making a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests).
- Fixing typos and generally improving the documentation.
- Writing tutorials, examples, and how-to documents.


## Code of conduct

We're fortunate to be part of a large professional community that conducts itself with mutual respect and consideration for others. Agile's [Code of Conduct](https://github.com/agile-geoscience/community/blob/main/CODE_OF_CONDUCT.md) is part of protecting these features for everyone, everywhere. Please read it.
We're fortunate to be part of a large professional community that conducts itself with mutual respect and consideration for others. Agile's [Code of Conduct](https://github.com/agilescientific/community/blob/main/CODE_OF_CONDUCT.md) is part of protecting these features for everyone, everywhere. Please read it.


## Authorship

If you contribute a pull request to the project, please add yourself to `AUTHORS.md`.
If you contribute a pull request to the project, please add yourself to `AUTHORS.md`.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

In other words, it's just a load of functions that implement important equations in (mostly seismic) geophysics, from Aki-Richards to Zoeppritz.

[![Run tests](https://github.com/agile-geoscience/bruges/actions/workflows/run-tests.yml/badge.svg)](https://github.com/agile-geoscience/bruges/actions/workflows/run-tests.yml)
[![Build docs](https://github.com/agile-geoscience/bruges/actions/workflows/build-docs.yml/badge.svg)](https://github.com/agile-geoscience/bruges/actions/workflows/build-docs.yml)
[![Run tests](https://github.com/agilescientific/bruges/actions/workflows/run-tests.yml/badge.svg)](https://github.com/agilescientific/bruges/actions/workflows/run-tests.yml)
[![Build docs](https://github.com/agilescientific/bruges/actions/workflows/build-docs.yml/badge.svg)](https://github.com/agilescientific/bruges/actions/workflows/build-docs.yml)
[![PyPI version](https://img.shields.io/pypi/v/bruges.svg)](https://pypi.python.org/pypi/bruges/)
[![PyPI versions](https://img.shields.io/pypi/pyversions/bruges.svg)](https://pypi.org/project/bruges//)
[![PyPI license](https://img.shields.io/pypi/l/bruges.svg)](https://pypi.org/project/bruges/)
Expand All @@ -32,7 +32,7 @@ This produces two arrays: amplitude `w` and time `t`.
## Links

- [Documentation](https://code.agilescientific.com/bruges)
- [Issue Tracker](https://github.com/agile-geoscience/bruges/issues/)
- [Issue Tracker](https://github.com/agilescientific/bruges/issues/)
- [PyPi](http://pypi.python.org/pypi/bruges/)
- [Agile's website](http://www.agilescientific.com)

Expand Down
17 changes: 13 additions & 4 deletions bruges/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,17 @@
from .get_bruges import get_bruges
from .bruges import BrugesError

__version__ = "unknown"
from pkg_resources import get_distribution, DistributionNotFound

try:
from ._version import __version__
except ImportError:
pass
VERSION = get_distribution(__name__).version
except DistributionNotFound:
try:
from ._version import version as VERSION
except ImportError:
raise ImportError(
"Failed to find (autogenerated) _version.py. "
"This might be because you are installing from GitHub's tarballs, "
"use the PyPI ones."
)
__version__ = VERSION
20 changes: 10 additions & 10 deletions bruges/filters/convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,43 @@
from bruges.util import apply_along_axis


def convolve(arr, wavelet, axis=-1, verbose=False):
def convolve(arr, v, axis=-1, verbose=False):
"""
Convolve n-dimensional arr with a 1D wavelet or 2D wavelet bank.
Args:
arr (ndarray): The trace, or 2D section, or volume.
wavelet (ndarray): The wavelet, must be 1D function or a 2D wavelet 'bank'.
v (ndarray): The wavelet, must be 1D function or a 2D wavelet 'bank'.
If a wavelet bank, time should be on the last axis.
axis (int): The time axis of the arr data. In other words, the axis
corresponding to a single 'trace'. If you index into this axis,
you will get a single 'trace'.
verbose (bool): If True, print out the shapes of the inputs and output.
Returns:
ndarray: Discrete, linear convolution of `arr` and `wavelet`.
ndarray: Discrete, linear convolution of `arr` and `v`.
"""
if wavelet.shape[-1] > arr.shape[axis]:
raise TypeError("Wavelet must shorter in time than the arr.")
if v.shape[-1] > arr.shape[axis]:
raise TypeError("v (e.g. wavelet) must be shorter in time than arr (e.g. reflectivity).")

arr_ = np.moveaxis(np.asanyarray(arr), axis, -1)

# Compute the target shape of the final synthetic.
outshape = wavelet.shape[:-1] + arr_.shape
outshape = v.shape[:-1] + arr_.shape

# Force wavelet and arr to both be 2D.
bank = np.atleast_2d(wavelet)
# Force v and arr to both be 2D.
bank = np.atleast_2d(v)
arr_2d = arr_.reshape((-1, arr_.shape[-1]))

# Compute synthetic.
syn = np.array([apply_along_axis(np.convolve, arr_2d, w, mode='same') for w in bank])

pos = axis + wavelet.ndim - 1
pos = axis + v.ndim - 1

out = np.moveaxis(syn.reshape(outshape), -1, pos)

# Show the shapes of the data we're handling.
if verbose:
print(arr.shape, ' * ', wavelet.shape, ' -> ', out.shape)
print(arr.shape, ' * ', v.shape, ' -> ', out.shape)

return out
2 changes: 2 additions & 0 deletions bruges/filters/wavelets.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ def klauder(duration, dt, f,

if autocorrelate:
w = [np.correlate(c_, c_, mode='same') for c_ in c]
else:
w = c

w = np.squeeze(w) / np.amax(w)

Expand Down
Binary file added docs/_static/ormsby-vs-ormsby_fft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
815 changes: 815 additions & 0 deletions docs/_userguide/Making_wavelets.ipynb

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/_userguide/Quick_start_wedge.ipynb

Large diffs are not rendered by default.

603 changes: 603 additions & 0 deletions docs/_userguide/Seismic_attributes.ipynb

Large diffs are not rendered by default.

97 changes: 92 additions & 5 deletions docs/_userguide/Wedge_models.ipynb

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def setup(app):

myst_enable_extensions = ["dollarmath", "amsmath"]

# MyST notebook execution
jupyter_execute_notebooks = 'force'
execution_timeout = 120

# Apidoc automation
# https://pypi.org/project/sphinxcontrib-apidoc/
# The apidoc extension and this code automatically update apidoc.
Expand Down
Binary file added docs/data/F3_seismic.npy
Binary file not shown.
8 changes: 5 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.. container:: noclass
:name: forkongithub

`Fork on GitHub <https://github.com/agile-geoscience/bruges>`_
`Fork on GitHub <https://github.com/agilescientific/bruges>`_

bruges is a
===========
Expand Down Expand Up @@ -54,7 +54,9 @@ User guide

installation
userguide/Quick_start_wedge.ipynb
userguide/Making_wavelets.ipynb
userguide/Wedge_models.ipynb
userguide/Seismic_attributes.ipynb


API reference
Expand Down Expand Up @@ -94,8 +96,8 @@ Indices and tables
:hidden:

PyPI releases <https://pypi.org/project/bruges/>
Code in GitHub <https://github.com/agile-geoscience/bruges>
Issue tracker <https://github.com/agile-geoscience/bruges/issues>
Code in GitHub <https://github.com/agilescientific/bruges>
Issue tracker <https://github.com/agilescientific/bruges/issues>
Community guidelines <https://code.agilescientific.com/community>
Agile's software <https://code.agilescientific.com>
Agile's website <https://www.agilescientific.com>
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ author_email = [email protected]
description = A library of geophysical equations.
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/agile-geoscience/bruges
url = https://github.com/agilescientific/bruges
classifiers =
Intended Audience :: Science/Research
Development Status :: 4 - Beta
Expand Down

0 comments on commit 24e2e79

Please sign in to comment.