open#

lsst.images.serialization.open(path: ResourcePathExpression, cls: type[T], *, partial: bool = True, **backend_kwargs: Any) AbstractContextManager[Reader[T]]#
lsst.images.serialization.open(path: ResourcePathExpression, cls: None = None, *, partial: bool = True, **backend_kwargs: Any) AbstractContextManager[Reader[Any]]

Open an lsst.images file for incremental, component-wise reads.

Dispatches to the appropriate backend by file extension, resolves the registered in-memory type from the file’s schema, and returns a Reader context manager.

Parameters#

path

File to read; convertible to lsst.resources.ResourcePath.

cls

Optional expected in-memory type. When given, open validates that the file’s schema resolves to a subclass of cls (raising TypeError otherwise) and the returned Reader is typed accordingly, so Reader.read needs no cast.

partial

Forwarded to the backend open_tree; defaults to True (a reader is for incremental access). A no-op for the JSON and NDF backends.

**backend_kwargs

Backend-specific open options (e.g. page_size for FITS).

Raises#

ValueError

If the file extension is not recognized.

ArchiveReadError

If the file’s schema is not registered.

TypeError

If cls is given and the file’s schema resolves to an incompatible type.