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.

Added subject names to saved images

+19 -7
+13 -4
app/components/AnalyzeComponent.js
··· 15 15 MUSE_CHANNELS, 16 16 EMOTIV_CHANNELS 17 17 } from '../constants/constants'; 18 - import { readWorkspaceCleanedEEGData } from '../utils/filesystem/storage'; 18 + import { readWorkspaceCleanedEEGData, getSubjectNamesFromFiles } from '../utils/filesystem/storage'; 19 19 import SecondaryNavComponent from './SecondaryNavComponent'; 20 20 import ClickableHeadDiagramSVG from './svgs/ClickableHeadDiagramSVG'; 21 21 import JupyterPlotWidget from './JupyterPlotWidget'; ··· 45 45 value: { name: string, dir: string } 46 46 }>; 47 47 selectedFilePaths: Array<?string>; 48 + selectedSubjects: Array<?string>; 48 49 } 49 50 // TODO: Add a channel callback from reading epochs so this screen can be aware of which channels are 50 51 // available in dataset ··· 63 64 activeStep: ANALYZE_STEPS.OVERVIEW, 64 65 eegFilePaths: [{ key: '', text: '', value: '' }], 65 66 selectedFilePaths: [], 67 + selectedSubjects: [], 66 68 selectedChannel: 67 69 props.deviceType === DEVICES.EMOTIV 68 70 ? EMOTIV_CHANNELS[0] ··· 96 98 } 97 99 98 100 handleDatasetChange(event: Object, data: Object) { 99 - this.setState({ selectedFilePaths: data.value }); 101 + this.setState({ selectedFilePaths: data.value, 102 + selectedSubjects: getSubjectNamesFromFiles(data.value) }); 100 103 this.props.jupyterActions.loadCleanedEpochs(data.value); 101 104 } 102 105 ··· 105 108 this.props.jupyterActions.loadERP(channelName); 106 109 } 107 110 111 + concatSubjectNames(subjects: Array<?string>) { 112 + if(subjects.length < 1) { return '' } 113 + return subjects.reduce((acc, curr) => `${acc}-${curr}`) 114 + } 115 + 108 116 renderEpochLabels() { 109 117 if ( 110 118 !isNil(this.props.epochsInfo) && ··· 162 170 <Grid.Column width={8}> 163 171 <JupyterPlotWidget 164 172 title={this.props.title} 165 - imageTitle="Topoplot" 173 + imageTitle={`${this.concatSubjectNames(this.state.selectedSubjects)}-Topoplot`} 166 174 plotMIMEBundle={this.props.topoPlot} 167 175 /> 168 176 </Grid.Column> ··· 194 202 <Grid.Column width={8}> 195 203 <JupyterPlotWidget 196 204 title={this.props.title} 197 - imageTitle={`${this.state.selectedChannel}-ERP`} 205 + imageTitle={ 206 + `${this.concatSubjectNames(this.state.selectedSubjects)}-${this.state.selectedChannel}-ERP`} 198 207 plotMIMEBundle={this.props.erpPlot} 199 208 /> 200 209 </Grid.Column>
-2
app/components/HomeComponent/index.js
··· 95 95 } 96 96 97 97 handleLoadCustomExperiment(title: string) { 98 - console.log(title) 99 - console.log(this.state.recentWorkspaces) 100 98 this.setState({ isNewExperimentModalOpen: false }); 101 99 // Don't create new workspace if it already exists or title is too short 102 100 if (this.state.recentWorkspaces.includes(title)) {
+5
app/utils/filesystem/storage.js
··· 159 159 const extension = filename.slice(-3); 160 160 return extension === 'png' || extension === 'jpg' || extension === 'gif'; 161 161 }); 162 + 163 + // ----------------------------------------------------------------------------------------------- 164 + // Util 165 + 166 + export const getSubjectNamesFromFiles = (filePaths: Array<?string>) => filePaths.map(filePath => path.basename(filePath)).map(fileName => fileName.substring(0, fileName.indexOf('-')))
+1 -1
app/utils/jupyter/utils.py
··· 130 130 if palette is None: 131 131 palette = sns.color_palette("hls", len(conditions) + 1) 132 132 133 - X = epochs.get_data() * 1e6 133 + X = epochs.get_data() 134 134 times = epochs.times 135 135 y = pd.Series(epochs.events[:, -1]) 136 136 fig, ax = plt.subplots()