pytweezer.servers.datalogger module

class pytweezer.servers.datalogger.DataStreamLogger(name)[source]

Bases: object

Provide information about active streams in Property tree

Each stream that sends data is appended to a dictionary called ‘active’ A timestamp for the last activity is recorded Streams that have been inactive for longer than maxStreamInactive are removed

active

access properties as Attributes. The class object using this attribute must have an attribute called _props of type Properties. The value property can be used to do basic manipulation of the property e.g. get, set, addition att = PropertyAttribute(propname, defaultval, parent=self) exmaples: getting: x = att.value. gets the property value and sets x with it addition: att.value += 1. this changes both the property and self.att indexing: element_2 = att.value[2]. this gets the second element of the property att.value.append() doesn’t work! do: lst = att.value lst.append() att.value = lst

x = att gets the property value and sets x with it att = x sets the property value BUT OVERWRITES att (i.e. if x is an int, att will also become an int), so it only works once. Therefore, using att.value is preferred.

maxage

access properties as Attributes. The class object using this attribute must have an attribute called _props of type Properties. The value property can be used to do basic manipulation of the property e.g. get, set, addition att = PropertyAttribute(propname, defaultval, parent=self) exmaples: getting: x = att.value. gets the property value and sets x with it addition: att.value += 1. this changes both the property and self.att indexing: element_2 = att.value[2]. this gets the second element of the property att.value.append() doesn’t work! do: lst = att.value lst.append() att.value = lst

x = att gets the property value and sets x with it att = x sets the property value BUT OVERWRITES att (i.e. if x is an int, att will also become an int), so it only works once. Therefore, using att.value is preferred.

removeInactiveStreams(streamlist)[source]

remove streams older than maxage from list

:streamlist : dictionary of streams to be filtered :maxage : maximum age of stream in seconds

run()[source]

detect active channels

pytweezer.servers.datalogger.run_DataLogger(name)[source]