Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ classifiers = [
description = "Eiger control system integration with FastCS"
dependencies = [
"aiohttp",
"fastcs[epicsca]",
"fastcs-odin @ git+https://github.com/DiamondLightSource/fastcs-odin.git@0.8.0a1",
"fastcs-odin~=0.9.0",
"numpy",
"pillow",
"typer",
Expand Down
14 changes: 11 additions & 3 deletions run_acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ def main(
file_name: str = "test",
frames: int = 10,
exposure_time: float = 1,
stream2: bool = True,
):
asyncio.run(run_acquisition(prefix, file_path, file_name, frames, exposure_time))
asyncio.run(
run_acquisition(prefix, file_path, file_name, frames, exposure_time, stream2)
)


async def run_acquisition(
Expand All @@ -23,21 +26,26 @@ async def run_acquisition(
file_name: str,
frames: int,
exposure_time: float,
stream2: bool,
):
eiger_prefix = prefix
odin_prefix = f"{prefix}:OD"

await tidy(eiger_prefix, odin_prefix)

await caput_str(f"{odin_prefix}:AcquisitionId", "")
print("Configuring")
await asyncio.gather(
caput_str(f"{eiger_prefix}:Stream:Format", "cbor" if stream2 else "legacy"),
caput_str(f"{eiger_prefix}:Stream:HeaderDetail", "all"),
caput(f"{odin_prefix}:BlockSize", 1),
caput_str(f"{odin_prefix}:FilePath", file_path),
caput_str(f"{odin_prefix}:AcquisitionId", file_name),
caput_str(f"{odin_prefix}:FilePrefix", file_name),
caput(f"{odin_prefix}:FP:Frames", frames),
caput(f"{eiger_prefix}:Detector:Nimages", frames),
caput(f"{eiger_prefix}:Detector:Ntrigger", 1),
caput(f"{eiger_prefix}:Detector:FrameTime", exposure_time),
caput(f"{eiger_prefix}:Detector:CountTime", exposure_time),
# caput(f"{eiger_prefix}:Detector:TriggerMode", "ints"), # for real detector
caput_str(f"{eiger_prefix}:Detector:TriggerMode", "ints"), # for tickit sim
)
Expand Down Expand Up @@ -92,7 +100,7 @@ async def pv_equals(pv: str, value: Any, timeout: float = 10):
await asyncio.sleep(1)
timeout -= 1

print(f"Timed out waiting for {pv} to equal {value}")
raise RuntimeError(f"Timed out waiting for {pv} to equal {value}")


if __name__ == "__main__":
Expand Down
5 changes: 2 additions & 3 deletions src/fastcs_eiger/controllers/eiger_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from fastcs.connections import IPConnectionSettings
from fastcs.controllers import Controller
from fastcs.datatypes import Bool, Int
from fastcs.logging import bind_logger
from fastcs.logging import logger
from fastcs.methods import command, scan

from fastcs_eiger.controllers.eiger_detector_controller import EigerDetectorController
Expand Down Expand Up @@ -42,7 +42,6 @@ def __init__(
) -> None:
super().__init__()
self.connection_settings = connection_settings
self.logger = bind_logger(__class__.__name__)

self.connection = HTTPConnection(connection_settings)
self._parameter_update_lock = asyncio.Lock()
Expand Down Expand Up @@ -120,7 +119,7 @@ async def update(self):
await asyncio.gather(*coros)

if self.queue.empty():
self.logger.info("All parameters updated")
logger.info("All parameters updated")
await self.stale_parameters.update(not self.queue.empty())

async def queue_subsystem_update(self, coros: list[Coroutine]):
Expand Down
6 changes: 2 additions & 4 deletions src/fastcs_eiger/controllers/eiger_subsystem_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from fastcs.attributes import Attribute, AttrR, AttrRW
from fastcs.controllers import Controller
from fastcs.logging import bind_logger
from fastcs.logging import logger
from fastcs.util import ONCE

from fastcs_eiger.eiger_parameter import (
Expand Down Expand Up @@ -57,8 +57,6 @@ def __init__(
queue_subsystem_update: Callable[[list[Coroutine]], Coroutine],
api_version: EigerAPIVersion,
):
self.logger = bind_logger(__class__.__name__)

self.connection = connection
self._queue_subsystem_update = queue_subsystem_update
self._io = EigerAttributeIO(connection, self.update_now, self.queue_update)
Expand Down Expand Up @@ -160,7 +158,7 @@ async def update_now(self, parameters: Iterable[str]):
if parameters:
coros = self._get_update_coros_for_parameters(parameters)
await asyncio.gather(*coros)
self.logger.info("Parameters updated during put", parameters=parameters)
logger.info("Parameters updated during put", parameters=parameters)

def _get_update_coros_for_parameters(
self, parameters: Iterable[str]
Expand Down
5 changes: 2 additions & 3 deletions src/fastcs_eiger/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from fastcs.attributes import AttributeIO, AttrR, AttrW
from fastcs.datatypes import DType_T
from fastcs.logging import bind_logger
from fastcs.logging import logger

from fastcs_eiger.eiger_parameter import EigerParameterRef
from fastcs_eiger.http_connection import HTTPConnection
Expand All @@ -25,7 +25,6 @@ def __init__(
self.connection = connection
self.update_now = update_now
self.queue_update = queue_update
self.logger = bind_logger(__class__.__name__)

def _handle_params_to_update(
self, parameters: list[str], uri: str
Expand Down Expand Up @@ -53,7 +52,7 @@ async def send(
parameters_to_update, attr.io_ref.uri
)

self.logger.info(
logger.info(
"Parameter put",
attribute=attr,
value=value,
Expand Down
Loading