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
- numpy (>=1.24)
- numexpr (>=2.8)
- vcti-cache (>=1.0.0) — ObjectCache for expression results
Optional
- pandas (>=2.0) — required for
create_dataframe(), install viavcti-fieldset[dataframe]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abdf4eebc58ae930e8d3351d74e4e080f825a0d18a72ee64d7af73ed5128f8aa
|
|
| MD5 |
67ab32aec429f8eafcd9bd6cc1cca92a
|
|
| BLAKE2b-256 |
ac18f7e0f86cb9d434e61f61498b597be39b98a972d55093ecdab0af10502f85
|
Provenance
The following attestation bundles were made for vcti_fieldset-1.0.0.tar.gz:
Publisher:
publish.yml on vcollab/vcti-python-fieldset
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_fieldset-1.0.0.tar.gz -
Subject digest:
abdf4eebc58ae930e8d3351d74e4e080f825a0d18a72ee64d7af73ed5128f8aa - Sigstore transparency entry: 1192827270
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-fieldset@22dd367dafc7389e8459abb98d09bbf28907a38b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22dd367dafc7389e8459abb98d09bbf28907a38b -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ce03bb1a37752f5da4c3c40d16a9f4c9a5bdfd51026e38f75df2f6df00deb9d
|
|
| MD5 |
8fe580d2666a4fa8b33dc067614c913d
|
|
| BLAKE2b-256 |
b8403b8330e54b222727ae56c557a3f04544bfa39999dbe1634a9d08e8eb5530
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_fieldset-1.0.0-py3-none-any.whl -
Subject digest:
6ce03bb1a37752f5da4c3c40d16a9f4c9a5bdfd51026e38f75df2f6df00deb9d - Sigstore transparency entry: 1192827314
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-fieldset@22dd367dafc7389e8459abb98d09bbf28907a38b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@22dd367dafc7389e8459abb98d09bbf28907a38b -
Trigger Event:
workflow_dispatch
-
Statement type: