Skip to content

Commit

Permalink
NumericChannel.get_last: make kernel only and add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hartytp authored and dnadlinger committed Dec 8, 2024
1 parent 7f07b9d commit 7adc2b6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ndscan/experiment/result_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Result handling building blocks.
"""

from artiq.language import HasEnvironment, portable, rpc
from artiq.language import HasEnvironment, kernel, portable, rpc
import artiq.language.units
from typing import Any
from .utils import dump_json
Expand Down Expand Up @@ -280,8 +280,13 @@ def __init__(self,
self._value_pushed: bool = False
self._last_value = self._coerce_to_type(0)

@portable
@kernel
def get_last(self):
""" Returns the last value pushed to this result channel.
This method is a workaround for limitations of ARTIQ python, which make it
impractical to extract values from the sinks without going through RPCs.
"""
if not self._value_pushed:
raise RuntimeError("No value pushed to channel")

Expand Down

0 comments on commit 7adc2b6

Please sign in to comment.