Skip to content

Make Adapter sliceable #274

@LarsKue

Description

@LarsKue

Currently, the Adapter is implemented as a series of transforms.

It would be nice if indexing or slicing the Adapter would yield another valid Adapter, in the form of:

adapter = bf.Adapter().rename("x", "y").rename("y", "z").rename("z", "y").rename("y", "x")
rename_x_to_y = adapter[0]
rename_x_to_z = adapter[0:2]

assert isinstance(rename_x_to_y, bf.Adapter)

We could also allow assigning an adapter to a slice then, in the form of:

adapter = ...
adapter[0:2] = bf.Adapter().rename("x", "z")

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions