FileReader

class pyrogue.utilities.fileio.FileReader(files, configChan=None, log=None, batched=False)[source]

A lightweight file reader for Rogue.

Parameters:
  • files (str | list[str]) – Filename or list of filenames to read data from.

  • configChan (int | None, default: None) – Channel id of configuration/status stream in the data file. Set to None to disable configuration processing.

  • log (Logger | None, default: None) – Logger to use. If None, a new logger with name "pyrogue.FileReader" is created.

  • batched (bool, default: False) – Flag indicating if the data file contains batched data.

Variables:
  • currCount (int) – Number of data records processed from current file

  • totCount (int) – Total number of data records processed from

  • configDict (dict[str, Any]) – Current configuration/status dictionary.

records()[source]

Yield data records from all configured files.

Returns:

For batched=False, yields (RogueHeader, numpy.ndarray[int8]). For batched=True, yields (RogueHeader, BatchHeader, numpy.ndarray[int8]).

Return type:

Iterator[tuple[RogueHeader, ndarray[tuple[Any, ...], dtype[int8]]] | tuple[RogueHeader, BatchHeader, ndarray[tuple[Any, ...], dtype[int8]]]]

property currCount: int

Return number of records read from the current file.

property totCount: int

Return total number of records read across all files.

property configDict: dict[str, Any]

Return merged configuration/status dictionary.

configValue(path)[source]

Get a configuration or status value

Parameters:

path (str) – Path of the config/status value to return

Returns:

Requested configuration or status value

Return type:

Any