Skip to main content

Differentiable framework for spectral methods

Project description

drawing

xpektra : Modular framework for spectral methods

xpektra is a Python library that provides a modularframework for spectral methods. xpektra provide fundamental mathematical building blocks which can be used to construct complex spectral methods. It is built on top of JAX and Equinox, making it easy to use spectral methods in a differentiable way.

Documentation Tests Nightly Benchmarks

License

xpektra is distributed under the GNU Lesser General Public License v3.0 or later. See COPYING and COPYING.LESSER for the complete terms. © 2025 ETH Zurich (Mohit Pundir).

Features

  • Modular building blocks for spectral methods which can be easily combined to create complex solid mechanics problems.
  • Extensible design allowing users to define their own operators and spaces such as Fourier-Galerkin, Moulinec and Suquet, Displacement-based, etc.
  • Differentiable operations using JAX
  • Implicit differentiation support which allows for computationally efficient Homogenization and Multiscale simulations.

Installation

Install the current release from PyPI:

pip install xpektra

For development work, clone the repository and install it in editable mode (use your preferred virtual environment tool such as uv or venv):

git clone https://github.com/smec-ethz/xpektra.git
cd xpektra
pip install -e .

Usage

xpektra provides modular blocks by defining a few operators and spaces that can be used to construct complex spectral methods. These operators and spaces are:

  • SpectralSpace: Defines the spectral space on which the methods are defined, this includes the FFT, IFFT, and other spectral transforms.
  • TensorOperator: Defines the tensor operator which performs tensor operations on quantities living on the grid, the operator automatically figures out the order of the tensor.
  • Scheme: Defines the scheme for discretization which is then used to construct the gradient operator. Currently, CartesianScheme is the only scheme available but one can easily define new schemes by subclassing the Scheme class.
  • make_field: Defines the field on which the methods are defined, this includes the field operations and the field creation.
  • ProjectionOperator: Defines the projection operator which projects the stress field onto the spectral space. Currently, GalerkinProjection is the only projection operator available but one can easily define new projection operators by subclassing the ProjectionOperator class.

Benchmarking

Check the Live Benchmark Dashboard to see the performance of xpektra at Live Benchmark Dashboard.

👉 Where to contribute

If you have a suggestion that would make this better, please fork the repo and create a pull request on github.com/smec-ethz/xpektra. Please use that repository to open issues or submit merge requests. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xpektra-0.4.1.tar.gz (14.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xpektra-0.4.1-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file xpektra-0.4.1.tar.gz.

File metadata

  • Download URL: xpektra-0.4.1.tar.gz
  • Upload date:
  • Size: 14.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","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}

File hashes

Hashes for xpektra-0.4.1.tar.gz
Algorithm Hash digest
SHA256 9addd3e4576ee0f9f6939942e8506f6d772977635d8ccd7aafaf1fdf8fc7f4fd
MD5 7c216d16722bb8c7bb37994251d2d06d
BLAKE2b-256 12c188bf3df8b418b6a2e754b12ecd3237e81e5828c6e0e280b513e6339d2c15

See more details on using hashes here.

File details

Details for the file xpektra-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: xpektra-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","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}

File hashes

Hashes for xpektra-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06e20ddefade621e648039b1c197a8de25239700e1236262d0ace2d0ded71b4e
MD5 106fc53e506b7f7a0f9dc3251f3342c2
BLAKE2b-256 04f1b325fa95aa3fd8416b13358bdb3d14710bf7c593072d0c92b2573c5a6d61

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page