OpenEEG-driver: Raw values to microvolts?

Obtaining data from various hardware devices
Post Reply
Sergio Vivar
Posts: 10
Joined: Tue Oct 18, 2016 7:26 pm

OpenEEG-driver: Raw values to microvolts?

Post by Sergio Vivar »

Hi.

I'm understanding the driver for OpenEEG in OV:

"ovasCDriverOpenEEGModularEEG.cpp"

in the block:

Code: Select all

boolean CDriverOpenEEGModularEEG::loop(void){
	if(!m_rDriverContext.isConnected()) { return false; }

	if(this->readPacketFromTTY(m_i32FileDescriptor)<0)
	{
		m_rDriverContext.getLogManager() << LogLevel_ImportantWarning << "Could not receive data from " << m_sTTYName << "\n";
		return false;
	}

	if(m_vChannelBuffer.size()!=0)
	{
		if(m_rDriverContext.isStarted())
		{
			for(uint32 i=0; i<m_vChannelBuffer.size(); i++)
			{
				for(uint32 j=0; j<m_ui32ChannelCount; j++)
				{
					m_pSample[j]=(float32)m_vChannelBuffer[i][j]-512.f;
				}
				m_pCallback->setSamples(m_pSample, 1);
			}
			m_rDriverContext.correctDriftSampleCount(m_rDriverContext.getSuggestedDriftCorrectionSampleCount());
		}
		m_vChannelBuffer.clear();
	}

	return true;
}


in the line:

m_pSample[j]=(float32)m_vChannelBuffer[j]-512.f;

I understand that to subtract 512 from the value retrieved is to transfer the values from (0 - 1023) to (+/- 512), but the resulting values are raw values; the question is: where are these raw values converted to microvolts, or so they send the designer?.

Sergio Vivar

jtlindgren
Posts: 775
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: OpenEEG-driver: Raw values to microvolts

Post by jtlindgren »

Hello Sergio,

the driver should convert the values to be compatible with a specification it should do with a call m_oHeader.setChannelUnits(); usually most drivers declare microvolts and then provide the samples in such a scale. Since the OpenEEG driver does not seem to be doing that declaration, and looking at the code, I assume its pushing out whatever values result from that -512 computation. Comparing OpenEEG spec (if available, I haven't looked) and the code should reveal what the units are. If not microvolts, getting them there is probably just a matter of simple manipulation of the numbers, but you need to know the scale of the data coming from the amp first.


Cheers,
Jussi

Sergio Vivar
Posts: 10
Joined: Tue Oct 18, 2016 7:26 pm

Re: OpenEEG-driver: Raw values to microvolts?

Post by Sergio Vivar »

I was searching that conversion; thanks Jussi

Post Reply