Skip to main content

Named array container with lazy expression evaluation, scoped metadata, and pluggable key mapping

Project description

Field Set

Named array container with lazy expression evaluation, scoped metadata, and pluggable key mapping.

Installation

pip install vcti-fieldset>=1.0.0

For pandas DataFrame support:

pip install vcti-fieldset[dataframe]>=1.0.0

In pyproject.toml dependencies

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

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

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)
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]

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

vcti_fieldset-1.0.0.tar.gz (26.2 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.0.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vcti_fieldset-1.0.0.tar.gz
Algorithm Hash digest
SHA256 abdf4eebc58ae930e8d3351d74e4e080f825a0d18a72ee64d7af73ed5128f8aa
MD5 67ab32aec429f8eafcd9bd6cc1cca92a
BLAKE2b-256 ac18f7e0f86cb9d434e61f61498b597be39b98a972d55093ecdab0af10502f85

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_fieldset-1.0.0.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.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for vcti_fieldset-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ce03bb1a37752f5da4c3c40d16a9f4c9a5bdfd51026e38f75df2f6df00deb9d
MD5 8fe580d2666a4fa8b33dc067614c913d
BLAKE2b-256 b8403b8330e54b222727ae56c557a3f04544bfa39999dbe1634a9d08e8eb5530

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_fieldset-1.0.0-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.

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