Skip to main content

Field Set

A lightweight container for named columnar fields with lazy NumExpr expressions, scoped metadata, and pluggable field sources.

Overview

FieldSet holds named, row-aligned columnar fields and computed expressions over them. Each field is obtained through a field source — an eager in-memory numpy array by default, or a lazy provider such as a computed array, a memory-mapped file, or a vcti-datanode DataNode — so large or deferred data is loaded only when it is actually read. Expressions like "strain = stress / youngs_modulus" are parsed and evaluated lazily via NumExpr and cached, avoiding intermediate arrays. Scoped metadata keeps system settings (components) and user attributes (units, labels) in separate namespaces, and an optional [dataframe] extra exports to pandas with MultiIndex columns. The required core stays small (numpy, numexpr, vcti-cache); heavier integrations are optional extras.

Installation

pip install vcti-fieldset>=1.3.2

For pandas DataFrame support:

pip install vcti-fieldset[dataframe]>=1.3.2

For binding vcti-datanode DataNodes as fields:

pip install vcti-fieldset[datanode]>=1.3.2

In pyproject.toml dependencies

dependencies = [
    "vcti-fieldset>=1.3.2",
]

# or, with DataFrame support:
dependencies = [
    "vcti-fieldset[dataframe]>=1.3.2",
]

Quick Start

import numpy as np
from vcti.fieldset import FieldSet

# Create from named arrays
fs = FieldSet(
    stress=np.array([100.0, 200.0, 150.0]),
    displacement=np.array([0.1, 0.2, 0.15]),
)

# Add computed expressions (lazy — evaluated on access)
fs.add_expression("strain = stress / 200000")
fs.get_values("strain")  # array([0.0005, 0.001, 0.00075])

# Metadata — user attributes and system settings
fs.set_property("units", "MPa", field="stress")
fs.set_property("units", "mm", field="displacement")

# Components for multi-dimensional fields
fs = FieldSet(velocity=np.array([[1, 2, 3], [4, 5, 6]]))
fs.set_components("velocity", ["x", "y", "z"])

# Generate pandas DataFrame with MultiIndex columns
df = fs.create_dataframe()

Core API

FieldSet

Method Description
add_data(*args, **kwargs) Add structured or named arrays (atomic)
add_field(name, source) Add a field from a FieldSource (e.g. a lazy provider)
get_values(name) / fs[name] Get field array or evaluate expression
add_expression(expr) Register lazy expression (e.g., "c = a + b")
materialize(name) Convert expression to permanent field
remove_field(name) Remove a stored field
remove_expression(name) Remove a registered expression
list_fields() List all fields and expressions
load_from_npz(path) Load arrays from .npz file
set_property(name, value, field) Set user attribute or system setting
get_property(name, field, default) Get metadata value
set_components(field, components) Set component names for a field
get_components(field) Get component names
create_dataframe(fields) Generate pandas DataFrame (requires [dataframe])
shape (rows, total_fields) tuple
name in fs Check if field or expression exists
for name in fs Iterate over field and expression names
copy.copy(fs) / copy.deepcopy(fs) Shallow / deep copy

Metadata

Pluggable key-value storage with hierarchical key resolution:

Class Key format Use case
DefaultKeyMapper a.b.c (separator-joined) Simple paths
ScopedKeyMapper system.col.setting / user.col.attr System + user scopes
ConfigKeyMapper col.setting System-only config

Dependencies

Optional

  • pandas (>=2.0) — required for create_dataframe(), install via vcti-fieldset[dataframe]

Download files

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

Source Distribution

vcti_fieldset-1.3.2.tar.gz (37.3 kB view details)

Uploaded Source

Built Distribution

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

vcti_fieldset-1.3.2-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file vcti_fieldset-1.3.2.tar.gz.

File metadata

  • Download URL: vcti_fieldset-1.3.2.tar.gz
  • Upload date:
  • Size: 37.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vcti_fieldset-1.3.2.tar.gz
Algorithm Hash digest
SHA256 62211437557c379d77c1e69ea73dd6d2cd364188bc5143e4dc0e9010a46aa3db
MD5 177b41ba273e7aada67d352416242256
BLAKE2b-256 5d94a3ba0a7861ffb96d2b93a23fabbe2f7c94404fd9958cf194d8cf07d2bc25

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_fieldset-1.3.2.tar.gz:

Publisher: publish.yml on vcollab/vcti-python-fieldset

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vcti_fieldset-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: vcti_fieldset-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vcti_fieldset-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ef0fc35a77e2405471f775e7ef78952828017a99c315bd5a5e82a9c402344f1a
MD5 00734b9cdb0768994034a7143ceefb01
BLAKE2b-256 ca140685bef3d0dafa5980fccbd2f90aec896a83ba95652611f43996f908091d

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_fieldset-1.3.2-py3-none-any.whl:

Publisher: publish.yml on vcollab/vcti-python-fieldset

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

3.0.0

2 files

2.0.0

2 files

1.4.0

2 files

This release

1.3.2 This release

2 files

1.0.0

2 files

Supported by

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