Flatten to Points Schema
Flatten Time Schema¤
neojax.data.schemas.flatten_to_points_schema.FlattenToPointsSchema
¤
Schema that prepares inputs for pointwise models by flattening fields and coordinates.
Returns a tuple (u, y) where u has shape (*leading, m_sensors), combining the
time, channel and spatial dimensions into a single flat axis, and y has shape
(*leading, N, d) with N the number of spatial points. The batch axis before time_axis
in fields is preserved. The batch axis of coords is inferred from its own rank
as it may be shared across a batch.
Internal Attributes
- time_axis (
int): Axis index of time dimensions. - channel_axis (
int): Axis index of channel dimensions.
Use in ComposedSchema
FlattenToPointsSchema can only be used as final schema in a ComposedSchema.
It doesn't fulfill the contract w.r.t. the return signature of the BaseSchema.transform method
in its current implementation. This may be improved/changed in future versions.
transform(bundle: typing.Union[ForwardRef(DataBundle), Inexact[Array, ...], Inexact[ndarray, ...]], /, reference_bundle: neojax.data.bundles.data_bundle.DataBundle | None = None) -> tuple[typing.Union[Inexact[Array, ...], Inexact[ndarray, ...]], typing.Union[Real[Array, ...], Real[ndarray, ...]]]
¤
Flattens fields into 1D and coords into point lists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bundle
|
Union[ForwardRef(DataBundle), Inexact[Array, ...], Inexact[ndarray, ...]]
|
The input |
required |
reference_bundle
|
DataBundle | None
|
The original bundle, used for coordinates if bundle is an array. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Union[Inexact[Array, ...], Inexact[ndarray, ...]], Union[Real[Array, ...], Real[ndarray, ...]]]
|
Tuple of (flattened_fields, point_coordinates). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
ValueError
|
If |