DataWriter Device Class
Similiar to RunControl, DataWriter is a special class which serves at the interface for a file writer in the system
pyrogue.utilities.fileio.StreamWriter is the default generic write contained in YAML
Custom data writers can be created
Key Methods
The following methods control the operation of the file writer, and should be overridden in a custom writer.
pyrogue.DataWriter._setBufferSize()pyrogue.DataWriter._setMaxFileSize()pyrogue.DataWriter._getFrameCount()
Included Command Objects
The following pyrogue.LocalCommand objects are all created when the DataWriter is created.
Open: Open data file. The new file name will be the contents of the DataFile variable.
Close: Close data file.
AutoName: Auto create data file name using data and time.
Included Variable Objects
The following pyrogue.LocalVariable objects are all created when the Datawriter is created.
DataFile: Data file for storing frames for connected streams. This is the file opened when the Open command is executed.
IsOpen: Status field which is True when the Data file is open.
BufferSize: File buffering size. Enables caching of data before call to file system.
MaxFileSize: Maximum size for an individual file. Setting to a non zero splits the run data into multiple files.
CurrentSize: Size of current data files in bytes.
TotalSize: Total bytes written.
FrameCount: Total frames received and written.
DataWriter Class Documentation
- class pyrogue.DataWriter(*, hidden=True, bufferSize=0, maxFileSize=0, **kwargs)[source]
Special base class to control data files. TODO: Update comments
- add(node)
- Parameters:
node
- addCustomBlock(block)
- Parameters:
block
- addInterface(*interfaces)
Add one or more rogue.interfaces.stream.Master or rogue.interfaces.memory.Master Also accepts iterables for adding multiple at once
- Parameters:
*interfaces
- addNode(nodeClass, **kwargs)
- Parameters:
nodeClass
**kwargs
- addNodes(nodeClass, number, stride, **kwargs)
- Parameters:
nodeClass
number
stride
**kwargs
- addProtocol(*protocols)
Add a protocol entity. Also accepts iterables for adding multiple at once
- Parameters:
*protocols
- addRemoteVariables(number, stride, pack=False, **kwargs)
- Parameters:
number
stride
pack (bool) – (Default value = False)
**kwargs
- addToGroup(group)
Add this node to the passed group, recursive to children
- Parameters:
group – variable denoting a node that has not been passed
- callRecursive(func, nodeTypes=None, **kwargs)
- Parameters:
func
nodeTypes – (Default value = None)
**kwargs
- checkBlocks(*, recurse=True, variable=None, **kwargs)
Check errors in all blocks and generate variable update notifications
- Parameters:
*
- recursebool
(Default value = True)
- variablestr
(Default value = None)
**kwargs :
- command(**kwargs)
A Decorator to add inline constructor functions as commands
- Parameters:
**kwargs
- commandsByGroup(incGroups=None, excGroups=None)
- Parameters:
incGroups – (Default value = None)
excGroups – (Default value = None)
- Returns:
Pass list of include and / or exclude groups
- Return type:
- property description
assigns and returns description attribute to class variable
- property deviceList
Get a recursive list of devices
- devicesByGroup(incGroups=None, excGroups=None)
- Parameters:
incGroups – (Default value = None)
excGroups – (Default value = None)
- Returns:
Pass list of include and / or exclude groups
- Return type:
- enableChanged(value)
- Parameters:
value
- filterByGroup(incGroups, excGroups)
Filter by the passed list of inclusion and exclusion groups
- Parameters:
incGroups – list of passed inclusion groups
excGroups – list of passed exclusion groups
- find(*, recurse=True, typ=None, **kwargs)
Find all child nodes that are a base class of ‘typ’ and whose properties match all of the kwargs. For string properties, accepts regexes.
- Parameters:
*
recurse – (Default value = True)
typ – (Default value = None)
**kwargs
- genDocuments(path, incGroups, excGroups)
- Parameters:
path
incGroups
excGroups
- getNodes(typ, excTyp=None, incGroups=None, excGroups=None)
Get a filtered ordered dictionary of nodes. pass a class type to receive a certain type of node class type may be a string when called over Pyro4 exc is a class type to exclude, incGroups is an optional group or list of groups that this node must be part of excGroups is an optional group or list of groups that this node must not be part of
- Parameters:
typ
excTyp – (Default value = None)
incGroups – (Default value = None)
excGroups – (Default value = None)
- Return type:
ordered dictionary of nodes
- getYaml(readFirst=False, modes=['RW', 'RO', 'WO'], incGroups=None, excGroups=['Hidden'], recurse=True)
Get current values as yaml data. modes is a list of variable modes to include. If readFirst=True a full read from hardware is performed.
- property groups
assigns and returns groups attribute to class variable
assigns and returns hidden attribute to class variable
- hideVariables(hidden, variables=None)
Hide a list of Variables (or Variable names)
- Parameters:
hidden
variables (str) – (Default value = None)
- inGroup(group)
- Parameters:
group
- isinstance(typ)
- Parameters:
typ
- linkVariableGet(**kwargs)
Decorator to add inline constructor functions as LinkVariable.linkedGet functions
- Parameters:
**kwargs
- makeRecursive(func, nodeTypes=None)
- Parameters:
func
nodeTypes – (Default value = None)
- manage(*interfaces)
- Parameters:
*interfaces
- property name
assigns and returns name attribute to class variable
- node(name)
- Parameters:
name
- property nodeList
Get a recursive list of nodes.
- nodeMatch(name)
- Parameters:
name
- Returns:
be a single value or a list accessor: value value[9] value[0:1] value[*] value[:] Variables will only match if their depth matches the passed lookup and wildcard: value[*] will match a variable named value[1] but not a variable named value[2][3] value[*][*] will match a variable named value[2][3]. The second return field will contain the array information if the base name matches an item in the non list array.
- Return type:
- property nodes
Get a ordered dictionary of all nodes.
- readAndCheckBlocks(recurse=True, variable=None, checkEach=False)
Perform a read and check.
- readBlocks(*, recurse=True, variable=None, checkEach=False, index=-1, **kwargs)
Perform background reads
- Parameters:
*
- recursebool
(Default value = True)
- variablestr
(Default value = None)
- checkEachbool
(Default value = False)
- indexint
(Default value = -1)
**kwargs :
- removeFromGroup(group)
Remove this node from the passed group, not recursive
- Parameters:
group – variable denoting a node that is in the passed group
- Return type:
if in group, remove from group
- property running
Check if Device._start() has been called
- setName((Slave)arg1, (str)arg2) None :
- C++ signature :
void setName(rogue::interfaces::memory::Slave {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
- setPollInterval(interval, variables=None)
Set the poll interval for a group of variables. The variables param is an Iterable of strings If variables=None, set interval for all variables that currently have nonzero pollInterval
- Parameters:
interval
variables (str) – (Default value = None)
- property variableList
Get a recursive list of variables and commands.
- variablesByGroup(incGroups=None, excGroups=None)
- Parameters:
incGroups – (Default value = None)
excGroups – (Default value = None)
- Returns:
Pass list of include and / or exclude groups
- Return type:
- verifyBlocks(*, recurse=True, variable=None, checkEach=False, **kwargs)
Perform background verify
- Parameters:
*
- recursebool
(Default value = True)
- variablestr
(Default value = None)
- checkEachbool
(Default value = False)
**kwargs :
- writeAndVerifyBlocks(force=False, recurse=True, variable=None, checkEach=False)
Perform a write, verify and check. Useful for committing any stale variables
- writeBlocks(*, force=False, recurse=True, variable=None, checkEach=False, index=-1, **kwargs)
Write all of the blocks held by this Device to memory