SpectrumChannel (Java)

From Neurotech Software Development Kit
Jump to: navigation, search

ru.neuromd.neurosdk.channels

Class SpectrumChannel

Related Classes

ru.neuromd.neurosdk.BaseChannel

ru.neuromd.neurosdk.SignalChannel

Classes hierarchy

  • java.lang.Object
    • ru.neuromd.neurosdk.channels.BaseChannel
      • ru.neuromd.neurosdk.channels.SpectrumChannel

Class definition

public class SpectrumChannel

SpectrumChannel class provides tools to get signal spectrum information through basic schannel interface

Fields Summary

Modifier and Type Field and Description
SubscribersNotifier<Long> dataLengthChanged

Subscribe this event to receive notifications about changes of total length of data

Constructor Summary

Constructor Description
SpectrumChannel(BaseChannel<Double> channel) Creates new instance of SpectrumChannel for specified data channel

Methods Summary

Modifier and Type Method and Description
ChannelInfo info()

Returns channel information

Double[] readData()

Requests spectrum data for underlying channel data with specified offset and length, which must be set in terms of totalLength parameter of passed to constructor data channel.

If there is no enough data to read from signal buffer, nonexistent samples will be filled with zeros.

CAUTION Length of the result array will not be equal to requested data length. Result array has library-defined spectrum length. To get information about frequency step of spectrum samples call #hzPerSpectrumSample method

double[] readFast()

Requests spectrum data for underlying channel data with specified offset and length, which must be set in terms of totalLength parameter of passed to constructor data channel. Does not use functionality of base class to obtain data from buffer and use optimized methods to read data to increase performance

If there is no enough data to read from signal buffer, nonexistent samples will be filled with zeros.

CAUTION Length of the result array will not be equal to requested data length. Result array has library-defined spectrum length. To get information about frequency step of spectrum samples call #hzPerSpectrumSample method

long totalLength()

Returns total length of data been added to underlying channel buffer. To get more info see .BaseChannel

long bufferSize()

Returns size in samples of internal channel buffer. If there is no internal buffer or it does not have maximum size this method returns zero

float samplingFrequency()

Returns sampling frequency of underlying data channel.

void setSamplingFrequency(float frequency)

This channel does not support setting of sampling frequency. Throws an exception,

Device underlyingDevice()

Returns device this channel belongs to

Field Detail

dataLengthChanged

public final SubscribersNotifier<Long> dataLengthChanged

Subscribe this event to receive notifications about changes of total length of data

Method Detail

Example

This example shows how to find devices and list their features

import com.neuromd.common.INotificationCallback;
import com.neuromd.neurosdk.Device;
import com.neuromd.neurosdk.DeviceScanner;
import com.neuromd.neurosdk.channels.ChannelInfo;
import com.neuromd.neurosdk.parameters.Command;
import com.neuromd.neurosdk.parameters.Parameter;
import com.neuromd.neurosdk.parameters.ParameterName;
import com.neuromd.neurosdk.parameters.types.DeviceState;

Possible output:


See also

NeuroMD SDK Manual

BaseChannel (Java)