Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,42 @@ name: CI/CD

on:
push:
branches:
- master
tags:
- "v*.*.*"
branches: [master]
tags: ["v*.*.*"]
pull_request:
branches:
- master
branches: [master]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install the project
run: uv sync --all-extras --dev

- name: Lint with ruff
run: uv run ruff check src tests

- name: Check formatting with ruff
run: uv run ruff format --check src tests

tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand All @@ -30,7 +49,7 @@ jobs:
cache-dependency-glob: "uv.lock"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -40,11 +59,10 @@ jobs:
- name: Run tests
run: uv run pytest tests


testpypi_publish:
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-rc')
runs-on: ubuntu-latest
needs: tests
needs: [lint, tests]
permissions:
id-token: write
contents: read
Expand All @@ -53,7 +71,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full Git history for setuptools_scm to read tags
fetch-depth: 0

- name: Setup uv
uses: astral-sh/setup-uv@v5
Expand All @@ -70,7 +88,7 @@ jobs:
pypi_publish:
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-rc')
runs-on: ubuntu-latest
needs: tests
needs: [lint, tests]
permissions:
id-token: write
contents: read
Expand All @@ -79,7 +97,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full Git history for setuptools_scm to read tags
fetch-depth: 0

- name: Setup uv
uses: astral-sh/setup-uv@v5
Expand Down
89 changes: 19 additions & 70 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# PyCharm config
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -10,87 +7,39 @@ __pycache__/
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Virtual environments
.venv/
venv/
env/
ENV/

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# IDE / editor
.idea/
.vscode/
*.swp
*.swo
*~

# Unit test / coverage reports
# Testing / coverage
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.pytest_cache/
.hypothesis/
.pytest_cache/ # Added to ignore pytest cache

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
# OS files
.DS_Store
Thumbs.db

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule
# Setuptools-scm generated version
**/*/_version.py

# dotenv
# Environment variables
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# Ignore setuptools-scm generated version file
**/*/_version.py
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.10
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
87 changes: 61 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,85 @@
[![PyPI version](https://img.shields.io/pypi/v/wiggle)](https://pypi.org/project/wiggle/)
![License](https://img.shields.io/pypi/l/wiggle)
![Python versions](https://img.shields.io/pypi/pyversions/wiggle)
[![Build Status](https://github.com/gatechzhu/wiggle/actions/workflows/cicd.yml/badge.svg)](https://github.com/lijunzh/wiggle/actions/workflows/cicd.yml)
[![CI/CD](https://github.com/lijunzh/wiggle/actions/workflows/cicd.yml/badge.svg)](https://github.com/lijunzh/wiggle/actions/workflows/cicd.yml)

## Introduction
The [wiggle](http://wiki.aapg.org/Seismic_data_display) display is an ingenious methodology that displays two dimensional scalar fields on a horizontal plane.
Originally developed by the geophysical community, the wiggle plot was created to provide a visual analysis of seismic and seismological data, or any other vibration data, in order to help the identification of events that can be stressed out with the coherent alignment of lobes.
Ultimately those events can be related to geological features and/or can help the determination of the some physical properties of rocks, such as the velocity of P and S waves.
Before digital displays were standard in the industry the wiggle plot was composed either by oscillatory continuous lines and black filled lobes, both drawn by special plotters on long paper sheets.
Nowadays, when digital graphical displays are easily available, both elements, the lines and the lobes, are merged into a new one display called wiggle.

Inspired by [wiggle in Matlab](https://www.mathworks.com/matlabcentral/fileexchange/38691-wiggle) function, I created this Python tools to mimic the experience of plotting seismic section data in [Matlab](https://www.mathworks.com/products/matlab.html) with similar user interface.
Basically one can control the color and direction of the lines, the color of the left and right lobes, among others.
In order to control these features, a controlling string must be provided as input, in a similar way the function PLOT allows control of the graphical elements.
The [wiggle](http://wiki.aapg.org/Seismic_data_display) display is a
visualization methodology for two-dimensional scalar fields on a horizontal
plane. Originally developed by the geophysical community, wiggle plots
provide visual analysis of seismic, seismological, or any other vibration
data — helping identify events through the coherent alignment of lobes that
relate to geological features and physical rock properties.

Given a d M x N ndarray data matrix D, wiggle decompose it into multiple
traces.
Under vertical mode (default), each columns is a seismic trace of size M and
there are N number of traces.
When horizontal mode is activated, each row is considered a trace of size N
and there are M number of traces.
Inspired by the
[MATLAB wiggle function](https://www.mathworks.com/matlabcentral/fileexchange/38691-wiggle),
this Python package offers a similar interface for plotting seismic section
data with control over colour, amplitude, and axis orientation.


## Dependency
- [NumPy](http://www.numpy.org/)
- [Matplotlib](http://matplotlib.org/)
Given an *M × N* `ndarray`, `wiggle` decomposes it into *N* traces of
length *M* (column-major, vertical mode by default).

## Installation

### From PyPI
```

```bash
pip install wiggle
```

### From source file
Download the source from the [releases page](https://github.com/gatechzhu/wiggle/releases). Under the root directory, run:
### From source (development)

```
```bash
git clone https://github.com/lijunzh/wiggle.git
cd wiggle
uv sync --all-extras --dev
```

to install the project in development mode, or build a source distribution using:
Build a distribution:

```
```bash
uv build
```

## Quick Start

```python
import numpy as np
from wiggle import wiggle

data = np.random.default_rng(42).standard_normal((200, 20))
ax = wiggle(data, sf=0.15)
```

## Dependencies

- [NumPy](https://numpy.org/)
- [Matplotlib](https://matplotlib.org/)

## Development

Linting and formatting are handled by [Ruff](https://docs.astral.sh/ruff/):

```bash
uv run ruff check src tests
uv run ruff format src tests
```

Run tests:

```bash
uv run pytest
```

Pre-commit hooks are available:

```bash
uv run pre-commit install
```

## Contact

In counter of any trouble, contact *[email protected]*
For issues, please open a
[GitHub issue](https://github.com/lijunzh/wiggle/issues) or contact
*[email protected]*.
42 changes: 40 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,30 @@ authors = [
]
license = { file = "LICENSE" }
requires-python = ">=3.10"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",

"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Visualization",
"Typing :: Typed",
]
dependencies = [
"numpy",
"matplotlib"
"matplotlib",
]

[dependency-groups]
dev = [
"pytest>=8.3.5",
"ruff>=0.9",
"pre-commit>=4.0",
]

[[tool.uv.index]]
Expand All @@ -29,6 +45,28 @@ publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.setuptools_scm]
version_scheme = "guess-next-dev" # Use guess-next-dev so that if you tag the commit as v0.1.1, it will compute v0.1.1 (or v0.1.1.devN if commits follow)
version_scheme = "guess-next-dev"
local_scheme = "no-local-version"
write_to = "src/wiggle/_version.py"

[tool.ruff]
target-version = "py310"
line-length = 88

[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"RUF", # ruff-specific rules
]

[tool.ruff.lint.isort]
known-first-party = ["wiggle"]

[tool.pytest.ini_options]
testpaths = ["tests"]
Loading