Skip to main content

A minimalistic package for manipulating 2D scalar and vector fields.

Project description

Demetria

Demetria is a simple package for numpy that implements lazily evaluated two-dimensional scalar and vector fields.

It is named after Demeter, the Greek goddess of agriculture, and by extension probably also of fields, ploughs, combine harvesters and other agricultural implements.

The fields are stored as functions of $x$ and $y$ and are evaluated lazily at any point -- over regular grids or irregular meshes (both are vectorized with numpy).

Scalar fields

Fields are defined

f = ScalarField(lambda x, y: x**2 - y**3)
g = ScalarField(lambda x, y, x**3 - y)
h = (f + 3 * g)**2

xs = np.linspace(-10, 10, 101)
ys = np.linspace(-10, 10, 101)
xx, yy = np.meshgrid(xs, ys)
h(xx, yy)

Vector fields

a = VectorField(lambda x, y: (x, -y))
b = VectorField(lambda x, y: (y, 0))
c = a * b + f * b

Numerical approximations to divergence and rotation can be also computed at all points.

Zernike polynomials

Implementation of scalar and vector Zernike polynomials in general form is provided too. Noll, ANSI and (n, l) indexing are supported for scalar polynomials and (n, l, r) indexing is used for vector polynomials.

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

demetria-0.1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

demetria-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file demetria-0.1.0.tar.gz.

File metadata

  • Download URL: demetria-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.5 Linux/6.12.74+deb13+1-amd64

File hashes

Hashes for demetria-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ee47bf0bc6f554bd7d4bcefabadefeb3152405e75daf4fb67657a0a094970c0
MD5 a1a1bec3b19dd96a9b580fde094743f8
BLAKE2b-256 b0f3518ab7d55747f660de309cfce3026efa970b069657238c66ed099ac121e4

See more details on using hashes here.

File details

Details for the file demetria-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: demetria-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.5 Linux/6.12.74+deb13+1-amd64

File hashes

Hashes for demetria-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84f764e00f28df37959c4a2c2f39ab4d0658ed2f01d3e0d0bb02ab7988ebe56a
MD5 af19fe24ac116cacc68eaee604ee6e84
BLAKE2b-256 11456cd8694e65a482b536e95c8497682dda107808c774a4e0498758d5457383

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