diff options
author | matkovic <matkovic.tilen@gmail.com> | 2017-06-10 23:48:35 +0200 |
---|---|---|
committer | matkovic <matkovic.tilen@gmail.com> | 2017-06-10 23:48:35 +0200 |
commit | 49200600c1d7a295080ae8f928d40e32ca99a30b (patch) | |
tree | aca80285320e3a0d5d915b31475af436aae044d4 |
First commit
-rw-r--r-- | openvibe-scenarios/free-will-bci-1-acquisition.xml | 1204 | ||||
-rw-r--r-- | openvibe-scenarios/free-will-bci-2-classifier-trainer.xml | 692 | ||||
-rw-r--r-- | scripts/python-learning.py | 157 |
3 files changed, 2053 insertions, 0 deletions
diff --git a/openvibe-scenarios/free-will-bci-1-acquisition.xml b/openvibe-scenarios/free-will-bci-1-acquisition.xml new file mode 100644 index 0000000..523ade9 --- /dev/null +++ b/openvibe-scenarios/free-will-bci-1-acquisition.xml @@ -0,0 +1,1204 @@ +<OpenViBE-Scenario> + <Creator>OpenViBE</Creator> + <CreatorVersion>1.3.0</CreatorVersion> + <Boxes> + <Box> + <Identifier>(0x000011b9, 0x00002dbe)</Identifier> + <Name>Stimulation multiplexer</Name> + <AlgorithmClassIdentifier>(0x07db4efa, 0x472b0938)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Input stimulations 1</Name> + </Input> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Input stimulations 2</Name> + </Input> + </Inputs> + <Outputs> + <Output> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Multiplexed stimulations</Name> + </Output> + </Outputs> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-48.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>34</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>640.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0xd5da9c1d, 0x1cc7dbf9)</Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>117</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x005f6b9c)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xc80ce8af, 0xf699f813)</Identifier> + <Value>1</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>2</Value> + </Attribute> + <Attribute> + <Identifier>(0xfba64161, 0x65304e21)</Identifier> + <Value></Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00001ab6, 0x00007dc8)</Identifier> + <Name>Stimulation listener</Name> + <AlgorithmClassIdentifier>(0x65731e1d, 0x47de5276)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Stimulation stream 1</Name> + </Input> + </Inputs> + <Settings> + <Setting> + <TypeIdentifier>(0xa88b3667, 0x0871638c)</TypeIdentifier> + <Name>Log level to use</Name> + <DefaultValue>Debug</DefaultValue> + <Value>Information</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>16.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>34</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>656.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0xf451ad91, 0x14c75f86)</Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>121</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x00274198)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>1</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>1</Value> + </Attribute> + <Attribute> + <Identifier>(0xfba64161, 0x65304e21)</Identifier> + <Value></Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00002750, 0x00001fb2)</Identifier> + <Name>Signal display</Name> + <AlgorithmClassIdentifier>(0x0055be5f, 0x087bdd12)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> + <Name>Data</Name> + </Input> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Stimulations</Name> + </Input> + <Input> + <TypeIdentifier>(0x6ab26b81, 0x0f8c02f3)</TypeIdentifier> + <Name>Channel Units</Name> + </Input> + </Inputs> + <Settings> + <Setting> + <TypeIdentifier>(0x5de046a6, 0x086340aa)</TypeIdentifier> + <Name>Display Mode</Name> + <DefaultValue>Scan</DefaultValue> + <Value>Scan</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x33a30739, 0x00d5299b)</TypeIdentifier> + <Name>Auto vertical scale</Name> + <DefaultValue>Per channel</DefaultValue> + <Value>Per channel</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Scale refresh interval (secs)</Name> + <DefaultValue>5</DefaultValue> + <Value>5</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Vertical Scale</Name> + <DefaultValue>100</DefaultValue> + <Value>100</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Vertical Offset</Name> + <DefaultValue>0</DefaultValue> + <Value>0</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Time Scale</Name> + <DefaultValue>10</DefaultValue> + <Value>10</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> + <Name>Bottom ruler</Name> + <DefaultValue>true</DefaultValue> + <Value>true</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> + <Name>Left ruler</Name> + <DefaultValue>false</DefaultValue> + <Value>false</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> + <Name>Multiview</Name> + <DefaultValue>false</DefaultValue> + <Value>false</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-16.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>34</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>304.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x92c056a7, 0x2dc71aff)</Value> + </Attribute> + <Attribute> + <Identifier>(0x527ad68d, 0x16d746a0)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>87</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x0020f6e8)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>9</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>3</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x000032a2, 0x00004de0)</Identifier> + <Name>Keyboard stimulator</Name> + <AlgorithmClassIdentifier>(0x00d317b9, 0x6324c3ff)</AlgorithmClassIdentifier> + <Outputs> + <Output> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Outgoing Stimulations</Name> + </Output> + </Outputs> + <Settings> + <Setting> + <TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> + <Name>Filename</Name> + <DefaultValue>${Path_Data}/plugins/stimulation/simple-keyboard-to-stimulations.txt</DefaultValue> + <Value>${Path_Data}/plugins/stimulation/simple-keyboard-to-stimulations.txt</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-176.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>23</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>528.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x8d89d3b7, 0x8339d210)</Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>126</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x00450264)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xc80ce8af, 0xf699f813)</Identifier> + <Value>1</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>1</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00003f97, 0x0000658d)</Identifier> + <Name>Player Controller</Name> + <AlgorithmClassIdentifier>(0x5f426dce, 0x08456e13)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Stimulations</Name> + </Input> + </Inputs> + <Settings> + <Setting> + <TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> + <Name>Stimulation name</Name> + <DefaultValue>OVTK_StimulationId_Label_00</DefaultValue> + <Value>OVTK_StimulationId_Label_02</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0xcc14d8d6, 0xf27ecb73)</TypeIdentifier> + <Name>Action to perform</Name> + <DefaultValue>Pause</DefaultValue> + <Value>Stop</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-96.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>23</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>448.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x568d148e, 0x650792b3)</Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>105</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x0041bb9e)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>2</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>1</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x0000430f, 0x00004aa4)</Identifier> + <Name>Acquisition client</Name> + <AlgorithmClassIdentifier>(0x35d225cb, 0x3e6e3a5f)</AlgorithmClassIdentifier> + <Outputs> + <Output> + <TypeIdentifier>(0x403488e7, 0x565d70b6)</TypeIdentifier> + <Name>Experiment information</Name> + </Output> + <Output> + <TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> + <Name>Signal stream</Name> + </Output> + <Output> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Stimulations</Name> + </Output> + <Output> + <TypeIdentifier>(0x013df452, 0xa3a8879a)</TypeIdentifier> + <Name>Channel localisation</Name> + </Output> + <Output> + <TypeIdentifier>(0x6ab26b81, 0x0f8c02f3)</TypeIdentifier> + <Name>Channel units</Name> + </Output> + </Outputs> + <Settings> + <Setting> + <TypeIdentifier>(0x79a9edeb, 0x245d83fc)</TypeIdentifier> + <Name>Acquisition server hostname</Name> + <DefaultValue>${AcquisitionServer_HostName}</DefaultValue> + <Value>${AcquisitionServer_HostName}</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>Acquisition server port</Name> + <DefaultValue>1024</DefaultValue> + <Value>1024</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-192.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>23</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>256.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x0d4656c0, 0xc95b1fa8)</Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>106</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x0061952f)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xc80ce8af, 0xf699f813)</Identifier> + <Value>5</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>2</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00006664, 0x00000edf)</Identifier> + <Name>CSV File Writer</Name> + <AlgorithmClassIdentifier>(0x2c9312f1, 0x2d6613e5)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> + <Name>Input stream</Name> + </Input> + </Inputs> + <Settings> + <Setting> + <TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> + <Name>Filename</Name> + <DefaultValue>record-[$core{date}-$core{time}].csv</DefaultValue> + <Value>E:/Tilen/FAX/2. stopnja/UI/projekt-bci/free-will/signals/record-sig-[$core{date}-$core{time}].csv</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x79a9edeb, 0x245d83fc)</TypeIdentifier> + <Name>Column separator</Name> + <DefaultValue>;</DefaultValue> + <Value>;</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>Precision</Name> + <DefaultValue>10</DefaultValue> + <Value>10</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-16.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>34</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>198.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x229d1207, 0xebac8ab0)</Value> + </Attribute> + <Attribute> + <Identifier>(0x527ad68d, 0x16d746a0)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>92</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x016872c7)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>3</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>1</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00006664, 0x00000ee0)</Identifier> + <Name>CSV File Writer</Name> + <AlgorithmClassIdentifier>(0x2c9312f1, 0x2d6613e5)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Input stream</Name> + </Input> + </Inputs> + <Settings> + <Setting> + <TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> + <Name>Filename</Name> + <DefaultValue>record-[$core{date}-$core{time}].csv</DefaultValue> + <Value>E:/Tilen/FAX/2. stopnja/UI/projekt-bci/free-will/signals/record-stim-[$core{date}-$core{time}].csv</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x79a9edeb, 0x245d83fc)</TypeIdentifier> + <Name>Column separator</Name> + <DefaultValue>;</DefaultValue> + <Value>;</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>Precision</Name> + <DefaultValue>10</DefaultValue> + <Value>10</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>32.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>34</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>512.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x229d1207, 0xebac8ab0)</Value> + </Attribute> + <Attribute> + <Identifier>(0x527ad68d, 0x16d746a0)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>92</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x0020f6e8)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>3</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>1</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00007957, 0x000045fc)</Identifier> + <Name>Stimulation Filter</Name> + <AlgorithmClassIdentifier>(0x02f96101, 0x5e647cb8)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Stimulations</Name> + </Input> + </Inputs> + <Outputs> + <Output> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Modified Stimulations</Name> + </Output> + </Outputs> + <Settings> + <Setting> + <TypeIdentifier>(0x09e59e57, 0x8d4a553a)</TypeIdentifier> + <Name>Default action</Name> + <DefaultValue>Reject</DefaultValue> + <Value>Reject</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Time range begin</Name> + <DefaultValue>0</DefaultValue> + <Value>0</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Time range end</Name> + <DefaultValue>0</DefaultValue> + <Value>0</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x09e59e57, 0x8d4a553a)</TypeIdentifier> + <Name>Action to perform</Name> + <DefaultValue>Select</DefaultValue> + <Value>Select</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> + <Name>Stimulation range begin</Name> + <DefaultValue>OVTK_StimulationId_Label_00</DefaultValue> + <Value>OVTK_StimulationId_Label_01</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> + <Name>Stimulation range end</Name> + <DefaultValue>OVTK_StimulationId_Label_0F</DefaultValue> + <Value>OVTK_StimulationId_Label_01</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-96.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>34</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>576.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x47859b3f, 0x1dfdf5cd)</Value> + </Attribute> + <Attribute> + <Identifier>(0x61d11811, 0x71e65362)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>107</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x003d89e1)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xc80ce8af, 0xf699f813)</Identifier> + <Value>1</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>6</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>1</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00007957, 0x000045fd)</Identifier> + <Name>Stimulation Filter</Name> + <AlgorithmClassIdentifier>(0x02f96101, 0x5e647cb8)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Stimulations</Name> + </Input> + </Inputs> + <Outputs> + <Output> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Modified Stimulations</Name> + </Output> + </Outputs> + <Settings> + <Setting> + <TypeIdentifier>(0x09e59e57, 0x8d4a553a)</TypeIdentifier> + <Name>Default action</Name> + <DefaultValue>Reject</DefaultValue> + <Value>Reject</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Time range begin</Name> + <DefaultValue>0</DefaultValue> + <Value>0</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Time range end</Name> + <DefaultValue>0</DefaultValue> + <Value>0</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x09e59e57, 0x8d4a553a)</TypeIdentifier> + <Name>Action to perform</Name> + <DefaultValue>Select</DefaultValue> + <Value>Select</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> + <Name>Stimulation range begin</Name> + <DefaultValue>OVTK_StimulationId_Label_00</DefaultValue> + <Value>OVTK_StimulationId_Label_0A</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> + <Name>Stimulation range end</Name> + <DefaultValue>OVTK_StimulationId_Label_0F</DefaultValue> + <Value>OVTK_StimulationId_Label_0A</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-96.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>34</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>688.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x47859b3f, 0x1dfdf5cd)</Value> + </Attribute> + <Attribute> + <Identifier>(0x61d11811, 0x71e65362)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>107</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x0026aa9c)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xc80ce8af, 0xf699f813)</Identifier> + <Value>1</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>6</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>1</Value> + </Attribute> + </Attributes> + </Box> + </Boxes> + <Links> + <Link> + <Identifier>(0x00000de2, 0x00004c62)</Identifier> + <Source> + <BoxIdentifier>(0x000011b9, 0x00002dbe)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x00001ab6, 0x00007dc8)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-25</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>640</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-6</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>656</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x00000f72, 0x000029c3)</Identifier> + <Source> + <BoxIdentifier>(0x000032a2, 0x00004de0)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x00007957, 0x000045fc)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-158</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>528</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-118</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>576</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x00001ce5, 0x00005f56)</Identifier> + <Source> + <BoxIdentifier>(0x000011b9, 0x00002dbe)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x00006664, 0x00000ee0)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-25</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>640</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>10</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>512</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x000025f1, 0x000036df)</Identifier> + <Source> + <BoxIdentifier>(0x0000430f, 0x00004aa4)</BoxIdentifier> + <BoxOutputIndex>1</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x00006664, 0x00000edf)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-174</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>241</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-38</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>198</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x00003a78, 0x00004f9a)</Identifier> + <Source> + <BoxIdentifier>(0x000032a2, 0x00004de0)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x00007957, 0x000045fd)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-158</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>528</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-118</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>688</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x000047d8, 0x00004fe7)</Identifier> + <Source> + <BoxIdentifier>(0x00007957, 0x000045fc)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x000011b9, 0x00002dbe)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-73</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>576</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-70</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>632</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x0000547f, 0x00003283)</Identifier> + <Source> + <BoxIdentifier>(0x000032a2, 0x00004de0)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x00003f97, 0x0000658d)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-158</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>528</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-112</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>448</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x00005e4e, 0x0000148d)</Identifier> + <Source> + <BoxIdentifier>(0x00007957, 0x000045fd)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x000011b9, 0x00002dbe)</BoxIdentifier> + <BoxInputIndex>1</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-73</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>688</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-70</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>647</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x00006f5f, 0x0000311f)</Identifier> + <Source> + <BoxIdentifier>(0x0000430f, 0x00004aa4)</BoxIdentifier> + <BoxOutputIndex>1</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x00002750, 0x00001fb2)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-174</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>241</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-38</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>289</Value> + </Attribute> + </Attributes> + </Link> + </Links> + <MessageLinks></MessageLinks> + <Comments> + <Comment> + <Identifier>(0x000078f4, 0x0000293f)</Identifier> + <Text><u><b><big>Overview</big></b></u> + +This scenario is used for collecting data from acquisition client + and saving it to a csv file. + +Keyboard stimulations are also logged (and saved to csv file): + <i>a</i> or <i>p</i> mark stimulation time, + <i>z</i> finishes this scenario.</Text> + <Attributes> + <Attribute> + <Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> + <Value>928.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> + <Value>-112.000000</Value> + </Attribute> + </Attributes> + </Comment> + </Comments> + <VisualisationTree> + <VisualisationWidget> + <Identifier>(0x00001bb7, 0x000007cd)</Identifier> + <Name>Default window</Name> + <Type>1</Type> + <ParentIdentifier>(0xffffffff, 0xffffffff)</ParentIdentifier> + <BoxIdentifier>(0xffffffff, 0xffffffff)</BoxIdentifier> + <NumChildren>1</NumChildren> + <Attributes> + <Attribute> + <Identifier>(0x4c90d4ad, 0x7a2554ec)</Identifier> + <Value>320</Value> + </Attribute> + <Attribute> + <Identifier>(0x7b814cca, 0x271df6dd)</Identifier> + <Value>475</Value> + </Attribute> + </Attributes> + </VisualisationWidget> + <VisualisationWidget> + <Identifier>(0x00001f0e, 0x00000ff8)</Identifier> + <Name>Default tab</Name> + <Type>2</Type> + <ParentIdentifier>(0x00001bb7, 0x000007cd)</ParentIdentifier> + <Index>0</Index> + <BoxIdentifier>(0xffffffff, 0xffffffff)</BoxIdentifier> + <NumChildren>1</NumChildren> + </VisualisationWidget> + <VisualisationWidget> + <Identifier>(0x00000e21, 0x000020fb)</Identifier> + <Name>Vertical split</Name> + <Type>4</Type> + <ParentIdentifier>(0x00001f0e, 0x00000ff8)</ParentIdentifier> + <Index>0</Index> + <BoxIdentifier>(0xffffffff, 0xffffffff)</BoxIdentifier> + <NumChildren>2</NumChildren> + <Attributes> + <Attribute> + <Identifier>(0x237e56d2, 0x10cd68ae)</Identifier> + <Value>277</Value> + </Attribute> + <Attribute> + <Identifier>(0x54e45f5b, 0x76c036e2)</Identifier> + <Value>136</Value> + </Attribute> + </Attributes> + </VisualisationWidget> + <VisualisationWidget> + <Identifier>(0x00000dcf, 0x00002041)</Identifier> + <Type>3</Type> + <ParentIdentifier>(0x00000e21, 0x000020fb)</ParentIdentifier> + <Index>0</Index> + <BoxIdentifier>(0x000032a2, 0x00004de0)</BoxIdentifier> + <NumChildren>0</NumChildren> + </VisualisationWidget> + <VisualisationWidget> + <Identifier>(0x0000709d, 0x0000789f)</Identifier> + <Type>3</Type> + <ParentIdentifier>(0x00000e21, 0x000020fb)</ParentIdentifier> + <Index>1</Index> + <BoxIdentifier>(0x00002750, 0x00001fb2)</BoxIdentifier> + <NumChildren>0</NumChildren> + </VisualisationWidget> + </VisualisationTree> + <Attributes> + <Attribute> + <Identifier>(0x790d75b8, 0x3bb90c33)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0x8c1fc55b, 0x7b433dc2)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0x9f5c4075, 0x4a0d3666)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xf36a1567, 0xd13c53da)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xf6b2e3fa, 0x7bd43926)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xf8034a49, 0x8b3f37cc)</Identifier> + <Value></Value> + </Attribute> + </Attributes> +</OpenViBE-Scenario>
\ No newline at end of file diff --git a/openvibe-scenarios/free-will-bci-2-classifier-trainer.xml b/openvibe-scenarios/free-will-bci-2-classifier-trainer.xml new file mode 100644 index 0000000..233a30e --- /dev/null +++ b/openvibe-scenarios/free-will-bci-2-classifier-trainer.xml @@ -0,0 +1,692 @@ +<OpenViBE-Scenario> + <Creator>OpenViBE</Creator> + <CreatorVersion>1.3.0</CreatorVersion> + <Boxes> + <Box> + <Identifier>(0x00000124, 0x0000214f)</Identifier> + <Name>Python scripting</Name> + <AlgorithmClassIdentifier>(0x5dc4f669, 0xd3fd4d64)</AlgorithmClassIdentifier> + <Outputs> + <Output> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>EndStimulation</Name> + </Output> + </Outputs> + <Settings> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>Clock frequency (Hz)</Name> + <DefaultValue>64</DefaultValue> + <Value>64</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0xb0d0db45, 0x49cbc34a)</TypeIdentifier> + <Name>Script</Name> + <DefaultValue></DefaultValue> + <Value>E:/Tilen/FAX/2. stopnja/UI/projekt-bci/free-will/scripts/python-learning.py</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> + <Name>InputCSVSignal</Name> + <DefaultValue></DefaultValue> + <Value>E:/Tilen/FAX/2. stopnja/UI/projekt-bci/free-will/signals/record-sig-[2017.05.15-23.11.00].csv</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> + <Name>InputCSVStimulations</Name> + <DefaultValue></DefaultValue> + <Value>E:/Tilen/FAX/2. stopnja/UI/projekt-bci/free-will/signals/record-stim-[2017.05.15-23.11.00].csv</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> + <Name>SaveFile</Name> + <DefaultValue></DefaultValue> + <Value></Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>WindowSize (ms)</Name> + <DefaultValue>100</DefaultValue> + <Value>100</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>NumOfPrevWindows</Name> + <DefaultValue>5</DefaultValue> + <Value>4</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>NumOfWindowsBefore</Name> + <DefaultValue>0</DefaultValue> + <Value>4</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>NumOfWindowsAfter</Name> + <DefaultValue>0</DefaultValue> + <Value>0</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>K-folds</Name> + <DefaultValue>4</DefaultValue> + <Value>10</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x17ee7c08, 0x94c14893)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>16.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>34</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>224.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x30a4e5c9, 0x83502953)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x2a651510, 0xb4fad0d4)</Value> + </Attribute> + <Attribute> + <Identifier>(0x527ad68d, 0x16d746a0)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0x61d11811, 0x71e65362)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>102</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x00055fbe)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc67a01dc, 0x28ce06c1)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>2</Value> + </Attribute> + <Attribute> + <Identifier>(0xf191c1c8, 0xa0123976)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xfba64161, 0x65304e21)</Identifier> + <Value></Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00000d51, 0x000039af)</Identifier> + <Name>CSV File Reader</Name> + <AlgorithmClassIdentifier>(0x641d0717, 0x02884107)</AlgorithmClassIdentifier> + <Outputs> + <Output> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Output stream</Name> + </Output> + </Outputs> + <Settings> + <Setting> + <TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> + <Name>Filename</Name> + <DefaultValue></DefaultValue> + <Value>E:/Tilen/FAX/2. stopnja/UI/projekt-bci/free-will/signals/record-stim-[2017.05.15-23.11.00].csv</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x79a9edeb, 0x245d83fc)</TypeIdentifier> + <Name>Column separator</Name> + <DefaultValue>;</DefaultValue> + <Value>;</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> + <Name>Don't use the file time</Name> + <DefaultValue>false</DefaultValue> + <Value>false</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>Unused parameter</Name> + <DefaultValue>32</DefaultValue> + <Value>0</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-128.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>45</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>496.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x30a4e5c9, 0x83502953)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x3bf57676, 0xad3aaefa)</Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>97</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x0001d5c4)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>true</Value> + </Attribute> + <Attribute> + <Identifier>(0xc80ce8af, 0xf699f813)</Identifier> + <Value>1</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>4</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x000055e6, 0x00000489)</Identifier> + <Name>Player Controller</Name> + <AlgorithmClassIdentifier>(0x5f426dce, 0x08456e13)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Stimulations</Name> + </Input> + </Inputs> + <Settings> + <Setting> + <TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier> + <Name>Stimulation name</Name> + <DefaultValue>OVTK_StimulationId_Label_00</DefaultValue> + <Value>OVTK_StimulationId_TrialStop</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0xcc14d8d6, 0xf27ecb73)</TypeIdentifier> + <Name>Action to perform</Name> + <DefaultValue>Pause</DefaultValue> + <Value>Stop</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>96.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>23</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>240.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x568d148e, 0x650792b3)</Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>105</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x00284de3)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>false</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>2</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>1</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00006c4c, 0x000002b3)</Identifier> + <Name>CSV File Reader</Name> + <AlgorithmClassIdentifier>(0x641d0717, 0x02884107)</AlgorithmClassIdentifier> + <Outputs> + <Output> + <TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> + <Name>Output stream</Name> + </Output> + </Outputs> + <Settings> + <Setting> + <TypeIdentifier>(0x330306dd, 0x74a95f98)</TypeIdentifier> + <Name>Filename</Name> + <DefaultValue></DefaultValue> + <Value>E:/Tilen/FAX/2. stopnja/UI/projekt-bci/free-will/signals/record-sig-[2017.05.15-23.11.00].csv</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x79a9edeb, 0x245d83fc)</TypeIdentifier> + <Name>Column separator</Name> + <DefaultValue>;</DefaultValue> + <Value>;</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> + <Name>Don't use the file time</Name> + <DefaultValue>false</DefaultValue> + <Value>false</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier> + <Name>Samples per buffer</Name> + <DefaultValue>32</DefaultValue> + <Value>32</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-128.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>45</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>384.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x30a4e5c9, 0x83502953)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x3bf57676, 0xad3aaefa)</Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>97</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x0007fed6)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>true</Value> + </Attribute> + <Attribute> + <Identifier>(0xc80ce8af, 0xf699f813)</Identifier> + <Value>1</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>4</Value> + </Attribute> + </Attributes> + </Box> + <Box> + <Identifier>(0x00006ed7, 0x000003cf)</Identifier> + <Name>Signal display</Name> + <AlgorithmClassIdentifier>(0x0055be5f, 0x087bdd12)</AlgorithmClassIdentifier> + <Inputs> + <Input> + <TypeIdentifier>(0x5ba36127, 0x195feae1)</TypeIdentifier> + <Name>Data</Name> + </Input> + <Input> + <TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier> + <Name>Stimulations</Name> + </Input> + <Input> + <TypeIdentifier>(0x6ab26b81, 0x0f8c02f3)</TypeIdentifier> + <Name>Channel Units</Name> + </Input> + </Inputs> + <Settings> + <Setting> + <TypeIdentifier>(0x5de046a6, 0x086340aa)</TypeIdentifier> + <Name>Display Mode</Name> + <DefaultValue>Scan</DefaultValue> + <Value>Scan</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x33a30739, 0x00d5299b)</TypeIdentifier> + <Name>Auto vertical scale</Name> + <DefaultValue>Per channel</DefaultValue> + <Value>Per channel</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Scale refresh interval (secs)</Name> + <DefaultValue>5</DefaultValue> + <Value>5</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Vertical Scale</Name> + <DefaultValue>100</DefaultValue> + <Value>100</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Vertical Offset</Name> + <DefaultValue>0</DefaultValue> + <Value>0</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier> + <Name>Time Scale</Name> + <DefaultValue>10</DefaultValue> + <Value>10</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> + <Name>Bottom ruler</Name> + <DefaultValue>true</DefaultValue> + <Value>true</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> + <Name>Left ruler</Name> + <DefaultValue>false</DefaultValue> + <Value>false</Value> + <Modifiability>false</Modifiability> + </Setting> + <Setting> + <TypeIdentifier>(0x2cdb2f0b, 0x12f231ea)</TypeIdentifier> + <Name>Multiview</Name> + <DefaultValue>false</DefaultValue> + <Value>false</Value> + <Modifiability>false</Modifiability> + </Setting> + </Settings> + <Attributes> + <Attribute> + <Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier> + <Value>-64.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier> + <Value>45</Value> + </Attribute> + <Attribute> + <Identifier>(0x207c9054, 0x3c841b63)</Identifier> + <Value>432.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x4e7b798a, 0x183beafb)</Identifier> + <Value>(0x92c056a7, 0x2dc71aff)</Value> + </Attribute> + <Attribute> + <Identifier>(0x527ad68d, 0x16d746a0)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xad100179, 0xa3c984ab)</Identifier> + <Value>87</Value> + </Attribute> + <Attribute> + <Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier> + <Value>(0x00000000, 0x00024b35)</Value> + </Attribute> + <Attribute> + <Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier> + <Value>true</Value> + </Attribute> + <Attribute> + <Identifier>(0xce18836a, 0x9c0eb403)</Identifier> + <Value>9</Value> + </Attribute> + <Attribute> + <Identifier>(0xcfad85b0, 0x7c6d841c)</Identifier> + <Value>3</Value> + </Attribute> + </Attributes> + </Box> + </Boxes> + <Links> + <Link> + <Identifier>(0x00000e16, 0x00006760)</Identifier> + <Source> + <BoxIdentifier>(0x00006c4c, 0x000002b3)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x00006ed7, 0x000003cf)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-99</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>384</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-91</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>417</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x000011ac, 0x000063f9)</Identifier> + <Source> + <BoxIdentifier>(0x00000d51, 0x000039af)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x00006ed7, 0x000003cf)</BoxIdentifier> + <BoxInputIndex>1</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>-99</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>496</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>-91</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>432</Value> + </Attribute> + </Attributes> + </Link> + <Link> + <Identifier>(0x00004464, 0x0000753e)</Identifier> + <Source> + <BoxIdentifier>(0x00000124, 0x0000214f)</BoxIdentifier> + <BoxOutputIndex>0</BoxOutputIndex> + </Source> + <Target> + <BoxIdentifier>(0x000055e6, 0x00000489)</BoxIdentifier> + <BoxInputIndex>0</BoxInputIndex> + </Target> + <Attributes> + <Attribute> + <Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier> + <Value>39</Value> + </Attribute> + <Attribute> + <Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier> + <Value>224</Value> + </Attribute> + <Attribute> + <Identifier>(0x3f0a3b27, 0x570913d2)</Identifier> + <Value>80</Value> + </Attribute> + <Attribute> + <Identifier>(0x6267b5c5, 0x676e3e42)</Identifier> + <Value>240</Value> + </Attribute> + </Attributes> + </Link> + </Links> + <MessageLinks></MessageLinks> + <Comments> + <Comment> + <Identifier>(0x6160f9b8, 0x37b083c2)</Identifier> + <Text><u><b><big>Overview</big></b></u> + +This scenario is used to train data for the "free will experiment". +Main Python script settings are: + signals (csv) + keyboard stimulations (csv) + output file (python pickle) - trained (e.g. ./python-out-[$core{date}-$core{time}].pkl) + </Text> + <Attributes> + <Attribute> + <Identifier>(0x473d9a43, 0x97fc0a97)</Identifier> + <Value>-96.000000</Value> + </Attribute> + <Attribute> + <Identifier>(0x7234b86b, 0x2b8651a5)</Identifier> + <Value>-64.000000</Value> + </Attribute> + </Attributes> + </Comment> + </Comments> + <VisualisationTree> + <VisualisationWidget> + <Identifier>(0x00003e01, 0x000020d2)</Identifier> + <Type>3</Type> + <ParentIdentifier>(0xffffffff, 0xffffffff)</ParentIdentifier> + <BoxIdentifier>(0x00006ed7, 0x000003cf)</BoxIdentifier> + <NumChildren>0</NumChildren> + </VisualisationWidget> + <VisualisationWidget> + <Identifier>(0x0c60317a, 0x7480157f)</Identifier> + <Name>Default window</Name> + <Type>1</Type> + <ParentIdentifier>(0xffffffff, 0xffffffff)</ParentIdentifier> + <BoxIdentifier>(0xffffffff, 0xffffffff)</BoxIdentifier> + <NumChildren>1</NumChildren> + <Attributes> + <Attribute> + <Identifier>(0x4c90d4ad, 0x7a2554ec)</Identifier> + <Value>1</Value> + </Attribute> + <Attribute> + <Identifier>(0x7b814cca, 0x271df6dd)</Identifier> + <Value>1</Value> + </Attribute> + </Attributes> + </VisualisationWidget> + <VisualisationWidget> + <Identifier>(0x4eff2d5e, 0x057e5a93)</Identifier> + <Name>Default tab</Name> + <Type>2</Type> + <ParentIdentifier>(0x0c60317a, 0x7480157f)</ParentIdentifier> + <Index>0</Index> + <BoxIdentifier>(0xffffffff, 0xffffffff)</BoxIdentifier> + <NumChildren>1</NumChildren> + </VisualisationWidget> + <VisualisationWidget> + <Identifier>(0x00b5ee2a, 0x40e0a42c)</Identifier> + <Name>Empty</Name> + <Type>0</Type> + <ParentIdentifier>(0x4eff2d5e, 0x057e5a93)</ParentIdentifier> + <Index>0</Index> + <BoxIdentifier>(0xffffffff, 0xffffffff)</BoxIdentifier> + <NumChildren>0</NumChildren> + </VisualisationWidget> + </VisualisationTree> + <Attributes> + <Attribute> + <Identifier>(0x790d75b8, 0x3bb90c33)</Identifier> + <Value>Yann Renard / Fabien Lotte</Value> + </Attribute> + <Attribute> + <Identifier>(0x8c1fc55b, 0x7b433dc2)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0x9f5c4075, 0x4a0d3666)</Identifier> + <Value>Classifier Training</Value> + </Attribute> + <Attribute> + <Identifier>(0xf36a1567, 0xd13c53da)</Identifier> + <Value></Value> + </Attribute> + <Attribute> + <Identifier>(0xf6b2e3fa, 0x7bd43926)</Identifier> + <Value>Motor Imagery</Value> + </Attribute> + <Attribute> + <Identifier>(0xf8034a49, 0x8b3f37cc)</Identifier> + <Value>INRIA</Value> + </Attribute> + </Attributes> +</OpenViBE-Scenario>
\ No newline at end of file diff --git a/scripts/python-learning.py b/scripts/python-learning.py new file mode 100644 index 0000000..d144678 --- /dev/null +++ b/scripts/python-learning.py @@ -0,0 +1,157 @@ +import numpy as np +import pandas +from math import ceil, floor +from sklearn.model_selection import train_test_split +from sklearn import svm +from sklearn.model_selection import KFold, StratifiedKFold, permutation_test_score +from sklearn import linear_model +from sklearn.svm import SVC +import pickle +import matplotlib.pyplot as plt +import numpy.fft as fft +from sklearn import datasets + +class MyOVBox(OVBox): + def __init__(self): + OVBox.__init__(self) + # Names of CSV files + self.signalFileName = "" + self.stimFileName = "" + # Name of Save File + self.saveFileName = "" + # other variables + self.windowSize = 0 # window size in ms + self.numOfPreviousWindowsAsOne = 0 # number of windows before actual stimulation to be marked as 1 + self.numOfWindowsBefore = 0 # number of windows before those marked as 1, to be marked as 0 + self.numOfWindowsAfter = 0 # number of windows after those marked as 1, to be marked as 0 + + + def filter_signal(self, sampleRate, numberOfSamplesWindow, stimulationTimes, splittedSignal): + """ returns tuple of filtered (signal chunks, classes) """ + splittedSignal_filtrd = [] + classes_filtrd = [] + + temp_classes = np.zeros(len(splittedSignal)) + + for stim in stimulationTimes: + index = int(floor(stim*sampleRate/numberOfSamplesWindow)) + temp_classes[index] = 1 + for i in range(1, self.numOfPreviousWindowsAsOne): + temp_classes[index-i] = 1 + + tmp_cls_winds = temp_classes[(index - self.numOfPreviousWindowsAsOne - self.numOfWindowsBefore):index+self.numOfWindowsAfter] + tmp_sig_winds = np.concatenate(splittedSignal[(index - self.numOfPreviousWindowsAsOne - self.numOfWindowsBefore):index+self.numOfWindowsAfter]) + + if len(tmp_sig_winds)/len(tmp_cls_winds)!=numberOfSamplesWindow: # if np.array_split does not split in equal windows + tmp_sig_winds = np.lib.pad(tmp_sig_winds, ((0, int(len(tmp_cls_winds)*numberOfSamplesWindow-len(tmp_sig_winds))),(0, 0)), 'edge') # pad with same values on end of array + + classes_filtrd.extend(tmp_cls_winds) + splittedSignal_filtrd.extend(np.array_split(tmp_sig_winds, len(tmp_cls_winds))) + + return (splittedSignal_filtrd, classes_filtrd) + + + def avg_k_fold(self, data, classes, k=4): + """ return average CA of k-fold cross validation """ + avg_val = 0 + + kf = KFold(n_splits=k) + for train, test in kf.split(data): + clf = svm.SVC(kernel='linear', C=1).fit(data[train], classes[train]) + cur_score = clf.score(data[test], classes[test]) + avg_val += cur_score + # print cur_score + return avg_val/k + + + def permutation_significance_classification_score(self, X, y, k_folds=4): + n_classes = np.unique(y).size + + svm = SVC(kernel='linear') + cv = StratifiedKFold(k_folds) + + score, permutation_scores, pvalue = permutation_test_score(svm, X, y, scoring="accuracy", cv=cv, n_permutations=200, n_jobs=1) + print("Classification score %s (pvalue : %s)" % (score, pvalue)) + + plt.hist(permutation_scores, 20, label='Permutation scores') + ylim = plt.ylim() + plt.plot(2 * [score], ylim, '--g', linewidth=3, + label='Classification Score' + ' (pvalue %s)' % pvalue) + plt.plot(2 * [1. / n_classes], ylim, '--k', linewidth=3, label='Luck') + + plt.ylim(ylim) + plt.legend() + plt.xlabel('Score') + plt.show() + + + def initialize(self): + # Names of CSV files + self.signalFileName = self.setting['InputCSVSignal'] + self.stimFileName = self.setting['InputCSVStimulations'] + # Name of Save File + self.saveFileName = self.setting['SaveFile'] + # other variables + self.windowSize = int(self.setting['WindowSize (ms)']) # in ms + self.numOfPreviousWindowsAsOne = int(self.setting['NumOfPrevWindows']) + self.numOfWindowsBefore = int(self.setting['NumOfWindowsBefore'])-1 + self.numOfWindowsAfter = int(self.setting['NumOfWindowsAfter'])+1 + self.k_folds = int(self.setting['K-folds']) + + print "Reading files..." + # read CSV files + signalArray = pandas.read_csv(self.signalFileName, delimiter=";", encoding="utf-8-sig") + stimsArray = pandas.read_csv(self.stimFileName, delimiter=";", encoding="utf-8-sig") + print "Files read!" + + # sort information from tables (pandas dataframe) + time = signalArray['Time (s)'] + electrodes = signalArray.iloc[:, 1:signalArray.shape[1]-1] + sampleRate = signalArray['Sampling Rate'][0] + stimulationTimes = stimsArray['Time (s)'] + + numberOfSamplesWindow = floor(self.windowSize / ((1/sampleRate)*1000)) # number of samples for approximately self.windowSize ms + + splittedSignal = np.array_split(electrodes, ceil(len(time)/numberOfSamplesWindow)) # split signal into chunks of specified length + + s_c = self.filter_signal(sampleRate, numberOfSamplesWindow, stimulationTimes, splittedSignal) # filter signal and return sparsed version of chunks and assign classes + splittedSignal_filtrd = s_c[0] + classes_filtrd = s_c[1] + + splittedSignal_filtrd_means = np.array(np.mean(splittedSignal_filtrd, axis=1)) # for each window calculate mean value + # additional attributes could be added besides splittedSignal_filtrd_means + classes_filtrd = np.array(classes_filtrd) + + # print average k-fold CA + print "Average " + str(self.k_folds) + "-folds value: " + str(self.avg_k_fold(splittedSignal_filtrd_means, classes_filtrd, k=self.k_folds)) + #self.permutation_significance_classification_score(splittedSignal_filtrd_means, classes_filtrd, k_folds=2) # k_folds=2, last long if k is bigger + + if self.saveFileName: + clf = svm.SVC(kernel='linear', C=1).fit(splittedSignal_filtrd_means, classes_filtrd) + clf.fit(splittedSignal_filtrd_means, classes_filtrd) + + print "Saving to pickle file: " + self.saveFileName + pickle.dump(clf, open(self.saveFileName, 'wb')) + print "Learned score: " + str(clf.score(splittedSignal_filtrd_means, classes_filtrd)) + + # send finish stimulation output (for OpenViBE) + self.finishBySendingStimulation(32774) # OVTK_StimulationId_TrialStop code + + + def finishBySendingStimulation(self, stimulationCode): + stimSetFinish = OVStimulationSet(self.getCurrentTime(), self.getCurrentTime()+1./self.getClock()) + stimSetFinish.append(OVStimulation(stimulationCode, self.getCurrentTime(), 0.)) + self.output[0].append(stimSetFinish) + + + def process(self): + + return + + def uninitialize(self): + # nop + + return + +box = MyOVBox() |