Skip to content

Commit 34dea88

Browse files
Add docs (#13)
* Update docstrings and add docs
1 parent 7f47b77 commit 34dea88

20 files changed

+530
-129
lines changed

.github/workflows/doc.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: documentation
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v3
14+
- name: Install dependencies
15+
run: |
16+
pip install sphinx sphinx_rtd_theme myst_parser
17+
pip install .
18+
- name: Sphinx build
19+
run: |
20+
sphinx-build docs _build
21+
- name: Deploy to GitHub Pages
22+
uses: peaceiris/actions-gh-pages@v3
23+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
24+
with:
25+
publish_branch: gh-pages
26+
github_token: ${{ secrets.GITHUB_TOKEN }}
27+
publish_dir: _build/
28+
force_orphan: true

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/api/segfast.loader.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
======
2+
Loader
3+
======
4+
5+
.. automethod:: segfast.loader.open

docs/api/segfast.memmap_loader.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
============
2+
MemmapLoader
3+
============
4+
5+
.. autoclass:: segfast.memmap_loader.MemmapLoader
6+
:members:
7+
:undoc-members:
8+
:member-order: bysource

docs/api/segfast.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
===
2+
API
3+
===
4+
5+
.. toctree::
6+
:maxdepth: 5
7+
8+
segfast.loader
9+
segfast.memmap_loader
10+
segfast.segyio_loader
11+
segfast.trace_header_spec
12+
segfast.utils

docs/api/segfast.segyio_loader.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
============
2+
SegyioLoader
3+
============
4+
5+
.. autoclass:: segfast.segyio_loader.SegyioLoader
6+
:members:
7+
:undoc-members:
8+
:member-order: bysource
9+
10+
.. autoclass:: segfast.segyio_loader.SafeSegyioLoader
11+
:members:
12+
:undoc-members:
13+
:member-order: bysource
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
===============
2+
TraceHeaderSpec
3+
===============
4+
5+
.. autoclass:: segfast.trace_header_spec.TraceHeaderSpec
6+
:members:
7+
:undoc-members:
8+
:member-order: bysource

docs/api/segfast.utils.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
=====
2+
Utils
3+
=====
4+
5+
.. autoclass:: segfast.utils.ForPoolExecutor

docs/conf.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
import sys, os
10+
sys.path.insert(0, os.path.abspath('..'))
11+
import segfast
12+
13+
master_doc = 'index'
14+
15+
project = 'segfast'
16+
author = 'Analysis Center'
17+
copyright = '2024, ' + author
18+
19+
release = segfast.__version__
20+
version = '.'.join(release.split('.'))
21+
22+
# -- General configuration ---------------------------------------------------
23+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
24+
25+
extensions = [
26+
'sphinx.ext.autodoc',
27+
'sphinx.ext.doctest',
28+
'sphinx.ext.coverage',
29+
'sphinx.ext.mathjax',
30+
'sphinx.ext.viewcode',
31+
'sphinx.ext.githubpages',
32+
'sphinx.ext.intersphinx',
33+
'sphinx.ext.napoleon',
34+
'sphinx_rtd_theme',
35+
]
36+
37+
templates_path = ['_templates']
38+
exclude_patterns = []
39+
language = 'en'
40+
41+
42+
# -- Options for HTML output -------------------------------------------------
43+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
44+
45+
html_title = "SegFast"
46+
html_theme = "sphinx_rtd_theme"
47+
html_static_path = ['_static']
48+
html_theme_options = {
49+
'logo_only': False
50+
}
51+
52+
# Example configuration for intersphinx: refer to the Python standard library.
53+
intersphinx_mapping = {
54+
'python': ('https://docs.python.org/', None),
55+
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
56+
'segyio': ('https://segyio.readthedocs.io/en/latest/', None)
57+
}

docs/index.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. segfast documentation master file, created by
2+
sphinx-quickstart on Thu Feb 1 14:09:14 2024.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
segfast documentation
7+
=====================
8+
9+
**segfast** is a library for interacting with SEG-Y seismic data. Main features are:
10+
11+
* Faster access to read data: both traces headers and values
12+
* Optional bufferization, where the user can provide a preallocated memory to load the data into
13+
* Convenient API that relies on :class:`numpy.memmap` for most operations, while providing
14+
`segyio <https://segyio.readthedocs.io/en/latest/>`_ as a fallback engine
15+
16+
17+
Implementation details
18+
----------------------
19+
We rely on **segyio** to infer file-wide parameters.
20+
21+
For headers and traces, we use custom methods of reading binary data.
22+
23+
Main differences to **segyio** C++ implementation:
24+
- we read all of the requested headers in one file-wide sweep, speeding up by an order of magnitude
25+
compared to the **segyio** sequential read of every requested header.
26+
Also, we do that in multiple processes across chunks.
27+
28+
- a memory map over trace data is used for loading values. Avoiding redundant copies and leveraging
29+
:mod:`numpy` superiority allows to speed up reading, especially in case of trace slicing along the samples axis.
30+
This is extra relevant in the case of loading horizontal (depth) slices.
31+
32+
33+
.. toctree::
34+
:maxdepth: 1
35+
:titlesonly:
36+
37+
installation
38+
start
39+
segy
40+
api/segfast

0 commit comments

Comments
 (0)