From bea8f9abf26341c1aa36ca3ee10ed74ca4d1319f Mon Sep 17 00:00:00 2001 From: Mark Wolfman Date: Sat, 23 Nov 2024 12:43:06 -0600 Subject: [PATCH] Added a docstring the ion chamber timeout calculation. --- src/haven/devices/ion_chamber.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/haven/devices/ion_chamber.py b/src/haven/devices/ion_chamber.py index 24f52bf8..46ba3e3b 100644 --- a/src/haven/devices/ion_chamber.py +++ b/src/haven/devices/ion_chamber.py @@ -271,8 +271,23 @@ async def connect( # Update the labjack's input's .DESC field to match the scaler channel await self.voltmeter_channel.description.set(desc) - async def default_timeout(self): - """Calculate the expected timeout for triggering this ion chamber.""" + async def default_timeout(self) -> float: + """Calculate the expected timeout for triggering this ion chamber. + + If ``self.mcs.scaler.preset_time`` is set and the first + (clock) channel is serving as a gate + (``self.mcs.scaler.channels[0].is_gate.get_value() == True``) + then the timeout is a little longer than the preset + time. Otherwise the timeout is calculated based on the longest + time the scaler can count for based on when the channel 0 + clock register would fill up. + + Returns + ======= + timeout + The optimal timeout for trigger this ion chamber's scaler. + + """ aws = [ self.mcs.scaler.channels[0].is_gate.get_value(), self.mcs.scaler.preset_time.get_value(),