Main siteMain site  ForumForum  ForumSearch  Private messageEmail contact  RegisterRegister  Log inLog in 
Topic: Processing Cyton Infra Low signals using Bioera
Reply to topic
Author Message
compujohnny



Joined: Feb 2, 2018
Posts: 16

PostPosted: Jun 3, 2018 6:46 AM    Post subject: Processing Cyton Infra Low signals using Bioera

I am building an Infra Low Neurofeedback design with Bioera and Cyton, similar to Cygnet Advanced Video player, I am sending the values to a custom HTML player that displays a video with a frame that resizes with the signal, but the signal I am getting is a bit confusing,

When I create a low pass filter at 0.1 hz, I get values ranging from 3000 - 4000, for example swings between 3300 - 3450 then back to 3100 - 3500 ...etc (I am using a scalar pipe)

When I go down to 0.001 hz (1 mhz) the signal amplitude is much lower (I have to set the pipe to float to get a value) starting from 0.00001 then increasing gradually over a few minutes to the single digit number then double digits by 7 minutes into the session

When I set the filter to lower frequency 0.0001 (0.1 mhz) it takes even longer to get to single digits and double digits, and so on for lower frequencies

Currently at Cygnet they can go as low as 0.001 mhz, if I set the filter to that low I have to wait for maybe an hour to get a number that I can work with

But if I multiply the signal after filtering with a factor, it shows much faster but that factor can get very large as you go lower (for 1 mhz I multiply with 10,000, and for 0.1 mhz 10 Million ...etc to get the signal to single digits within 2 - 3 minutes)

I don't understand why when I use a float pipe I get a value starting from 0.000000001 and increasing slowly, and when I use scalar I get nothing until several minutes later

Isn't the signal originally sent from the Openbci device as an integer?!!!!

and I am not sure if multiplying with a large scaling factor is the right way to process the signal, any help or insight is greatly appreciated
jarek



Joined: Oct 22, 2007
Posts: 605

PostPosted: Jun 3, 2018 9:07 AM    Post subject:

I think you should use Float pipes for that and NOT scalars.

Yes, the input (from the device) signal is integer, but scalar values are rounded much easier than float potentially at every step (every scalar element). Scaling is good only to a certain point.

It might be even better to use Double Float pipes, although those are not as well tested. But if you need precision then this is IMO the best option (could affect performance and processor usage if the design is large).
compujohnny



Joined: Feb 2, 2018
Posts: 16

PostPosted: Jun 3, 2018 9:19 AM    Post subject:

Thank you for your reply, but what should I do if I want the actual integer sent from the device, not rounded or modified in any way the raw data?

Also can you give me more insight into why the Filter element outputs the signal (0.1 mhz max frequency low pass) as 0.00000001 and increases gradually 0.00000002 .. 0.000000003 ...etc if the original value is integer, what happens exactly? when sampling and processing the data? and again how do I get the original values passed from the device after filtering?
compujohnny



Joined: Feb 2, 2018
Posts: 16

PostPosted: Jun 3, 2018 9:21 AM    Post subject:

I am using a very simple design to test, just a serial port, openbci element, filter and Numeric display
jarek



Joined: Oct 22, 2007
Posts: 605

PostPosted: Jun 3, 2018 2:13 PM    Post subject:

To get original unmodified integer numbers you do use scalar version of the OpenBCI element. The float version of the OpenBCI element will convert it to a float number, which is technically the same data (but not identical).

The advantage of using float elements is that this conversion is only done one time (in the Float-OpenBCI element), and there is no rounding here which could cascade error.

When you use Scalar version of the Filter, it first converts data to double float, then does the filtering internally, and then converts back to integer. I suspect this second conversion is what causes the difference you observe, or the rescale ratio "Output bits" which you should set higher than the default value (OpenBCI is 24 bit integer data, so "Output bits" should be at least the same).

I recommend using Float elements. Dealing with scaling is not helping with anything. All BioEra examples are using Float elements.
compujohnny



Joined: Feb 2, 2018
Posts: 16

PostPosted: Jun 5, 2018 3:36 AM    Post subject:

I tested it it's not a scalar vs float issue, the filter takes very long to build up the signal to a usable level, could it be a time constant (time response) of the filter since the frequency is very low, the time response of the filter is (1/2πf) could reach hundreds to thousands of seconds, is this correct? or is it different in the filter implementation?
jarek



Joined: Oct 22, 2007
Posts: 605

PostPosted: Jun 5, 2018 10:29 AM    Post subject:

Long filter response for such low frequencies is expected and perfectly normal.
compujohnny



Joined: Feb 2, 2018
Posts: 16

PostPosted: Jun 5, 2018 11:59 AM    Post subject:

ok, so it's normal but can I speed it up to get a usable signal after filtering? is multiplying it by a scaling factor (using Cmixer) the right thing to do? or do you recommend a different way to get the signal to single digits faster?
jarek



Joined: Oct 22, 2007
Posts: 605

PostPosted: Jun 5, 2018 12:56 PM    Post subject:

I don't think so. It is physics, not bioera.

The lower the frequency the longer the response time.
compujohnny



Joined: Feb 2, 2018
Posts: 16

PostPosted: Jun 5, 2018 4:04 PM    Post subject:

Yes but Amplitude scaling makes sense in this case, if the signal reaches 90% of it's amplitude in say 9 hours, so it increases by 10% every hour, or 1% of the amplitude every 6 minutes, so if you scale the signal by a factor you increase the amplitude and thus increase the value it reaches in the first few minutes to a usable level for Neurofeedback

I am not trying to decrease the response time I am trying to get the signal to a usable level for feedback instead of 0.00000001 its 1
Reply to topic