consumer#

Implement consumer classes that provide Acoular data to Bokeh data sources.

TimeConsumer

Provide Acoular time data to a Bokeh ColumnDataSource.

TimeBandsConsumer

Provide frequency-band data to a Bokeh ColumnDataSource.

class spectacoular.consumer.TimeConsumer#

Bases: TimeOut

Provide Acoular time data to a Bokeh ColumnDataSource.

This TimeOut-derived class builds an interface from Acoular’s generator pipelines to Bokeh’s ColumnDataSource model for plots and tables.

consume() runs in an extra non-GUI thread 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 the GUI event loop. update() sends the data, downsampled by a factor down, to ds, which holds an overall length of rollover samples. The elapsed time in seconds is stored in elapsed.

ds#

Bokeh’s ColumnDataSource, updated from result loop

channels#

channels to have in the output

num#

input block size

down#

downsampling factor for output

rollover#

total length of columns in ds

thread#

thread in which consume() runs

elapsed#

elapsed time in data

updated#

flag for update / consume

data#

transport between consume / update

init_ds()#

Initialize the ColumnDataSource with channel columns.

ch_names()#

Yield channel names for iterating over channels.

consume(doc)#

Consume samples from the source in a non-GUI thread.

Parameters:
doc

Server document used to register callbacks.

update()#

Update the data source from the GUI event loop.

result(num)#

Yield the output block-wise.

This method does nothing in this class.

source#

Data source; Generator or derived object.

sample_freq#

Sampling frequency of output signal, as given by source.

num_channels#

Number of channels in output, as given by source.

num_samples#

Number of samples in output, as given by source.

digest#

A unique identifier for the generator, based on its properties. (read-only)

class spectacoular.consumer.TimeBandsConsumer#

Bases: TimeConsumer

Provide frequency-band data to a Bokeh ColumnDataSource.

This TimeConsumer-derived class specializes in plots over frequency bands, such as octave spectra.

It works like TimeConsumer, but ignores down and rollover. Instead, only the first sample of each block is taken from the input. ds has a column for each input channel with one frequency-band value in each row. bands gives the bands, and lfunc can be used to convert them to human-readable label strings.

lfunc#

Function to convert bands into list of labels

bands#

List of labels for bands

numbands#

Number of bands

update()#

Update the data source from the GUI event loop.

ch_names()#

Yield channel names for iterating over channels.

consume(doc)#

Consume samples from the source in a non-GUI thread.

Parameters:
doc

Server document used to register callbacks.

init_ds()#

Initialize the ColumnDataSource with channel columns.

result(num)#

Yield the output block-wise.

This method does nothing in this class.

ds#

Bokeh’s ColumnDataSource, updated from result loop

channels#

channels to have in the output

num#

input block size

down#

downsampling factor for output

rollover#

total length of columns in ds

thread#

thread in which consume() runs

elapsed#

elapsed time in data

updated#

flag for update / consume

data#

transport between consume / update

source#

Data source; Generator or derived object.

sample_freq#

Sampling frequency of output signal, as given by source.

num_channels#

Number of channels in output, as given by source.

num_samples#

Number of samples in output, as given by source.

digest#

A unique identifier for the generator, based on its properties. (read-only)