Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2: Make the split between Signal and SignalBackend support tables #1120

Open
coretl opened this issue May 25, 2023 · 0 comments
Open

v2: Make the split between Signal and SignalBackend support tables #1120

coretl opened this issue May 25, 2023 · 0 comments
Assignees

Comments

@coretl
Copy link
Collaborator

coretl commented May 25, 2023

At the moment, we have this interface for Signal.read and Signal.describe:

ophyd/ophyd/v2/core.py

Lines 661 to 669 in 7612b2c

@_add_timeout
async def read(self, cached: Optional[bool] = None) -> Dict[str, Reading]:
"""Return a single item dict with the reading in it"""
return {self.name: await self._backend_or_cache(cached).get_reading()}
@_add_timeout
async def describe(self) -> Dict[str, Descriptor]:
"""Return a single item dict with the descriptor in it"""
return {self.name: await self._backend.get_descriptor()}

This only allows a backend to produce a single data key in the Descriptor and Event. We decided (with @danielballan) to explode tables to be multiple fields, as this would make them look like arrays. This means that instead of a single panda-seq1-table entry in the descriptor with dtype=object, we would want an entry for every column (like panda-seq1-table-repeats, panda-seq1-table-time1, etc.) with dtype=array.

To do this, SignalBackend.get_descriptor and Signal.get_reading will need to change from:

ophyd/ophyd/v2/core.py

Lines 377 to 383 in 7612b2c

@abstractmethod
async def get_descriptor(self) -> Descriptor:
"""Metadata like source, dtype, shape, precision, units"""
@abstractmethod
async def get_reading(self) -> Reading:
"""The current value, timestamp and severity"""

To something like:

 @abstractmethod 
 async def get_descriptor(self, name: str) -> Dict[str, Descriptor]: 
     """Metadata like source, dtype, shape, precision, units""" 
  
 @abstractmethod 
 async def get_reading(self, name: str) -> Dict[str, Reading]: 
     """The current value, timestamp and severity""" 

And all the backends (and the SignalCache) change to produce these dictionaries instead of single values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants