Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Commit

Permalink
Version 2.0 (code 15) with refactored connection and BCI modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpigeon committed Aug 4, 2017
1 parent 00a94db commit 9e465cd
Show file tree
Hide file tree
Showing 21 changed files with 96 additions and 289 deletions.
2 changes: 1 addition & 1 deletion EEG101/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ android {
applicationId "com.eeg_project"
minSdkVersion 16
targetSdkVersion 25
versionCode 14
versionCode 15
versionName "2.0"
ndk {
abiFilters "armeabi-v7a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ public void initView(Context context) {
// Create eegPlot
eegPlot = new XYPlot(context, "Raw EEG Plot");

// get datasets (Y will be dataSeries, x will be implicitly generated):
//dataSource = new EEGDataSource(appState.connectedMuse.isLowEnergy());

dataSeries = new DynamicSeries("dataSeries");

Expand Down
Binary file modified EEG101/src/assets/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified EEG101/src/assets/vibrate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions EEG101/src/components/DataCollector.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default class DataCollector extends Component {
{I18n.t("totalCleanData")}
</Text>
<Button onPress={() => this.collectData()}>
{I18n.t("trainCollect")}
{I18n.t("trainCollectMore")}
</Button>
</View>
);
Expand Down Expand Up @@ -127,7 +127,7 @@ export default class DataCollector extends Component {
{I18n.t("totalCleanData2")}
</Text>
<Button onPress={() => this.collectData()}>
{I18n.t("trainCollect")}
{I18n.t("trainCollectMore")}
</Button>
</View>
);
Expand Down
13 changes: 11 additions & 2 deletions EEG101/src/components/MiniChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ export default class MiniChart extends Component {
style={{
position: "absolute",
left: -20,
bottom: 75,
fontWeight: "100",
color: colors.black,
fontFamily: "Roboto-Light",
fontSize: 11,
transform: [{ rotate: "270deg" }]
}}
>
{" "}Feature Rank
{" "}Feature Power
</Text>
<VictoryChart
width={this.props.width}
height={this.props.height - 50}
padding={{ bottom: 30, top: 10, right: 10, left: 30 }}
padding={{ bottom: 30, top: 10, right: 10, left: 55 }}
domainPadding={{y:[0,10]}}
style={{ labels: { fontSize: 10 } }}
>
Expand All @@ -67,6 +68,7 @@ export default class MiniChart extends Component {
/>
<VictoryAxis
dependentAxis={true}
tickCount={4}
style={{ tickLabels: { fontSize: 9 } }}
/>
<VictoryLine
Expand All @@ -87,11 +89,18 @@ export default class MiniChart extends Component {
/>
</VictoryChart>
</View>
<View style={{alignItems: 'center', flexDirection: 'row'}}>
<Image
source={require("../assets/electrodelegend.png")}
style={{ width: 150, height: 30 }}
resizeMode="contain"
/>
<Image
source={require("../assets/electrodediagram.png")}
style={{ width: 50, height: 50 }}
resizeMode="contain"
/>
</View>
</View>
);
}
Expand Down
2 changes: 1 addition & 1 deletion EEG101/src/components/PlayPauseButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class PlayPauseButton extends Component{
return(
<TouchableOpacity onPress={this.props.onPress} disabled={this.props.disabled}>
<Image source={imageSource} resizeMode='contain'
style={{height: 100, width: 100, alignSelf: 'center'}}/>
style={{height: 80, width: 80, alignSelf: 'center'}}/>
</TouchableOpacity>
)
}
Expand Down
1 change: 1 addition & 0 deletions EEG101/src/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export default {
trainSamples: 'samples',
trainStop: 'STOP',
trainCollect: 'COLLECT',
trainCollectMore: 'COLLECT MORE (OPTIONAL)',
trainOn: 'ON',
trainOff: 'OFF',
trainFitClassifier: 'FIT CLASSIFIER',
Expand Down
5 changes: 2 additions & 3 deletions EEG101/src/redux/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ export default function reducer(state = initialState, action = {}) {
};

case SET_AVAILABLE_MUSES:
console.log(JSON.stringify(action.payload));
return {
...state,
availableMuses: action.payload,
};

case SET_MUSE_INFO:
console.log(JSON.stringify(action.payload));
return {
...state,
museInfo: action.payload
Expand All @@ -60,7 +58,8 @@ export default function reducer(state = initialState, action = {}) {
case SET_OFFLINE_MODE:
return {
...state,
isOfflineMode: action.payload
isOfflineMode: action.payload,
connectionStatus: config.connectionStatus.NO_MUSES
};

case SET_MENU:
Expand Down
12 changes: 12 additions & 0 deletions EEG101/src/scenes/bci-01.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { Component } from "react";
import { StyleSheet, Text, View, ViewPagerAndroid, Image } from "react-native";
import { connect } from "react-redux";
import { MediaQueryStyleSheet } from "react-native-responsive";
import config from "../redux/config";
import I18n from "../i18n/i18n";
import LinkButton from "../components/LinkButton";
import PopUp from "../components/PopUp";
Expand All @@ -13,6 +14,7 @@ import * as colors from "../styles/colors";

function mapStateToProps(state) {
return {
connectionStatus: state.connectionStatus,
dimensions: state.graphViewDimensions,
isOfflineMode: state.isOfflineMode
};
Expand Down Expand Up @@ -83,6 +85,16 @@ class BCIOne extends Component {
title={I18n.t('machineLearningTitle')}
> {I18n.t('machineLearningDefinition')} </PopUp>

<PopUp
onClose={()=>this.props.history.push('/connectorOne')}
visible={
this.props.connectionStatus === config.connectionStatus.DISCONNECTED
}
title={I18n.t('museDisconnectedTitle')}
>
{I18n.t('museDisconnectedDescription')}
</PopUp>

</View>
);
}
Expand Down
11 changes: 11 additions & 0 deletions EEG101/src/scenes/bci-02.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import * as colors from "../styles/colors";

function mapStateToProps(state) {
return {
connectionStatus: state.connectionStatus,
dimensions: state.graphViewDimensions,
bciAction: state.bciAction
};
Expand Down Expand Up @@ -171,6 +172,16 @@ class BCITwo extends Component {
</View>
</View>
</ViewPagerAndroid>

<PopUp
onClose={()=>this.props.history.push('/connectorOne')}
visible={
this.props.connectionStatus === config.connectionStatus.DISCONNECTED
}
title={I18n.t('museDisconnectedTitle')}
>
{I18n.t('museDisconnectedDescription')}
</PopUp>
</View>
);
}
Expand Down
12 changes: 11 additions & 1 deletion EEG101/src/scenes/bci-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import * as colors from "../styles/colors";

function mapStateToProps(state) {
return {
connectionStatus: state.connectionStatus,
dimensions: state.graphViewDimensions,
bciAction: state.bciAction
};
Expand All @@ -40,7 +41,7 @@ class ClassifierRun extends Component {
// Initialize States
this.state = {
popUp1Visible: false,
data: [1,1,1],
data: new Array(30).fill(1),
noise: [],
isRunning: false,
};
Expand Down Expand Up @@ -153,6 +154,15 @@ class ClassifierRun extends Component {
</View>
</View>
</ViewPagerAndroid>
<PopUp
onClose={()=>this.props.history.push('/connectorOne')}
visible={
this.props.connectionStatus === config.connectionStatus.DISCONNECTED
}
title={I18n.t('museDisconnectedTitle')}
>
{I18n.t('museDisconnectedDescription')}
</PopUp>
</View>
);
}
Expand Down
15 changes: 13 additions & 2 deletions EEG101/src/scenes/bci-train.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { setBCIAction } from "../redux/actions";
import config from "../redux/config.js";
import { MediaQueryStyleSheet } from "react-native-responsive";
import Classifier from "../interface/Classifier.js";
import PopUp from "../components/PopUp";
import DecisionButton from "../components/DecisionButton.js";
import SandboxButton from "../components/SandboxButton.js";
import Button from "../components/Button.js";
Expand All @@ -25,6 +26,7 @@ import * as colors from "../styles/colors";

function mapStateToProps(state) {
return {
connectionStatus: state.connectionStatus,
bciAction: state.bciAction,
dimensions: state.graphViewDimensions
};
Expand Down Expand Up @@ -197,7 +199,7 @@ class BCITrain extends Component {
<View style={styles.classifierDataContainer}>
<View style={styles.classifierTextContainer}>
<Text style={styles.body}>
{I18n.t("trainAccuracy")}:{" "}
{I18n.t("trainAccuracy")}:{"\n"}
{Math.round(this.state.score * 1000) / 1000}
</Text>
<SandboxButton
Expand All @@ -216,7 +218,7 @@ class BCITrain extends Component {
>
{I18n.t("trainReFit")}
</SandboxButton>
<SandboxButton onPress={()=>Classifier.exportClassifier()}>EXPORT CLASSIFIER</SandboxButton>
<SandboxButton active="true" onPress={()=>Classifier.exportClassifier()}>EXPORT</SandboxButton>
</View>
<View style={styles.classifierGraphContainer}>
<MiniChart
Expand Down Expand Up @@ -305,6 +307,15 @@ class BCITrain extends Component {
</Button>
</View>
</View>
<PopUp
onClose={()=>this.props.history.push('/connectorOne')}
visible={
this.props.connectionStatus === config.connectionStatus.DISCONNECTED
}
title={I18n.t('museDisconnectedTitle')}
>
{I18n.t('museDisconnectedDescription')}
</PopUp>
</View>
);
}
Expand Down
Loading

0 comments on commit 9e465cd

Please sign in to comment.