Ideas/Assistance on how to add a custom Metric on W-Focus
Arnold
Santa Clara
Hello, I currently working on editing the default Focus widget with Processing 4 and I was hoping to add a third “Metric” setting under its dropdown that would output the PSD of Alpha frequency as a float variable. Currently, the “Metric” settings only allow “Relaxation” and “Concentration” that calculate frequency band values. I can’t seem to find the formulas used for this in OpenBCI or Brainflow documentation. (Would be helpful if someone can point me to them if they can)
Starting with This Portion:
// This is the protocol for setting up dropdowns.
dropdownWidth = 60; //Override the default dropdown width for this widget
addDropdown("focusMetricDropdown", "Metric", focusMetric.getEnumStringsAsList(), focusMetric.getIndex());
Is it possible to add my own metric if the existing dropdown is working off an existing focusMetric index? Is there any way I could edit that index?
Comments
Hi Arnold,
Have you tried looking at the Brainflow classifier source codes?
https://github.com/brainflow-dev/brainflow/tree/master/src/ml
Note the different terms, relaxation/focus in the GUI are actually restfulness/mindfulness in the Brainflow library calls.
It is not necessary to use only the GUI for your experiments. For example you could write a 'biofeedback' / neurofeedback demo program in Python or Java or Processing directly and call both the classifiers and any other digital signal processing functions you desire. Such as
get_band_power()
https://brainflow.readthedocs.io/en/stable/search.html?q=get_band_power&check_keywords=yes&area=default
(Search results are a bit wonky, all the language bindings support band power function.
William
Yes, we've looked at the source code, but it's not clear in the source code on how to add a custom calculation. We're aiming to make our own demo program but it still comes back to how to work with the brainflow metrics. May you point me to an example of a demo program that uses the brainflow metrics?
Thank you
https://brainflow.readthedocs.io/en/stable/Examples.html#python-eeg-metrics
If you have further questions on Brainflow library usage, suggest you join the Slack.
https://brainflow.org/