Skip to main content

TIDE

Torch-based Inversion & Development Engine

TIDE is a PyTorch-based library for high-frequency electromagnetic wave propagation and inversion, built on Maxwell's equations. It provides CPU and CUDA implementations for forward modeling, gradient computation, and full-waveform inversion workflows.

License: MIT

Features

  • Maxwell Equation Solvers:
    • 2D TM mode propagation
    • 3D Maxwell propagation
  • Automatic Differentiation: Gradient support through PyTorch's autograd hooks
  • High Performance: Optimized C/CUDA kernels for critical operations
  • Flexible Storage: Device/CPU/disk snapshot modes for gradient computation
  • Staggered Grid: Standard FDTD staggered grid implementation
  • PML Boundaries: Perfectly Matched Layer absorbing boundaries
  • Snapshot Compression: Optional BF16 snapshot compression on the default path

Feature Matrix

Capability Entry Point Status Notes
2D TM forward modeling tide.maxwelltm Stable Primary onboarding path
2D TM inversion / autograd tide.maxwelltm, MaxwellTM Stable Uses PyTorch autograd
3D forward modeling tide.maxwell3d Stable Supports component selection
3D inversion / gradients tide.maxwell3d, Maxwell3D Stable with constraints Check the limitations guide before scaling up
Snapshot storage modes storage_mode=* Stable Device, CPU, disk, none, and auto
Callbacks forward_callback, backward_callback Stable Keep callback work lightweight
Debye dispersion DebyeDispersion Advanced Requires explicit time-step validation

Installation

From PyPI

Ensure you have proper PyTorch installation with CUDA binding for your system.

For CUDA environments, you may need to install a CUDA-enabled PyTorch build first:

uv pip install torch --index-url https://download.pytorch.org/whl/cu128

The cu128 tag is for CUDA 12.8. Replace it based on your CUDA version.

Then install TIDE via uv or pip:

uv pip install tide-GPR

or

pip install tide-GPR

From Source

We recommend using uv for building:

git clone https://github.com/vcholerae1/tide.git
cd tide
uv build

To rebuild only the native backend during development:

bash scripts/build_csrc.sh

Requirements:

  • Python >= 3.12
  • PyTorch >= 2.12
  • CUDA Toolkit (optional, for GPU support)
  • CMake >= 3.28 (optional, for building from source)

Quick Start

import torch
import tide

# Create a simple model
nx, ny = 200, 100
epsilon = torch.ones(ny, nx) * 4.0  # Relative permittivity
sigma = torch.zeros_like(epsilon)    # Conductivity (S/m)
mu = torch.ones_like(epsilon)        # Relative permeability
epsilon[50:, :] = 9.0  # Add a layer

# Set up source
source_amplitude = tide.ricker(
    freq=4e8,           # 400 MHz
    length=1000,
    dt=1e-11,
    peak_time=5e-10
).reshape(1, 1, -1)

source_location = torch.tensor([[[10, 100]]], dtype=torch.long)
receiver_location = torch.tensor([[[10, 150]]], dtype=torch.long)

# Run forward simulation
*_, receiver_data = tide.maxwelltm(
    epsilon=epsilon,
  sigma=sigma,
  mu=mu,
  grid_spacing=0.01,
    dt=1e-11,
  source_amplitude=source_amplitude,
  source_location=source_location,
  receiver_location=receiver_location,
    pml_width=10
)

print(f"Recorded data shape: {receiver_data.shape}")

Core Modules

  • tide.maxwelltm: 2D TM solver
  • tide.maxwell3d: 3D solver
  • tide.wavelets: Source wavelet generation
  • tide.callbacks: Callback state and factories
  • tide.storage: Snapshot storage and compression controls
  • tide.workflow: Shot batching, receiver loss, and optimizer workflow helpers
  • tide.resampling: CFL resampling helpers
  • tide.cfl: CFL condition helper
  • tide.padding: Padding and interior masking helpers
  • tide.validation: Input validation helpers

Precision and Storage

Storage and precision controls:

out = tide.maxwelltm(
    epsilon,
    sigma,
    mu,
    grid_spacing=0.02,
    dt=4e-11,
    source_amplitude=src,
    source_location=src_loc,
    receiver_location=rec_loc,
    storage_mode="auto",
    storage_compression="bf16",
)

Notes:

  • storage_mode accepts device, cpu, disk, none, and auto.
  • storage_compression accepts none or bf16 for float32 snapshot storage on Maxwell and Born native paths that save backward intermediates.

Documentation

Recommended reading path:

  1. docs/getting-started.md for installation and the first 2D forward run
  2. docs/guides/api-orientation.md for choosing between tide.maxwelltm, tide.maxwell3d, MaxwellTM, and Maxwell3D
  3. docs/guides/modeling.md and docs/guides/inversion.md for forward modeling and inversion workflows
  4. docs/guides/configuration.md for storage, callbacks, backend, and CFL-related controls
  5. docs/guides/limitations.md and docs/guides/verification.md before enabling advanced features broadly

Testing

Run the test suite:

pytest tests/

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

This project includes code derived from Deepwave by Alan Richardson. We gratefully acknowledge the foundational work that made TIDE possible.

Citation

If you use TIDE in your research, please cite:

@software{tide2025,
  author = {Vcholerae1},
  title = {TIDE: Torch-based Inversion \& Development Engine},
  year = {2025},
  url = {https://github.com/vcholerae1/tide}
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for tide-GPR 0.0.31

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tide-GPR 0.0.31
File Size Uploaded
tide_gpr-0.0.31.tar.gz 384.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for tide-GPR 0.0.31
File Interpreter ABI Platform
tide_gpr-0.0.31-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
tide_gpr-0.0.31-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
tide_gpr-0.0.31-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 5.3 MB

Release files / tide_gpr-0.0.31.tar.gz

Download URL tide_gpr-0.0.31.tar.gz
Size 384.6 kB
Tags Source
SHA-256 checksum
How to use checksums
828763a8c1d37dd20c833462b1bbc770dbdf85940d550a94978f75dce1ae280b
BLAKE2b-256 checksum
How to use checksums
8c0abfb46302ebaa378af278eb62d511eaf21ad6503003b6a299cce207aec083
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / tide_gpr-0.0.31-py3-none-win_amd64.whl

Download URL tide_gpr-0.0.31-py3-none-win_amd64.whl
Size 649.3 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
0353740b4e82849373e66ecc832611a25dad828f311f4e6f07fa12a10260487b
BLAKE2b-256 checksum
How to use checksums
874fe6d8d71b1bb80dee0090e005a884a06fad70ccb7d59b93a4d4edd1bd84b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / tide_gpr-0.0.31-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL tide_gpr-0.0.31-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 3.4 MB
Tags Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
64454e9ce74db7d1e7277844bb5b4c862f7e6c670ec2e0b794b5b58e75abb819
BLAKE2b-256 checksum
How to use checksums
f262ccf43525e37fcdd4b710d24594d4e8fb4d09d67cba33c2b0e6ab762737b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / tide_gpr-0.0.31-py3-none-macosx_11_0_arm64.whl

Download URL tide_gpr-0.0.31-py3-none-macosx_11_0_arm64.whl
Size 854.7 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
24369b8a53a51daa393e4220167468626a2ce475903b55a238adeb7ac0cea151
BLAKE2b-256 checksum
How to use checksums
23f3777c0aabaa08e57b5f54c10357cbb25ff6ab28d76f1bce50460cb016da60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.1.2

4 release files

0.1.1

4 release files

0.1.0

4 release files

0.0.34

4 release files

0.0.32

4 release files

This release

0.0.31 This release

4 release files

0.0.29

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page