An easy-to-use platform for EEG experimentation in the classroom
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fixed bug where jsPsych would crash on endExperiment; Ameliorated some dropped Muse data issues

jdpigeon 779f94e6 e36fe057

+27 -15
+10 -1
app/components/InputModal.js
··· 20 20 state: State; 21 21 handleTextEntry: (Object, Object) => void; 22 22 handleClose: () => void; 23 + handleEnterSubmit: Object => void; 23 24 24 25 constructor(props: Props) { 25 26 super(props); ··· 27 28 enteredText: '', 28 29 isError: false 29 30 }; 30 - this.handleTextEntry = debounce(this.handleTextEntry, 500).bind(this); 31 + this.handleTextEntry = debounce(this.handleTextEntry, 200).bind(this); 31 32 this.handleClose = this.handleClose.bind(this); 33 + this.handleEnterSubmit = this.handleEnterSubmit.bind(this); 32 34 } 33 35 34 36 handleTextEntry(event, data) { ··· 43 45 } 44 46 } 45 47 48 + handleEnterSubmit(event: Object) { 49 + if (event.key === 'Enter') { 50 + this.handleClose(); 51 + } 52 + } 53 + 46 54 render() { 47 55 return ( 48 56 <Modal ··· 60 68 fluid 61 69 error={this.state.isError} 62 70 onChange={this.handleTextEntry} 71 + onKeyDown={this.handleEnterSubmit} 63 72 /> 64 73 </Modal.Content> 65 74 <Modal.Actions>
+6 -2
app/epics/deviceEpics.js
··· 108 108 promise.then( 109 109 devices => devices, 110 110 error => { 111 - toast.error(`"Device Error: " ${error.toString()}`); 111 + if (error.toString().contains('client.queryHeadsets')) { 112 + toast.error('Device Error: Could not find Cortex Service'); 113 + } else { 114 + toast.error(`"Device Error: " ${error.toString()}`); 115 + } 112 116 console.error('searchEpic: ', error.toString()); 113 117 return []; 114 118 } ··· 161 165 deviceInfo => deviceInfo, 162 166 error => { 163 167 console.error('connectEpic: ', error); 164 - toast.error('Device Error: ', error); 168 + toast.error(`"Device Error: " ${error.toString()}`); 165 169 return null; 166 170 } 167 171 )
+6 -6
app/utils/eeg/muse.js
··· 1 1 import 'hazardous'; 2 - import { withLatestFrom, share, startWith } from 'rxjs/operators'; 2 + import { withLatestFrom, share, startWith, filter } from 'rxjs/operators'; 3 3 import { 4 4 addInfo, 5 5 epoch, ··· 17 17 const { MUSE_SERVICE, MuseClient, zipSamples } = require('muse-js'); 18 18 const { from } = require('rxjs'); 19 19 20 - const INTER_SAMPLE_INTERVAL = (1 / 256) * 1000; 20 + const INTER_SAMPLE_INTERVAL = -(1 / 256) * 1000; 21 21 22 22 // Just returns the client object from Muse JS 23 23 const client = new MuseClient(); ··· 62 62 const eegStream = await client.eegReadings; 63 63 const markers = await client.eventMarkers.pipe(startWith({ timestamp: 0 })); 64 64 return from(zipSamples(eegStream)).pipe( 65 + filter(sample => !sample.data.includes(NaN)), 65 66 withLatestFrom(markers, synchronizeTimestamp), 66 67 share() 67 68 ); ··· 89 90 highCutoff: 50 90 91 }), 91 92 addSignalQuality(), 92 - parseMuseSignalQuality(), 93 - share() 93 + parseMuseSignalQuality() 94 94 ); 95 95 }; 96 96 ··· 104 104 105 105 const synchronizeTimestamp = (eegSample, marker) => { 106 106 if ( 107 - eegSample['timestamp'] - marker['timestamp'] > 0 && 108 - eegSample['timestamp'] - marker['timestamp'] <= INTER_SAMPLE_INTERVAL 107 + eegSample['timestamp'] - marker['timestamp'] < 0 && 108 + eegSample['timestamp'] - marker['timestamp'] >= INTER_SAMPLE_INTERVAL 109 109 ) { 110 110 return { ...eegSample, marker: marker['value'] }; 111 111 }
+4 -5
package-lock.json
··· 8072 8072 }, 8073 8073 "fbjs": { 8074 8074 "version": "0.6.1", 8075 - "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.6.1.tgz", 8075 + "resolved": "http://registry.npmjs.org/fbjs/-/fbjs-0.6.1.tgz", 8076 8076 "integrity": "sha1-lja3cF9bqWhNRLcveDISVK/IYPc=", 8077 8077 "requires": { 8078 8078 "core-js": "^1.0.0", ··· 12302 12302 }, 12303 12303 "jspsych": { 12304 12304 "version": "git://github.com/makebrainwaves/jspsych.git#e0b2d383feffe9e0c38eeb2489b2e6b70de6743e", 12305 - "from": "jspsych@git://github.com/makebrainwaves/jspsych.git#e0b2d383feffe9e0c38eeb2489b2e6b70de6743e" 12305 + "from": "git://github.com/makebrainwaves/jspsych.git#jspsych-react@0.1.2" 12306 12306 }, 12307 12307 "jspsych-react": { 12308 - "version": "0.2.1", 12309 - "resolved": "https://registry.npmjs.org/jspsych-react/-/jspsych-react-0.2.1.tgz", 12310 - "integrity": "sha512-3uAxFqiJzHp7OSY2Bo1A1jdI9ony9Kanq7LjzPJrczBs15b/qSRxkQmNXaED617XXOB3npXp/uU9lowCVTnLfQ==", 12308 + "version": "git+https://github.com/makebrainwaves/jspsych-react.git#0948ca2abf043e6196e26b3c47d2d6f2a6a2eb92", 12309 + "from": "git+https://github.com/makebrainwaves/jspsych-react.git", 12311 12310 "requires": { 12312 12311 "jspsych": "git://github.com/makebrainwaves/jspsych.git#e0b2d383feffe9e0c38eeb2489b2e6b70de6743e", 12313 12312 "react": "^0.14.3"
+1 -1
package.json
··· 216 216 "font-awesome": "^4.7.0", 217 217 "hazardous": "^0.3.0", 218 218 "history": "^4.7.2", 219 - "jspsych-react": "^0.2.1", 219 + "jspsych-react": "git+https://github.com/makebrainwaves/jspsych-react.git", 220 220 "kernelspecs": "^2.0.0", 221 221 "lodash": "^4.17.10", 222 222 "mkdirp": "^0.5.1",