Page 1 of 1

OpenEEG-driver: Raw values to microvolts?

Posted: Wed Sep 06, 2017 4:10 am
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

Re: OpenEEG-driver: Raw values to microvolts

Posted: Wed Sep 06, 2017 7:45 am
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

Re: OpenEEG-driver: Raw values to microvolts?

Posted: Mon Sep 11, 2017 9:11 pm
by Sergio Vivar
I was searching that conversion; thanks Jussi