Adapters API¶
Each adapter module's public API (its __all__) is one function, open(), which returns a
Reader. Other names visible in the modules with dir(), Reader included, are not part
of the public API and may change; Reader is documented here because every open()
returns one. See Adapters for how they behave. In the
signatures, PathArg is str | os.PathLike[str]: a string or a pathlib.Path; Size is
tuple[int, int], a (width, height) pair.
frames2py.adapters.evt.open ¶
open(path: PathArg, *, sensor_size: tuple[int, int] | None = None, batch_size: int | None = None) -> Reader
Open an EVT 2.0 or 3.0 RAW file for one pass over its CD events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
PathArg
|
The |
required |
sensor_size
|
tuple[int, int] | None
|
|
None
|
batch_size
|
int | None
|
Events per yielded array (the last may have fewer), or |
None
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
path doesn't exist. |
OSError
|
path is a directory or can't be read. |
ValueError
|
the header is malformed, its version is not EVT 2.0 or 3.0, it has no
geometry and no |
frames2py.adapters.aedat4.open ¶
open(path: PathArg, *, sensor_size: tuple[int, int] | None = None, batch_size: int | None = None) -> Reader
Open an AEDAT 4.0 file for one pass over its first event stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
PathArg
|
The |
required |
sensor_size
|
tuple[int, int] | None
|
|
None
|
batch_size
|
int | None
|
Events per yielded array (the last may have fewer), or |
None
|
Raises:
| Type | Description |
|---|---|
ImportError
|
dv-processing is not installed ( |
FileNotFoundError
|
path doesn't exist. |
OSError
|
path is a directory or can't be read. |
ValueError
|
dv-processing can't read the file, it has no event stream, the stream
has no resolution and no |
frames2py.adapters.hdf5.open ¶
open(path: PathArg, *, group: str, t_offset: int | str | None = None, sensor_size: tuple[int, int] | None = None, batch_size: int | None = None) -> Reader
Open an HDF5 file for one pass over the events in group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
PathArg
|
The HDF5 file. |
required |
group
|
str
|
Path of the group holding the |
required |
t_offset
|
int | str | None
|
Microseconds added to every |
None
|
sensor_size
|
tuple[int, int] | None
|
|
None
|
batch_size
|
int | None
|
Events per yielded array (the last may have fewer), or |
None
|
Raises:
| Type | Description |
|---|---|
ImportError
|
h5py or hdf5plugin is not installed ( |
FileNotFoundError
|
path doesn't exist. |
OSError
|
path is a directory or can't be read. |
TypeError
|
group is not a str, or t_offset not an int, str or |
ValueError
|
the file isn't HDF5, the group or its datasets don't follow the
schema, the group declares a |
Reader ¶
Iterate once over a recording's events.
Iteration yields 1-D, C-contiguous EVENT_DTYPE arrays in source order. With
batch_size=None each array follows the decoder's own boundaries; with
batch_size=N every array has N events except the last. No array is empty.
Each array is new or a view of a new array; no two share memory, and none shares memory with the file or the backend.
A second iter() raises RuntimeError. Iterating a closed reader, or calling
next() on its iterator after close(), raises ValueError.