*2.3. Convert Data*

Apart from being able to work with lists, there are two packages that are relevant exponents in their respective fields:


For researchers, being able to work with those packages is critical. This is especially relevant with MNE, because it is the most viable alternative when operating with EEG data. However, the package does not provide any kind of support for Muse, nor its native file formats. As a result, we provided a native implementation in MuseStudio that brings full interoperability for both packages.

Converting data into MNE format requires some considerations. In general, the conversion includes information about the sensor coordinates, the physiological coordinates of the study participants, the powerline frequency (which depends on the region, 50 Hz or 60 Hz), the data in volts, the channels' names, the associated annotations, and the type of data. In this case, only EEG data were considered because MNE does not work with PPG, accelerometer, and gyroscope data. The result of the transformation is an array of RawArray objects with the same order as the list obtained in the previous stage. Those objects can be iterated to perform the analysis in any research study.

The outcome of the conversion to Pandas is a list with several data frames that can be used for analysis using data science techniques. A single data frame has the following columns: timestamp, AF7, AF8, TP9, TP10, X\_acc, Y\_acc, Z\_acc, X\_gyr, Y\_gyr, Z\_gyr, 1\_ppg, 2\_ppg, 3\_ppg. These correspond to all the streams provided by Muse. The differences between the sampling frequencies of the streams result in blank fields in rows.

## *2.4. BIDS Format Import and Export*

MuseStudio, in order to support the data management of brain activity with Muse products, must consider data structural mechanisms. These mechanisms are inspired by the standard Brain Imaging Data Structure (BIDS) [2]. The addition of the BIDS support allows sharing Muse recordings with other researchers, even if they do not have the set of tools required to work with the device. The library, with the support of MNE-BIDS [34], manages all the necessary information to save the configuration data that the BIDS requires according to its specification. With that aim, two structures were defined, setup and

participants, which are available in Appendix A. These are lists of dictionaries, so that every recording has a corresponding dictionary with its particular details.

The setup structure includes this information: the name of the subject; the session and run numbers; the acquisition parameters; the task performed; the processing label; the name of the recording; the coordinate space; the split of the continuous recording; the file name suffix and extension; the root path of the files. In the following examples, all the fields were simplified to None, but they should be modified accordingly.

The BIDS also requires a participants' file with the details of every member of the research study. The structure presented contains the information about the name of the subject (which must coincide with those in the setup), the age, the sex, the dominant hand, and root directory path. This file is an explicit recommendation of the BIDS specification [35], which suggests its addition in the root path of the main recordings directory.

The purpose of this configuration is to simplify how recordings are exported and imported. In addition, it allows knowing the characteristics of the experiments and the participants rapidly. When sharing one or more recordings, a researcher would only share the BIDS-formatted directory and the two updated lists described above. Using the designed method, no ambiguity is possible. Lastly, the creation of two structures, which are related thanks to the "subject" field (that is unique), avoids the repetition of information. A participant can have several recordings, but it is still the same participant. Therefore, his/her details must be added to the participants' structure only once, while the setup structure can hold several recordings.
