# Converting Mind Monitor CSV Data from Muse-S Headband to EDF via MNE-Python

**URL:** https://mne.discourse.group/t/converting-mind-monitor-csv-data-from-muse-s-headband-to-edf-via-mne-python/9346
**Category:** Support & Discussions
**Created:** [September 22, 2024, 9:38am UTC](https://mne.discourse.group/t/converting-mind-monitor-csv-data-from-muse-s-headband-to-edf-via-mne-python/9346 "2024-09-22T09:38:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mynameisjustalex](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mynameisjustalex/32/3897_2.png) [@mynameisjustalex](https://mne.discourse.group/u/mynameisjustalex)
#### Post date: [September 22, 2024, 9:38am UTC](https://mne.discourse.group/t/converting-mind-monitor-csv-data-from-muse-s-headband-to-edf-via-mne-python/9346/1 "2024-09-22T09:38:22Z")

</div>

Hi MNE-Python community,

I’m an intern working on a research project focusing on sleep. My team are using the [Muse-S headband](https://choosemuse.com/pages/muse-s) to collect EEG data for sleep analysis which is a consumer-grade EEG device with frontal electrodes that can record brainwave activity. The data is exported in CSV format via a 3rd party app called [Mind Monitor](https://mind-monitor.com/Technical_Manual.php#help_streaming), which includes data from EEG channels of muse-s headband (AF7, AF8, TP9, TP10), timestamps, and accelerometer data.

Our goal is to use [YASA](https://raphaelvallat.com/yasa/build/html/generated/yasa.SleepStaging.html), a Python package designed for sleep staging and event detection (e.g., spindles, slow waves) from EEG data. However, YASA requires the data to be in European Data Format (EDF), and we currently have the data in CSV format. We understand that MNE-Python can be used for preprocessing and conversion tasks, but we are new to the technical aspects of how to properly integrate these tools and manage the required dependencies.

Context:

We are aiming to focus on single-channel EEG data from the AF7 or AF8 electrode for sleep staging with YASA.  
The CSV data includes EEG signals, timestamps, and other auxiliary signals like accelerometer data.  
We plan to use MNE-Python for preprocessing before converting the data to EDF.

Specific Questions:

1. What is the correct process to convert the CSV data from Mind Monitor to EDF format using MNE-Python
2. Are there any preprocessing steps (e.g., filtering, downsampling) that should be performed before converting the data to EDF format?

Since me and my team are new to this, we would appreciate any suggestions or links of information for using MNE-Python in this workflow for beginners would be greatly appreciated. Thanks in advance for your help!

---

<div class="post-metadata">

### Author: ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)
#### Post date: [September 23, 2024, 6:38am UTC](https://mne.discourse.group/t/converting-mind-monitor-csv-data-from-muse-s-headband-to-edf-via-mne-python/9346/2 "2024-09-23T06:38:32Z")

</div>

To convert CSV data into EDF, you have to

1. Import the CSV data (use whatever method works best for you) and create a `RawArray` (see [Creating MNE-Python data structures from scratch — MNE 1.8.0 documentation](https://mne.tools/stable/auto_tutorials/simulation/10_array_objs.html#creating-raw-objects)).
2. Install [edfio](https://edfio.readthedocs.io/en/latest/) and export your `RawArray` with the [`.export()`](https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.export) method.

Regarding preprocessing, EDF does not require any specific preprocessing steps, so you can export your original data.

---

<div class="post-metadata">

### Author: ![mynameisjustalex](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mynameisjustalex/32/3897_2.png) [@mynameisjustalex](https://mne.discourse.group/u/mynameisjustalex)
#### Post date: [October 3, 2024, 7:28am UTC](https://mne.discourse.group/t/converting-mind-monitor-csv-data-from-muse-s-headband-to-edf-via-mne-python/9346/3 "2024-10-03T07:28:42Z")

</div>

Hi Clemens,

Thank you for your response on converting CSV data to EDF using **RawArray** and **edfio**! This clarified some of the steps we need to take for the conversion process.

To give you some context, we are using **[SleepEEGpy](https://github.com/NirLab-TAU/sleepeegpy)**, an open-source Python package for sleep EEG analysis that integrates **MNE-Python** and other tools.

**Our workflow involves:**

1. Collecting data from the **Muse-S headband** (exported via **Mind Monitor** in CSV format),
2. Preprocessing and converting the data to **EDF** using **MNE-Python** ,
3. Performing sleep staging and event detection with **SleepEEGpy** and **YASA**.

We’re working with single-channel EEG data from the **AF7** or **AF8** electrodes and are still relatively new to these tools.

**Follow-up Questions:**

1.For reference, we’ve checked **SleepEEGpy’s [dependencies](https://github.com/NirLab-TAU/sleepeegpy/blob/main/pyproject.toml)**, but want to ensure if we can use more up to date versions of **MNE-Python** without it affecting the procedures provided by SleepEEGpy’s documentation

2. **Handling Consumer-Grade EEG Data** : Given that we’re using **consumer-grade EEG data** from the **Muse-S** (which may have more noise or lower resolution compared to research-grade devices), do you have any recommendations on how to best handle or **preprocess** this type of data within **MNE-Python**? Are there specific **limitations** or adjustments we should be aware of when using **SleepEEGpy** for analysis?

We’d appreciate any advice on managing these dependencies and ensuring compatibility within our Python environment for sleep EEG analysis.

---

<div class="post-metadata">

### Author: ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)
#### Post date: [October 3, 2024, 8:39am UTC](https://mne.discourse.group/t/converting-mind-monitor-csv-data-from-muse-s-headband-to-edf-via-mne-python/9346/4 "2024-10-03T08:39:28Z")

</div>

Regarding your first question, you should ask the developers of SleepEEGpy why they’ve pinned MNE to `~=1.6.0`. At least I am not aware of any breaking changes that MNE might have introduced in versions newer than that.

I’m not sure if I can provide great advice regarding your second question (I’ve never used a Muse headband), but in my opinion, it’s mostly the use of dry electrodes on consumer-grade systems that negatively affect the recorded signals. In addition, these electrodes are usually placed around the perimeter of the 10-20 system locations, which means they are likely to pick up a lot of muscle activity. It totally depends on your research question, but if you have the option to pick a different location closer to the vertex, and maybe also use a gel-based electrode, I’d try that. If not, then you can still get nice EEG if you make sure your electrode has a good contact/connection. Probably even more important, instructing your participants to minimize any movements and muscle tension (e.g. they should be relaxed etc.) has a great influence on the quality of the recorded signals.
