ricker 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ricker/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ """Ricker wavelet generator for seismic simulation."""
2
+
3
+ __all__ = ["__version__", "ricker"]
4
+
5
+ from ._version import __version__
6
+ from .ricker import ricker
ricker/_version.py ADDED
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '0.2.0'
22
+ __version_tuple__ = version_tuple = (0, 2, 0)
23
+
24
+ __commit_id__ = commit_id = None
ricker/py.typed ADDED
File without changes
ricker/ricker.py ADDED
@@ -0,0 +1,80 @@
1
+ """Ricker (Mexican hat) wavelet generator for seismic simulation."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import warnings
6
+
7
+ import numpy as np
8
+ from numpy.typing import NDArray
9
+
10
+
11
+ def ricker(
12
+ f: float = 10,
13
+ duration: float = 0.5,
14
+ dt: float = 0.002,
15
+ peak_loc: float = 0.25,
16
+ *,
17
+ len: float | None = None,
18
+ ) -> NDArray[np.floating]:
19
+ """Generate a shifted causal Ricker wavelet (Mexican hat).
20
+
21
+ Parameters
22
+ ----------
23
+ f : float
24
+ Centre frequency in Hz (default ``10``).
25
+ duration : float
26
+ Signal length in seconds (default ``0.5``).
27
+ dt : float
28
+ Time sampling interval in seconds (default ``0.002``).
29
+ peak_loc : float
30
+ Location of the wavelet peak in seconds (default ``0.25``).
31
+ len : float, optional
32
+ Deprecated alias for *duration*, the name used up to 0.1.2. Passing
33
+ it emits a ``DeprecationWarning``.
34
+
35
+ Returns
36
+ -------
37
+ NDArray[np.floating]
38
+ Shifted Ricker wavelet starting at *t = 0*.
39
+
40
+ Raises
41
+ ------
42
+ ValueError
43
+ If *f*, *duration*, or *dt* are not positive.
44
+ TypeError
45
+ If both *len* and a non-default *duration* are given.
46
+
47
+ Notes
48
+ -----
49
+ The returned signal always starts at *t = 0*. For a different starting
50
+ point, shift the corresponding time vector instead.
51
+ """
52
+ if len is not None:
53
+ if duration != 0.5:
54
+ raise TypeError("Pass duration or the deprecated len, not both.")
55
+ warnings.warn(
56
+ "ricker(len=...) is deprecated; use duration=... instead.",
57
+ DeprecationWarning,
58
+ stacklevel=2,
59
+ )
60
+ duration = len
61
+
62
+ if f <= 0:
63
+ raise ValueError("Centre frequency (f) must be positive.")
64
+ if duration <= 0:
65
+ raise ValueError("Signal duration must be positive.")
66
+ if dt <= 0:
67
+ raise ValueError("Time interval (dt) must be positive.")
68
+
69
+ n_samples = int(duration / dt)
70
+
71
+ if duration < peak_loc:
72
+ warnings.warn(
73
+ "Peak location is outside the signal range. Returning all-zero output.",
74
+ stacklevel=2,
75
+ )
76
+ return np.zeros(n_samples)
77
+
78
+ t = np.linspace(-peak_loc, duration - peak_loc - dt, n_samples)
79
+ pf2t2 = np.pi**2 * f**2 * t**2
80
+ return (1 - 2 * pf2t2) * np.exp(-pf2t2)
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: ricker
3
+ Version: 0.2.0
4
+ Summary: Ricker Wavelet Generator for Seismic Simulation
5
+ Author-email: Lijun Zhu <gatechzhu@gmail.com>
6
+ License-Expression: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Classifier: Topic :: Scientific/Engineering :: Physics
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy>=1.24
22
+ Dynamic: license-file
23
+
24
+ # Ricker Wavelet Generator
25
+
26
+ [![PyPI version](https://img.shields.io/pypi/v/ricker)](https://pypi.org/project/ricker/)
27
+ ![License](https://img.shields.io/pypi/l/ricker)
28
+ ![Python versions](https://img.shields.io/pypi/pyversions/ricker)
29
+ [![CI/CD](https://github.com/lijunzh/ricker/actions/workflows/cicd.yml/badge.svg)](https://github.com/lijunzh/ricker/actions/workflows/cicd.yml)
30
+
31
+ ## Introduction
32
+
33
+ The [Ricker wavelet](http://wiki.seg.org/wiki/Dictionary:Ricker_wavelet)
34
+ (Mexican hat) is widely used in synthetic seismic simulation. While
35
+ [SciPy](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ricker.html)
36
+ offers a basic generator, this package provides a shifted, causal Ricker
37
+ wavelet with configurable peak location — ready for seismic modelling.
38
+
39
+ ## Project status: maintenance mode
40
+
41
+ ricker is feature-complete, and no new features are planned. It stays
42
+ maintained so that it keeps installing and working. What to expect:
43
+
44
+ - **Compatibility fixes** ship as patch releases when a new Python or NumPy
45
+ version breaks something. CI tests Python 3.10–3.14.
46
+ - **Dependencies:** ricker sets no upper version limits, so NumPy fixes
47
+ reach you through your own `pip` or `uv` upgrade, without a new ricker
48
+ release. Dependabot keeps the CI and development tools current.
49
+ - **Bug reports and pull requests** are welcome. Review may be slow, and
50
+ new features are unlikely to be merged.
51
+
52
+ Up to 0.1.2 the length parameter was called `len`. It still works as a
53
+ deprecated alias for `duration`. See the [changelog](CHANGELOG.md).
54
+
55
+ ## Installation
56
+
57
+ ### From PyPI
58
+
59
+ ```bash
60
+ pip install ricker
61
+ ```
62
+
63
+ ### From source (development)
64
+
65
+ ```bash
66
+ git clone https://github.com/lijunzh/ricker.git
67
+ cd ricker
68
+ uv sync --all-extras --dev
69
+ ```
70
+
71
+ ## Quick Start
72
+
73
+ ```python
74
+ import matplotlib.pyplot as plt
75
+ from ricker import ricker
76
+
77
+ wavelet = ricker(f=25, duration=0.2, dt=0.001, peak_loc=0.1)
78
+ plt.plot(wavelet)
79
+ plt.title("25 Hz Ricker Wavelet")
80
+ plt.show()
81
+ ```
82
+
83
+ ## API
84
+
85
+ ```python
86
+ ricker(f=10, duration=0.5, dt=0.002, peak_loc=0.25)
87
+ ```
88
+
89
+ | Parameter | Type | Default | Description |
90
+ |-----------|------|---------|-------------|
91
+ | `f` | float | 10 | Centre frequency (Hz) |
92
+ | `duration` | float | 0.5 | Signal length (seconds) |
93
+ | `dt` | float | 0.002 | Sampling interval (seconds) |
94
+ | `peak_loc` | float | 0.25 | Peak location (seconds) |
95
+
96
+ ## Dependencies
97
+
98
+ - [NumPy](https://numpy.org/)
99
+
100
+ ## Development
101
+
102
+ ```bash
103
+ uv run ruff check src tests # lint
104
+ uv run ruff format src tests # format
105
+ uv run pytest # test
106
+ uv run pre-commit install # set up git hooks
107
+ ```
108
+
109
+ ## Contact
110
+
111
+ For issues, please open a
112
+ [GitHub issue](https://github.com/lijunzh/ricker/issues) or contact
113
+ *gatechzhu@gmail.com*.
@@ -0,0 +1,9 @@
1
+ ricker/__init__.py,sha256=OBsmnifTCS_YoSrSdkFccSBjBZF0yvif1DobZk8CX8I,154
2
+ ricker/_version.py,sha256=s9U3X54Pdr-Jlh9GP6LBaa_VRos7qs_wtrVefUHHNIA,520
3
+ ricker/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ ricker/ricker.py,sha256=aZWlLuwPlPsEZakcnkSetE36vrwZiXG2-ETc4iSzJ6Y,2279
5
+ ricker-0.2.0.dist-info/licenses/LICENSE,sha256=c4IqQsx128mkthGi1xD9_M5Nl_WfPpaJylZcGrSmJ2k,1066
6
+ ricker-0.2.0.dist-info/METADATA,sha256=mQ66lA7VZyRZ5FZxtsGR3mYi_c1V9I8IiUsMMBap9lc,3535
7
+ ricker-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
8
+ ricker-0.2.0.dist-info/top_level.txt,sha256=ZNSLB7Cr5QEkFCTIY3D3pIcjTad9hFmUBZ0uWxgLywQ,7
9
+ ricker-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 gatechzhu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ ricker