Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sk1p committed Apr 30, 2024
1 parent 678bbab commit 0402c05
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libertem_asi_tpx3/examples/live_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0402c05

Please sign in to comment.