pyflightstream.post.probe_fields (stable)¶
Generated from the docstrings at build time: every one of the 3 names in the public definitions (the module declares no __all__) of pyflightstream.post.probe_fields has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Serialize sampled velocity fields without interpolation or frame inference.
Advanced¶
pyflightstream.post.probe_fields.point_field_products
¶
point_field_products(
table,
record,
out,
point_name,
*,
prepare=None,
step_source=None,
)
Write one point's sampled fields and return each file's manifest entry (FR-153).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
path - like
|
The point's probe table, as for :func: |
required |
record
|
RunRecord
|
The point's run record. |
required |
out
|
path - like
|
The products folder; the fields go to its |
required |
point_name
|
str
|
The point the files are named for. |
required |
prepare
|
As for :func: |
None
|
|
step_source
|
As for :func: |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Each file written, to its |
pyflightstream.post.probe_fields.write_probe_field
¶
write_probe_field(
stem: str | Path,
points_m: ndarray,
velocity_m_s: ndarray,
*,
source: str | Path,
provenance: OutputProvenance,
frame: str = "REFERENCE",
formats: Sequence[str] = ("vtk",),
reusable_inflow: bool = False,
sample_metadata: Mapping[str, object] | None = None,
overwrite: bool = False,
) -> list[Path]
Write reference-frame samples as VTK/Tecplot and optional custom inflow.
Both arrays are finite (N, 3), in meters and m/s. No cells, surface interpolation or moving-frame transform is inferred. Reusable inflow is an unstructured global YZ-plane profile; the user validates and installs it. Every file carries solver setup and a source-byte hash in its provenance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stem
|
str or Path
|
Output path without extension; |
required |
points_m
|
ndarray
|
Sample positions, finite, shape (N, 3), in metres. |
required |
velocity_m_s
|
ndarray
|
Absolute sample velocities, finite, shape (N, 3), in m/s. |
required |
source
|
str or Path
|
The file the samples were read from; its name and SHA-256 are recorded. |
required |
provenance
|
OutputProvenance
|
Run identity and solver setup written into every file's record. |
required |
frame
|
str
|
The frame of the samples; only |
"REFERENCE"
|
formats
|
sequence of str
|
Distinct field formats to write, from |
("vtk",)
|
reusable_inflow
|
bool
|
Also write the unstructured YZ-plane custom inflow profile. It needs one constant x, distinct positions and a two-dimensional survey. |
False
|
sample_metadata
|
mapping
|
Extra entries merged into the recorded |
None
|
overwrite
|
bool
|
Replace existing files; otherwise an existing file refuses the write. |
False
|
Returns:
| Type | Description |
|---|---|
list of pathlib.Path
|
Each file written, products and their provenance records. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If numeric conversion, frame, shapes, finiteness, formats or inflow conditions are not met; nothing is written then. |
OutputExistsError
|
If any destination exists and |
Examples:
>>> import tempfile
>>> from pathlib import Path
>>> import numpy as np
>>> from pyflightstream.post import OutputProvenance
>>> from pyflightstream.script import Script, helpers
>>> setup = helpers.solver_settings(Script(version="26.120"), velocity=30.0)
>>> provenance = OutputProvenance(run_id="probe/sim_1/a+00.0", setup=setup)
>>> folder = Path(tempfile.mkdtemp())
>>> source = folder / "samples.csv"
>>> _ = source.write_text("PROBE,X,Y,Z", encoding="utf-8")
>>> points = np.array([[0.0, 0.0, 0.0], [0.0, 1.0, 0.0]])
>>> velocity = np.array([[30.0, 0.0, 0.0], [30.0, 0.0, 0.0]])
>>> written = write_probe_field(
... folder / "field", points, velocity, source=source, provenance=provenance
... )
>>> sorted(path.name for path in written)
['field.vtk', 'field.vtk.provenance.json']
pyflightstream.post.probe_fields.write_recorded_probe_fields
¶
write_recorded_probe_fields(
table,
record,
directory,
point_name,
*,
prepare=None,
step_source=None,
)
Export complete recorded samples; preserve each actual STEP separately.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
str or Path
|
The probe table, a CSV with |
required |
record
|
RunRecord
|
The point's run record, holding the recorded solver setup, the
|
required |
directory
|
str or Path
|
The folder the field files are written to; created when needed. |
required |
point_name
|
str
|
The point the files are named for. |
required |
prepare
|
callable
|
Called with each destination path (and its provenance record path) before it is written, so the caller may clear an earlier file. |
None
|
step_source
|
str or Path
|
A table whose |
None
|
Returns:
| Type | Description |
|---|---|
list of pathlib.Path
|
Every file written; empty when the record has no probe field layout. |
Raises:
| Type | Description |
|---|---|
ProductError
|
If the run has no recorded solver setup, the table or its STEP, sample identity, unit conversion or frame is invalid, a native proof or frame trajectory is missing, or two outputs would share a name. |