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 rebase bug

authored by

jdpigeon and committed by
Teon L Brooks
f7cd19df 84bde11d

+41 -66
+14 -11
app/containers/HomeContainer.js
··· 1 1 // @flow 2 - import { connect } from "react-redux"; 3 - import { bindActionCreators } from "redux"; 4 - import Home from "../components/HomeComponent"; 5 - import * as deviceActions from "../actions/deviceActions"; 6 - import * as pyodideActions from "../actions/pyodideActions"; 7 - import * as experimentActions from "../actions/experimentActions"; 2 + import { connect } from 'react-redux'; 3 + import { bindActionCreators } from 'redux'; 4 + import Home from '../components/HomeComponent'; 5 + import * as deviceActions from '../actions/deviceActions'; 6 + import * as pyodideActions from '../actions/pyodideActions'; 7 + import * as experimentActions from '../actions/experimentActions'; 8 + 9 + function mapStateToProps(state) { 10 + return { 11 + availableDevices: state.device.availableDevices, 12 + }; 13 + } 8 14 9 15 function mapDispatchToProps(dispatch) { 10 16 return { 11 17 deviceActions: bindActionCreators(deviceActions, dispatch), 12 18 pyodideActions: bindActionCreators(pyodideActions, dispatch), 13 - experimentActions: bindActionCreators(experimentActions, dispatch) 19 + experimentActions: bindActionCreators(experimentActions, dispatch), 14 20 }; 15 21 } 16 22 17 - export default connect( 18 - null, 19 - mapDispatchToProps 20 - )(Home); 23 + export default connect(mapStateToProps, mapDispatchToProps)(Home);
+27 -55
app/epics/pyodideEpics.js
··· 13 13 LOAD_TOPO, 14 14 CLEAN_EPOCHS, 15 15 loadTopo, 16 - loadERP 16 + loadERP, 17 17 } from '../actions/pyodideActions'; 18 18 import { 19 19 loadPackages, ··· 28 28 plotPSD, 29 29 plotERP, 30 30 plotTopoMap, 31 - saveEpochs 31 + saveEpochs, 32 32 } from '../utils/pyodide'; 33 33 import { 34 34 EMOTIV_CHANNELS, ··· 36 36 DEVICES, 37 37 MUSE_CHANNELS, 38 38 PYODIDE_VARIABLE_NAMES, 39 - PYODIDE_STATUS 39 + PYODIDE_STATUS, 40 40 } from '../constants/constants'; 41 41 42 42 export const GET_EPOCHS_INFO = 'GET_EPOCHS_INFO'; ··· 60 60 61 61 const getChannelInfo = () => ({ type: GET_CHANNEL_INFO }); 62 62 63 - const setEpochInfo = payload => ({ 63 + const setEpochInfo = (payload) => ({ 64 64 payload, 65 65 type: SET_EPOCH_INFO, 66 66 }); ··· 85 85 type: SET_ERP_PLOT, 86 86 }); 87 87 88 - const setPyodideStatus = payload => ({ 88 + const setPyodideStatus = (payload) => ({ 89 89 payload, 90 - type: SET_PYODIDE_STATUS 90 + type: SET_PYODIDE_STATUS, 91 91 }); 92 92 93 93 // ------------------------------------------------------------------------- 94 94 // Epics 95 95 96 - const launchEpic = action$ => 96 + const launchEpic = (action$) => 97 97 action$.ofType(LAUNCH).pipe( 98 98 tap(() => console.log('launching')), 99 99 mergeMap(loadPackages), ··· 104 104 const loadEpochsEpic = (action$, state$) => 105 105 action$.ofType(LOAD_EPOCHS).pipe( 106 106 pluck('payload'), 107 - filter(filePathsArray => filePathsArray.length >= 1), 108 - tap(files => console.log('files:', files)), 109 - map(filePathsArray => readFiles(filePathsArray)), 110 - tap(csvArray => console.log('csvs:', csvArray)), 111 - mergeMap(csvArray => loadCSV(csvArray)), 107 + filter((filePathsArray) => filePathsArray.length >= 1), 108 + tap((files) => console.log('files:', files)), 109 + map((filePathsArray) => readFiles(filePathsArray)), 110 + tap((csvArray) => console.log('csvs:', csvArray)), 111 + mergeMap((csvArray) => loadCSV(csvArray)), 112 112 mergeMap(() => filterIIR(1, 30)), 113 113 mergeMap(() => 114 114 epochEvents( ··· 125 125 map(() => getEpochsInfo(PYODIDE_VARIABLE_NAMES.RAW_EPOCHS)) 126 126 ); 127 127 128 - const loadCleanedEpochsEpic = action$ => 128 + const loadCleanedEpochsEpic = (action$) => 129 129 action$.ofType(LOAD_CLEANED_EPOCHS).pipe( 130 130 pluck('payload'), 131 - filter(filePathsArray => filePathsArray.length >= 1), 132 - map(filePathsArray => loadCleanedEpochs(filePathsArray)), 131 + filter((filePathsArray) => filePathsArray.length >= 1), 132 + map((filePathsArray) => loadCleanedEpochs(filePathsArray)), 133 133 mergeMap(() => 134 - of( 135 - getEpochsInfo(PYODIDE_VARIABLE_NAMES.CLEAN_EPOCHS), 136 - getChannelInfo(), 137 - loadTopo() 138 - ) 134 + of(getEpochsInfo(PYODIDE_VARIABLE_NAMES.CLEAN_EPOCHS), getChannelInfo(), loadTopo()) 139 135 ) 140 136 ); 141 137 ··· 143 139 action$.ofType(CLEAN_EPOCHS).pipe( 144 140 map(cleanEpochsPlot), 145 141 map(() => 146 - saveEpochs( 147 - getWorkspaceDir(state$.value.experiment.title), 148 - state$.value.experiment.subject 149 - ) 142 + saveEpochs(getWorkspaceDir(state$.value.experiment.title), state$.value.experiment.subject) 150 143 ), 151 144 map(() => getEpochsInfo(PYODIDE_VARIABLE_NAMES.RAW_EPOCHS)) 152 145 ); 153 146 154 - const getEpochsInfoEpic = action$ => 147 + const getEpochsInfoEpic = (action$) => 155 148 action$.ofType(GET_EPOCHS_INFO).pipe( 156 149 pluck('payload'), 157 - tap(payload => console.log('payload: ', payload)), 150 + tap((payload) => console.log('payload: ', payload)), 158 151 mergeMap(requestEpochsInfo), 159 - map(epochInfoArray => 160 - epochInfoArray.map(infoObj => ({ 152 + map((epochInfoArray) => 153 + epochInfoArray.map((infoObj) => ({ 161 154 name: Object.keys(infoObj)[0], 162 155 value: infoObj[Object.keys(infoObj)[0]], 163 156 })) ··· 165 158 map(setEpochInfo) 166 159 ); 167 160 168 - const getChannelInfoEpic = action$ => 161 + const getChannelInfoEpic = (action$) => 169 162 action$.ofType(GET_CHANNEL_INFO).pipe( 170 163 map(requestChannelInfo), 171 - map(channelInfoString => 172 - setChannelInfo(parseSingleQuoteJSON(channelInfoString)) 173 - ) 164 + map((channelInfoString) => setChannelInfo(parseSingleQuoteJSON(channelInfoString))) 174 165 ); 175 166 176 - const loadPSDEpic = action$ => 177 - action$.ofType(LOAD_PSD).pipe( 178 - map(plotPSD), 179 - map(setPSDPlot) 180 - ); 167 + const loadPSDEpic = (action$) => action$.ofType(LOAD_PSD).pipe(map(plotPSD), map(setPSDPlot)); 181 168 182 169 const loadTopoEpic = (action$, state$) => 183 170 action$.ofType(LOAD_TOPO).pipe( 184 171 map(plotTopoMap), 185 - mergeMap(topoPlot => 172 + mergeMap((topoPlot) => 186 173 of( 187 174 setTopoPlot(topoPlot), 188 175 loadERP( ··· 192 179 ) 193 180 ); 194 181 195 - const loadERPEpic = action$ => 182 + const loadERPEpic = (action$) => 196 183 action$.ofType(LOAD_ERP).pipe( 197 - <<<<<<< HEAD 198 - <<<<<<< HEAD 199 184 pluck('payload'), 200 185 map((channelName) => { 201 - ======= 202 - pluck("payload"), 203 - ======= 204 - pluck('payload'), 205 - >>>>>>> Tidyed up pyodide files and removed some jupyter dependencies 206 - map(channelName => { 207 - >>>>>>> Added loading of pyodide within app epics 208 186 if (MUSE_CHANNELS.includes(channelName)) { 209 187 return MUSE_CHANNELS.indexOf(channelName); 210 188 } else if (EMOTIV_CHANNELS.includes(channelName)) { 211 189 return EMOTIV_CHANNELS.indexOf(channelName); 212 190 } 213 - <<<<<<< HEAD 214 191 console.warn('channel name supplied to loadERPEpic does not belong to either device'); 215 - ======= 216 - console.warn( 217 - 'channel name supplied to loadERPEpic does not belong to either device' 218 - ); 219 - >>>>>>> Added loading of pyodide within app epics 220 192 return EMOTIV_CHANNELS[0]; 221 193 }), 222 - map(channelIndex => plotERP(channelIndex)), 194 + map((channelIndex) => plotERP(channelIndex)), 223 195 map(setERPPlot) 224 196 ); 225 197