Skip to content

Add PrettyPlot (pplot) waveform plotting tool - #189

Merged
bch0w merged 2 commits into
masterfrom
feature-prettyplot
Nov 5, 2026
Merged

bch0w merged 2 commits into
masterfrom
feature-prettyplot

Conversation

@bch0w

@bch0w bch0w commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Port the standalone prettyplot.py script (https://github.com/bch0w/spectral/blob/master/plotools/prettyplot.py) into PySEP as pysep.pplot. PrettyPlot makes quick, clean figures of individual waveforms: instrument response removal (with a fast interpolated-response option), detrend/taper/filter/integrate/differentiate, overlain, stacked, record section and grid layouts, spectrograms on a shared time axis, merging of gappy or multi-day files, time marks, TauP and group-velocity arrivals, and a second time series on a twin y-axis.

Package integration

  • New command line entry point pplot (pyproject.toml) via main(); the PrettyPlot.main() method is renamed PrettyPlot.run()

Tests

  • New pysep/tests/test_pplot.py (18 tests) using existing test data: gap merging, response removal (fast path checked against ObsPy), every wf_type, grid y-limits, colormaps, time marks/TauP/group velocities, added trace, SPECFEM ASCII reading and the CLI entry point

Docs

  • New docs page docs/pplot.md
  • Example figures and their make_figures.sh script in docs/pplot_files/
  • CHANGELOG entry; version bumped to 0.8.0

bch0w and others added 2 commits November 4, 2026 12:30
Port the standalone `prettyplot.py` script (bch0w/spectral, plotools) into
PySEP as `pysep.pplot`, so it is maintained in a stable, installable
package. PrettyPlot makes quick, clean figures of individual waveforms:
instrument response removal (with a fast interpolated-response option),
detrend/taper/filter/integrate/differentiate, overlain, stacked, record
section and grid layouts, spectrograms on a shared time axis, merging of
gappy or multi-day files, time marks, TauP and group-velocity arrivals,
and a second time series on a twin y-axis.

Package integration
- New command line entry point `pplot` (pyproject.toml) via `main()`;
  the `PrettyPlot.main()` method is renamed `PrettyPlot.run()`
- Export `PrettyPlot` from `pysep/__init__.py`
- Import `read_sem` from `pysep.utils.io` directly. The old
  `from pysep import read_sem` inside try/except ImportError would have
  silently set `read_sem = None` through a circular import once
  PrettyPlot is exported from the package, breaking SPECFEM reading
- Replace all print() calls with PySEP's shared `logger` (info for
  progress, warning for warnings, critical before exiting)
- Align Python keyword defaults with the CLI defaults (tp_cmap
  'rainbow_r', ylabel 'Amplitude', fig_len 8) so both give the same
  figure
- Remove unused imports and an unused marker definition, wrap lines to
  80 columns, fix the `--dpi` help text and docstrings that broke the
  Sphinx/autoapi build

Bugfix
- `merge_fill` with a number (e.g. `--merge_fill 0`) crashed on integer
  (raw count) data because ObsPy cannot write a float fill value into an
  int array; data are now cast to float before a numeric-fill merge

Tests
- New pysep/tests/test_pplot.py (18 tests) using existing test data:
  gap merging, response removal (fast path checked against ObsPy),
  every wf_type, grid y-limits, colormaps, time marks/TauP/group
  velocities, added trace, SPECFEM ASCII reading and the CLI entry point

Docs
- New docs page docs/pplot.md, ported from the PrettyPlot README:
  installation via PySEP, `pplot` commands, `pysep.pplot` imports, MyST
  image/download syntax so Sphinx copies the assets
- Example figures and their make_figures.sh script in docs/pplot_files/
- Add PrettyPlot to docs/index.rst (tool list and toctree) and the
  top-level README; enable `myst_heading_anchors` in docs/conf.py so
  in-page Markdown links resolve
- CHANGELOG entry; version bumped to 0.8.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bch0w
bch0w merged commit 5441bc7 into master Nov 5, 2026
1 check passed
@bch0w
bch0w deleted the feature-prettyplot branch November 5, 2026 01:38
@bch0w

bch0w commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Docs are built here: https://pysep.readthedocs.io/en/latest/pplot.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant