Skip to content

Commit

Permalink
Handle case of aioca returning None for some alarm limits (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
callumforrester authored Jun 17, 2024
1 parent 54c291b commit 299b4bd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ophyd_async/epics/_backend/_aioca.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ def _data_key_from_augmented_value(

def _limits_from_augmented_value(value: AugmentedValue) -> Limits:
def get_limits(limit: str) -> LimitPair:
low = getattr(value, f"lower_{limit}_limit", None)
high = getattr(value, f"upper_{limit}_limit", None)
return LimitPair(low=low, high=high)
low = getattr(value, f"lower_{limit}_limit", nan)
high = getattr(value, f"upper_{limit}_limit", nan)
return LimitPair(
low=None if isnan(low) else low, high=None if isnan(high) else high
)

return Limits(
alarm=get_limits("alarm"),
Expand Down

0 comments on commit 299b4bd

Please sign in to comment.