SpectAcoular documentation

TimeConsumer

«  consumer   ::   consumer   ::   TimeBandsConsumer  »

TimeConsumer

class spectacoular.consumer.TimeConsumer

Bases: TimeOut

TimeOut derived class for building an interface from Acoular’s generator pipelines to Bokeh’s ColumnDataSource model that serves as a source for plots and tables.

How it works: consume() runs in an extra non-GUI thread (must be set up by the user) and fetches blocks of data with length num from source. These blocks are stored in data and update() is then registered as a callback for GUI event loop. update() then sends the data, downsampled by a factor down to ColumnDataSource ds(), which holds an overall length of rollover samples. The elapsed time in seconds is stored in elapsed

ds = Trait(ColumnDataSource)

Bokeh’s ColumnDataSource, updated from result loop

channels = List(Int)

channels to have in the output

num = Int(128)

input block size

down = Int(8)

downsampling factor for output

rollover = Int(8192)

total length of columns in ds

thread = Trait(threading.Thread)

thread in which consume() runs

elapsed = Float(0)

elapsed time in data

updated = Trait(threading.Event)

flag for update / consume

data = Array

transport between consume / update

ch_names()

generator that returns channel names, helper for iterating over channels

consume(doc)

consumes samples from source, to be run in an extra non-GUI thread

Args:

doc: server document to register callbacks to

update()

callback function for GUI event loop, updates data source

result(num)

Python generator that yields the output block-wise. Does nothing in this class.

«  consumer   ::   consumer   ::   TimeBandsConsumer  »