syncopy.shared.parsers.data_parser#

syncopy.shared.parsers.data_parser(data, varname='', dataclass=None, writable=None, empty=None, dimord=None)[source]#

Parse syncopy data objects

Parameters:
  • data (syncopy data object) – Syncopy data object to verify

  • varname (str) – Local variable name used in caller, see Examples for details.

  • dataclass (None or str) – Expected class of data. If None the type of data is not inspected.

  • writeable (None or bool) – If True a SPYValueError is raised if data is read-only, vice versa if writeable is False. If None then data is not checked for read/write access.

  • empty (None or bool) – If True a SPYValueError is raised if data already has contents, if False then data is checked for non-emptiness. If None then data is not inspected for contents.

  • dimord (None or list) – If provided, then data.dimord is matched with dimord (raising a SPYValueError in case of discrepancies). If None then data.dimord is not inspected.

Returns:

Nothing

Return type:

None

Examples

Ensure adata is a AnalogData object:

>>> data_parser(adata, varname="adata", dataclass="AnalogData")

Query adata for write-access and emptiness (e.g., before writing results):

>>> data_parser(adata, varname="adata", writeable=True, empty=True)

See also

array_parser

similar functionality for parsing array-like objects