Use case
I recently built BrainFlow from source with BLE support and tested python_package/examples/tests/muse_ppg.py using a physical Muse 2 on macOS.
The example worked successfully and produced PPG data, oxygen saturation, and heart-rate estimates. While using it, I noticed a few usability issues that make it harder to use as a diagnostic/example script:
- The recording duration is hard-coded to 200 seconds.
- There are no standard BrainFlow CLI arguments for selecting a device (--mac-address, --serial-number, --timeout, --other-info).
- The script prints the entire raw data matrix before the final results.
- The oxygen saturation and heart-rate values are printed without labels.
- The session cleanup is not protected with try/finally, so an interruption may skip cleanup.
I think improving these areas would make the example easier for new users to work with while preserving its current functionality.
Describe the solution you’d like
I’d like to submit a small PR that:
- Preserves the existing default behavior (including the 200-second recording duration).
- Adds optional CLI arguments following the pattern used by other Python examples.
- Uses try/finally to ensure stop_stream() and release_session() are always called.
- Labels the oxygen saturation and heart-rate outputs.
- Optionally avoids printing the full raw data matrix by default while still allowing users to inspect it if desired.
I would not change:
- BrainFlow APIs
- Muse preset handling (p50)
- BLE/device behavior
- The oxygen saturation or heart-rate algorithms
Describe alternatives you’ve considered
The current example is functional as-is, so another option is to leave it unchanged.
I also considered submitting the changes directly as a pull request, but I wanted to check first that this type of example cleanup would be welcome before spending time implementing it.
Use case
I recently built BrainFlow from source with BLE support and tested python_package/examples/tests/muse_ppg.py using a physical Muse 2 on macOS.
The example worked successfully and produced PPG data, oxygen saturation, and heart-rate estimates. While using it, I noticed a few usability issues that make it harder to use as a diagnostic/example script:
I think improving these areas would make the example easier for new users to work with while preserving its current functionality.
Describe the solution you’d like
I’d like to submit a small PR that:
I would not change:
Describe alternatives you’ve considered
The current example is functional as-is, so another option is to leave it unchanged.
I also considered submitting the changes directly as a pull request, but I wanted to check first that this type of example cleanup would be welcome before spending time implementing it.