exportRecord

This method is to export one or more records to EDF or CSV files.

You can export the raw EEG data, the motion data, the performance metrics and the band powers. The available data streams depend on the license of the record. You can check the field licenceScope in the Record object to know which data streams are available.

By default, you can only export the records that were created by your application. If you want to export a record that was created by another application (e.g. Emotiv PRO or EMOTIV LABS) then you must provide the license id of this application in the parameter licenseIds.

In order to export a record created by EMOTIV LABS, the current Cortex user must be the owner of the LABS experiment.

You must stop the record before you can export it. If you want to export a record immediately after you stop it then you must wait for the warning 18 before you try to export.

Please note that even after you successfully call controlDevice to disconnect the headset, it may take a few milliseconds before the status of the headset actually switches to "discovered". You can call queryHeadsets to check the status of the headset.

The format of the exported files is described in EmotivPRO user manual.

This method was added in Cortex 2.1.1 to all desktop versions of Cortex. It was added to iOS and Android in Cortex 2.7.0

Parameters

Name

Type

Required

Description

cortexToken

string

yes

A token returned by authorize.

recordIds

array of strings

yes

An array of record ids. These are the ids of the records you want to export.

folder

string

yes

The path of a local folder. Cortex will write the exported files in that folder. You must create this folder before you call this method. Cortex will return an error if the folder doesn't exist.

On iOS, this parameter doesn't exist. Cortex exports the data to the "Documents" folder of the current application.

streamTypes

array of strings

yes

List of the data streams you want to export.

format

string

yes

The format of the exported files. Must be "EDF", "EDFPLUS", "BDFPLUS" or "CSV".

version

string

no

If the format is "EDF", then you must omit this parameter.

If the format is "CSV", then this parameter must be "V1" or "V2".

licenseIds

array of strings

no

The default value is an empty list, which means that you can only export the records created by your application. You can provide the license ID of other applications in order to export the records created by these applications.

This parameter was added in Cortex 2.6.3

includeDemographics

boolean

no

If true then the exported JSON file will include the demographic data of the user. It is only for the records created by EMOTIV LABS.

The default value is false.

This parameter was added in Cortex 2.6.3

includeSurvey

boolean

no

If true then the exported JSON file will include the survey data of the record. It is only for the records created by EMOTIV LABS.

The default value is false.

This parameter was added in Cortex 2.6.3 From Cortex 3.5.0, survey data will be exported in a separate CSV file (along with JSON file).

includeMarkerExtraInfos

boolean

no

If true then the markers of the records will be exported to a CSV file. This file is compatible with EEGLAB.

The default value is false.

This parameter was added in Cortex 2.6.3

includeDeprecatedPM

boolean

no

If true then deprecated performance metrics (i.e. Focus) will be exported.

The default value is false. This parameter was added in Cortex 3.5.6

Data streams

The parameter streamTypes must contain one or more values, chosen from this list: "EEG", "MOTION", "PM", "BP". If the format is "EDF" then only "EEG" and "MOTION" are available.

Stream

Description

EEG

Export the raw EEG data, the contact quality of each EEG sensor, and the markers. The license scope of the record must contain the scope "eeg".

MOTION

Export the motion data.

PM

Export the results of the performance metric detection.

If the license scope of the record contains the scope "pm" then Cortex will export the high resolution performance metrics, at 2 hertz. Otherwise Cortex will export the low resolution data, at 0.1 hertz.

MC

Export the results of the mental command detection.

FE

Export the results of the facial expression detection.

BP

Export the band powers of each EEG sensor.

Format and version

Depending on the parameters format and version Cortex will create different files.

Format EDF, no version

This format is identical to the one used in Cortex 1.x

  • 1 EDF file for the EEG and CQ data

  • 1 EDF file for the motion data

  • 1 JSON file for the markers

  • 1 CSV file for the markers if the parameter includeMarkerExtraInfos is true

Format EDFPLUS/BDFPLUS, no version (available since Cortex version 3.7.5)

  • 1 EDF+/BDF+ file for the EEG, CQ and Motion data

  • 1 JSON file for the markers

  • 1 CSV file for the markers if the parameter includeMarkerExtraInfos is true

Format CSV, version V1

This format is identical to the one used in Cortex 1.x

  • 1 CSV file for the EEG and CQ data

  • 1 CSV file for the band powers

  • 1 CSV file for the motion data

  • 1 CSV file for the performance metrics

  • 1 JSON file for the markers

  • 1 CSV file for the markers if the parameter includeMarkerExtraInfos is true

Format CSV, version V2

This format is the new format of Cortex 2.x

  • 1 CSV file for all the data streams (EEG, CQ, band powers, motion, PM)

  • 1 JSON file for the markers

  • 1 CSV file for the markers if the parameter includeMarkerExtraInfos is true

Result

The result is an object that includes these fields:

Name

Type

Description

success

array of objects

For each record you successfully exported, this array contains an object that includes the record id.

failure

array of objects

For each record that couldn't be exported, this array contains an object that describes the error.

In case of success, you get an object with these fields:

Name

Type

Description

recordId

string

The id of the record that was successfully exported.

In case of failure, you get an object with these fields:

Name

Type

Description

recordId

string

The id of the record that couldn't be exported.

code

number

The error code.

message

string

The error message.

Examples

EDF

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "exportRecord",
    "params": {
        "cortexToken": "xxx",
        "folder": "/tmp/edf",
        "format": "EDF",
        "recordIds": [
            "ec0ac33f-ad4e-48b1-bbc3-8502f5c49b62"
        ],
        "streamTypes": [
            "EEG",
            "MOTION"
        ]
    }
}

CSV V1

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "exportRecord",
    "params": {
        "cortexToken": "xxx",
        "folder": "/tmp/csv1",
        "format": "CSV",
        "recordIds": [
            "ec0ac33f-ad4e-48b1-bbc3-8502f5c49b62"
        ],
        "streamTypes": [
            "EEG",
            "MOTION",
            "PM",
            "BP"
        ],
        "version": "V1"
    }
}

CSV V2

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "exportRecord",
    "params": {
        "cortexToken": "xxx",
        "folder": "/tmp/csv2",
        "format": "CSV",
        "recordIds": [
            "ec0ac33f-ad4e-48b1-bbc3-8502f5c49b62"
        ],
        "streamTypes": [
            "EEG",
            "MOTION",
            "PM",
            "BP"
        ],
        "version": "V2"
    }
}

Last updated