Memory “detector” reference
- class libertem_live.detectors.memory.MemoryAcquisition(conn: MemoryConnection, nav_shape: tuple[int, ...], frames_per_partition: int = 128, pending_aq: PendingMemAq | None = None, controller: None = None, hooks: Hooks | None = None)[source]
An acquisition based on memory
Currently it just splices the additional functionality from
AcquisitionMixin
into theMemoryDataSet
using multiple inheritance and implements a dummy for theacquire()
context manager.Examples
>>> import numpy as np >>> from libertem_live.api import Hooks ... >>> data = np.random.random((23, 42, 51, 67)) ... >>> class MyHooks(Hooks): ... def on_ready_for_data(self, env): ... print(f"Triggering! {env.aq.shape.nav}") ... >>> conn = ctx.make_connection('memory').open( ... data=data ... ) ... >>> aq = ctx.make_acquisition( ... conn=conn, ... hooks=MyHooks(), ... ) ... >>> udf = SumUDF() >>> ctx.run_udf(dataset=aq, udf=udf, plots=True) Triggering! (23, 42) {'intensity': <BufferWrapper kind=sig dtype=float64 extra_shape=()>}