diff --git a/libertem_asi_tpx3/examples/live_server.py b/libertem_asi_tpx3/examples/live_server.py index 0894ef56..97878571 100644 --- a/libertem_asi_tpx3/examples/live_server.py +++ b/libertem_asi_tpx3/examples/live_server.py @@ -17,6 +17,8 @@ from libertem.udf.sum import SumUDF from libertem.udf.sumsigudf import SumSigUDF from libertem.udf.masks import ApplyMasksUDF +from libertem.udf.com import COMParams +from libertem_icom.udf.icom import ICOMUDF from libertem.executor.pipelined import PipelinedExecutor from libertem_live.api import LiveContext from libertem_live.udf.monitor import ( @@ -126,9 +128,12 @@ def _ring(): radius_inner=ri) mask_udf = SingleMaskUDF(mask_factories=[_ring]) + params = COMParams(cy=cy, cx=cx, r=ro, ri=ri) + icom_udf = ICOMUDF(params) return OrderedDict({ # "brightfield": SumSigUDF(), "annular": mask_udf, + "icom": icom_udf, # "sum": SumUDF(), # "monitor": SignalMonitorUDF(), "monitor_partition": PartitionMonitorUDF(), @@ -186,6 +191,9 @@ async def make_deltas(self, partial_results: UDFResults, previous_results: typin udf_name = udf_names[idx] for channel_name in partial_results.buffers[idx].keys(): data = partial_results.buffers[idx][channel_name].data + # FIXME implement n-dimnsional result buffers + if len(data.shape) != 2: + continue if previous_results is None: data_previous = np.zeros_like(data) else: @@ -335,7 +343,7 @@ async def acquisition_loop(self): print(f"acquisition done with id={acq_id}; took {t1-t0:.3f}s") async def serve(self): - async with websockets.serve(self, "localhost", 8444): + async with websockets.serve(self, "0.0.0.0", 8444): try: await self.acquisition_loop() finally: