Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ready to deploy] Auxillary channel toggle #116

Merged
merged 2 commits into from
Jan 7, 2020
Merged

[ready to deploy] Auxillary channel toggle #116

merged 2 commits into from
Jan 7, 2020

Conversation

kylemath
Copy link
Owner

@kylemath kylemath commented Jan 6, 2020

Adding a checkbox toggle beside the connect buttons for some of the modules. This will turn on or off the subscription in muse-js to the aux, it alters the number of fake channels sent by mockMuseEEG, it alters the processing through neurosity pipes to send an extra channel through, and it plots the aux channel or not.

if toggle is enabled, it saves aux data into csv, if not, then it keeps current functionality of NaNs

added to bands, spectra, heart rate modules, ssvep, evoked, and open/closed,
any that don't use just a single preselected channel (like animation, bci, intro)

…eds it, and toggles to plot and save the aux or not
@kylemath kylemath requested a review from korymath January 6, 2020 21:54
@@ -35,18 +35,29 @@ const predict = translations.types.predict;

export function PageSwitcher() {

// For auxEnable settings
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic to control aux at very high level since it needs to happen before connect and only show toggle in certain modules

const handleChange = useCallback((newChecked) => setChecked(newChecked), []);
window.enableAux = checked;
if (window.enableAux) {
window.nchans = 5;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for loops and settings

// For auxEnable settings
const [checked, setChecked] = useState(false);
const handleChange = useCallback((newChecked) => setChecked(newChecked), []);
window.enableAux = checked;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boolean

} else {
window.nchans = 4;
}
let showAux = true; // if it is even available to press (to prevent in some modules)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bollean for option being there or not

const [rawData, setRawData] = useState(emptyChannelData);
const [spectraData, setSpectraData] = useState(emptyChannelData);
const [bandsData, setBandsData] = useState(emptyChannelData);
const [rawData, setRawData] = useState(emptyAuxChannelData);
Copy link
Owner Author

@kylemath kylemath Jan 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these all use a different prototype with 5 channels, but that still works and they are ok with no aux channel as well

@@ -98,6 +109,48 @@ export function PageSwitcher() {
const [recordTwoPop, setRecordTwoPop] = useState(false);
const recordTwoPopChange = useCallback(() => setRecordTwoPop(!recordTwoPop), [recordTwoPop]);

switch (selected) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to control if the toggle itself is is active at all

@@ -188,6 +241,7 @@ export function PageSwitcher() {
// Connect with the Muse EEG Client
setStatus(generalTranslations.connecting);
window.source = new MuseClient();
window.source.enableAux = window.enableAux;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to get extra channel from muse-js

@@ -256,7 +310,7 @@ export function PageSwitcher() {
}
}

function renderCharts() {
function renderModules() {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name fix unrelated to this pr

label="Enable Muse Auxillary Channel"
checked={checked}
onChange={handleChange}
disabled={!showAux || status !== generalTranslations.connect}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toggle beside buttons

@@ -1,3 +1,5 @@
import { customCount } from './chartUtils'
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this now exports 4 or 5 channels depending on settings

@kylemath kylemath merged commit 5e4de04 into master Jan 7, 2020
@kylemath kylemath deleted the aux2 branch January 7, 2020 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant