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.

correct paths

authored by

Yury Shevchenko and committed by
Teon L Brooks
d4d5668b 69dc4d92

+10 -26
+3 -2
app/components/CleanComponent/index.js
··· 18 18 import { Kernel } from '../../constants/interfaces'; 19 19 import { readWorkspaceRawEEGData } from '../../utils/filesystem/storage'; 20 20 import CleanSidebar from './CleanSidebar'; 21 + import * as path from 'path'; 21 22 22 23 interface Props { 23 24 type: ?EXPERIMENTS; ··· 77 78 } 78 79 this.setState({ 79 80 subjects: workspaceRawData 80 - .map(filepath => filepath.path.split('/')[filepath.path.split('/').length - 3]) 81 + .map(filepath => filepath.path.split(path.sep)[filepath.path.split(path.sep).length - 3]) 81 82 .reduce((acc, curr) => { 82 83 if (acc.find(subject => subject.key === curr)) { 83 84 return acc; ··· 199 200 options={this.state.eegFilePaths.filter( 200 201 filepath => 201 202 this.state.selectedSubject === 202 - filepath.value.split('/')[filepath.value.split('/').length - 3] 203 + filepath.value.split(path.sep)[filepath.value.split(path.sep).length - 3] 203 204 )} 204 205 onChange={this.handleRecordingChange} 205 206 />
+7 -24
app/utils/behavior/compute.js
··· 1 1 import * as ss from 'simple-statistics'; 2 + import * as path from 'path'; 2 3 3 4 export const aggregateBehaviorDataToSave = (data, removeOutliers) => { 4 5 const processedData = data.map(result => { 5 6 if ( 6 - result.meta.datafile 7 - .split('/') 8 - .pop() 9 - .includes('aggregated') 7 + path.basename(result.meta.datafile).includes('aggregated') 10 8 ) { 11 9 return transformAggregated(result); 12 10 } else { ··· 69 67 if (data && data.length > 0) { 70 68 const processedData = data.map(result => { 71 69 if ( 72 - result.meta.datafile 73 - .split('/') 74 - .pop() 75 - .includes('aggregated') 70 + path.basename(result.meta.datafile).includes('aggregated') 76 71 ) { 77 72 return transformAggregated(result); 78 73 } ··· 120 115 const transformed = conditions.map(condition => 121 116 result.data.map(e => ({ 122 117 reaction_time: parseFloat(e[`RT_${condition}`]), 123 - subject: result.meta.datafile 124 - .split('/') 125 - .pop() 126 - .split('.csv')[0], 118 + subject: path.parse(result.meta.datafile).name, 127 119 condition, 128 120 group: e.group, 129 121 session: e.session, ··· 141 133 .filter(row => row.trial_number) 142 134 .map(row => ({ 143 135 condition: row.condition, 144 - subject: data.meta.datafile 145 - .split('/') 146 - .pop() 147 - .split('-')[0], 148 - group: data.meta.datafile 149 - .split('/') 150 - .pop() 151 - .split('-')[1], 152 - session: data.meta.datafile 153 - .split('/') 154 - .pop() 155 - .split('-')[2], 136 + subject: path.parse(data.meta.datafile).name.split('-')[0], 137 + group: path.parse(data.meta.datafile).name.split('-')[1], 138 + session: path.parse(data.meta.datafile).name.split('-')[2], 156 139 reaction_time: Math.round(parseFloat(row.reaction_time)), 157 140 correct_response: row.correct_response, 158 141 trial_number: row.trial_number,