diff --git a/src/components/PageSwitcher/PageSwitcher.js b/src/components/PageSwitcher/PageSwitcher.js
index c0ab424..28bb64e 100644
--- a/src/components/PageSwitcher/PageSwitcher.js
+++ b/src/components/PageSwitcher/PageSwitcher.js
@@ -63,7 +63,7 @@ export function PageSwitcher() {
// pipe settings
const [introSettings] = useState(funIntro.getSettings);
const [heartRawSettings] = useState(funHeartRaw.getSettings);
- const [heartSpectraSettings] = useState(funHeartSpectra.getSettings);
+ const [heartSpectraSettings, setHeartSpectraSettings] = useState(funHeartSpectra.getSettings);
const [rawSettings, setRawSettings] = useState(funRaw.getSettings);
const [spectraSettings, setSpectraSettings] = useState(funSpectra.getSettings);
const [bandsSettings, setBandsSettings] = useState(funBands.getSettings);
@@ -71,7 +71,7 @@ export function PageSwitcher() {
const [spectroSettings, setSpectroSettings] = useState(funSpectro.getSettings);
const [alphaSettings, setAlphaSettings] = useState(funAlpha.getSettings);
const [ssvepSettings, setSsvepSettings] = useState(funSsvep.getSettings);
- const [evokedSettings] = useState(funEvoked.getSettings);
+ const [evokedSettings, setEvokedSettings] = useState(funEvoked.getSettings);
const [predictSettings, setPredictSettings] = useState(funPredict.getSettings);
// connection status
@@ -349,19 +349,19 @@ export function PageSwitcher() {
return null
case heartSpectra:
return (
- funHeartSpectra.renderRecord(recordPopChange, recordPop, status, heartSpectraSettings)
+ funHeartSpectra.renderRecord(recordPopChange, recordPop, status, heartSpectraSettings, setHeartSpectraSettings)
)
case raw:
return (
- funRaw.renderRecord(recordPopChange, recordPop, status, rawSettings)
+ funRaw.renderRecord(recordPopChange, recordPop, status, rawSettings, setRawSettings)
)
case spectra:
return (
- funSpectra.renderRecord(recordPopChange, recordPop, status, spectraSettings)
+ funSpectra.renderRecord(recordPopChange, recordPop, status, spectraSettings, setSpectraSettings)
)
case bands:
return (
- funBands.renderRecord(recordPopChange, recordPop, status, bandsSettings)
+ funBands.renderRecord(recordPopChange, recordPop, status, bandsSettings, setBandsSettings)
)
case animate:
return null
@@ -369,15 +369,15 @@ export function PageSwitcher() {
return null
case alpha:
return (
- funAlpha.renderRecord(recordPopChange, recordPop, status, alphaSettings, recordTwoPopChange, recordTwoPop)
+ funAlpha.renderRecord(recordPopChange, recordPop, status, alphaSettings, recordTwoPopChange, recordTwoPop, setAlphaSettings)
)
case ssvep:
return (
- funSsvep.renderRecord(recordPopChange, recordPop, status, ssvepSettings, recordTwoPopChange, recordTwoPop)
+ funSsvep.renderRecord(recordPopChange, recordPop, status, ssvepSettings, recordTwoPopChange, recordTwoPop, setSsvepSettings)
)
case evoked:
return (
- funEvoked.renderRecord(recordPopChange, recordPop, status, evokedSettings)
+ funEvoked.renderRecord(recordPopChange, recordPop, status, evokedSettings, setEvokedSettings)
)
case predict:
return (
diff --git a/src/components/PageSwitcher/components/EEGEduAlpha/EEGEduAlpha.js b/src/components/PageSwitcher/components/EEGEduAlpha/EEGEduAlpha.js
index 85bd4d9..4204852 100644
--- a/src/components/PageSwitcher/components/EEGEduAlpha/EEGEduAlpha.js
+++ b/src/components/PageSwitcher/components/EEGEduAlpha/EEGEduAlpha.js
@@ -3,8 +3,8 @@ import { catchError, multicast } from "rxjs/operators";
import { TextContainer, Card, Stack, RangeSlider, Button, ButtonGroup, Modal } from "@shopify/polaris";
import { saveAs } from 'file-saver';
-import { take } from "rxjs/operators";
-import { Subject } from "rxjs";
+import { take, takeUntil } from "rxjs/operators";
+import { Subject, timer } from "rxjs";
import { channelNames } from "muse-js";
import { Line } from "react-chartjs-2";
@@ -36,7 +36,8 @@ export function getSettings() {
sliceFFTHigh: 30,
duration: 1024,
srate: 256,
- name: 'Alpha'
+ name: 'Alpha',
+ secondsToSave: 10
}
};
@@ -247,10 +248,23 @@ export function renderSliders(setData, setSettings, status, Settings) {
)
}
-export function renderRecord(recordPopChange, recordPop, status, Settings, recordTwoPopChange, recordTwoPop) {
+export function renderRecord(recordPopChange, recordPop, status, Settings, recordTwoPopChange, recordTwoPop, setSettings) {
+
+ function handleSecondsToSaveRangeSliderChange(value) {
+ setSettings(prevState => ({...prevState, secondsToSave: value}));
+ }
+
return(
+
+
{
@@ -235,8 +249,7 @@ export function renderRecord(recordPopChange, recordPop, status, Settings) {
}
function saveToCSV(Settings) {
- const numSamplesToSave = 10000;
- console.log('Saving ' + numSamplesToSave + ' samples...');
+ console.log('Saving ' + Settings.secondsToSave + ' seconds...');
var localObservable$ = null;
const dataToSave = [];
window.marker = 0;
@@ -268,9 +281,13 @@ function saveToCSV(Settings) {
);
}
});
+
+ //create timer
+ const timer$ = timer(Settings.secondsToSave * 1000)
+
// put selected observable object into local and start taking samples
localObservable$ = window.multicastEvoked$.pipe(
- take(numSamplesToSave)
+ takeUntil(timer$)
);
// now with header in place subscribe to each epoch and log it
diff --git a/src/components/PageSwitcher/components/EEGEduEvoked/sketchEvoked.js b/src/components/PageSwitcher/components/EEGEduEvoked/sketchEvoked.js
index 457156d..699faea 100644
--- a/src/components/PageSwitcher/components/EEGEduEvoked/sketchEvoked.js
+++ b/src/components/PageSwitcher/components/EEGEduEvoked/sketchEvoked.js
@@ -1,8 +1,8 @@
export default function sketchEvoked (p) {
+ const targProp = 0.2;
let x = 0;
let thisRand = 0.5; //for random choice of target type
- let targProp = 0.25;
let isTarget = false;
diff --git a/src/components/PageSwitcher/components/EEGEduHeartSpectra/EEGEduHeartSpectra.js b/src/components/PageSwitcher/components/EEGEduHeartSpectra/EEGEduHeartSpectra.js
index 386ccb5..3c8e3c1 100644
--- a/src/components/PageSwitcher/components/EEGEduHeartSpectra/EEGEduHeartSpectra.js
+++ b/src/components/PageSwitcher/components/EEGEduHeartSpectra/EEGEduHeartSpectra.js
@@ -3,8 +3,8 @@ import { catchError, multicast } from "rxjs/operators";
import { TextContainer, Card, Stack, RangeSlider, Button, ButtonGroup, Modal } from "@shopify/polaris";
import { saveAs } from 'file-saver';
-import { take } from "rxjs/operators";
-import { Subject } from "rxjs";
+import { takeUntil } from "rxjs/operators";
+import { Subject, timer } from "rxjs";
import { channelNames } from "muse-js";
import { Line } from "react-chartjs-2";
@@ -33,7 +33,8 @@ export function getSettings() {
sliceFFTHigh: 2,
duration: 4096,
srate: 256,
- name: 'HeartSpectra'
+ name: 'HeartSpectra',
+ secondsToSave: 10
}
};
@@ -239,10 +240,24 @@ export function renderSliders(setData, setSettings, status, Settings) {
)
}
-export function renderRecord(recordPopChange, recordPop, status, Settings) {
+export function renderRecord(recordPopChange, recordPop, status, Settings, setSettings) {
+
+ function handleSecondsToSaveRangeSliderChange(value) {
+ setSettings(prevState => ({...prevState, secondsToSave: value}));
+ }
+
+
return(
+
{
@@ -278,8 +293,7 @@ export function renderRecord(recordPopChange, recordPop, status, Settings) {
function saveToCSV(Settings) {
- const numSamplesToSave = 100;
- console.log('Saving ' + numSamplesToSave + ' samples...');
+ console.log('Saving ' + Settings.secondsToSave + ' seconds...');
var localObservable$ = null;
const dataToSave = [];
@@ -291,9 +305,12 @@ function saveToCSV(Settings) {
"\n"
);
+ // Create timer
+ const timer$ = timer(Settings.secondsToSave * 1000);
+
// put selected observable object into local and start taking samples
localObservable$ = window.multicastHeartSpectra$.pipe(
- take(numSamplesToSave)
+ takeUntil(timer$)
);
// now with header in place subscribe to each epoch and log it
diff --git a/src/components/PageSwitcher/components/EEGEduRaw/EEGEduRaw.js b/src/components/PageSwitcher/components/EEGEduRaw/EEGEduRaw.js
index 235e702..c4d6948 100644
--- a/src/components/PageSwitcher/components/EEGEduRaw/EEGEduRaw.js
+++ b/src/components/PageSwitcher/components/EEGEduRaw/EEGEduRaw.js
@@ -1,10 +1,10 @@
import React from "react";
import { catchError, multicast } from "rxjs/operators";
-import { Subject } from "rxjs";
+import { Subject, timer } from "rxjs";
import { TextContainer, Card, Stack, RangeSlider, Button, ButtonGroup, Modal } from "@shopify/polaris";
import { saveAs } from 'file-saver';
-import { take } from "rxjs/operators";
+import { take, takeUntil } from "rxjs/operators";
import { channelNames } from "muse-js";
import { Line } from "react-chartjs-2";
@@ -30,7 +30,8 @@ export function getSettings () {
interval: 50,
srate: 256,
duration: 1024,
- name: 'Raw'
+ name: 'Raw',
+ secondsToSave: 10
}
};
@@ -191,14 +192,14 @@ export function renderSliders(setData, setSettings, status, Settings) {
({...prevState, secondsToSave: value}));
+ }
+
return (
@@ -233,6 +239,14 @@ export function renderRecord(recordPopChange, recordPop, status, Settings) {
+
{
@@ -270,17 +284,17 @@ export function renderRecord(recordPopChange, recordPop, status, Settings) {
function saveToCSV(Settings) {
- const numSamplesToSave = 50;
- console.log('Saving ' + numSamplesToSave + ' samples...');
+ console.log('Saving ' + Settings.secondsToSave + ' seconds...');
var localObservable$ = null;
const dataToSave = [];
console.log('making ' + Settings.name + ' headers')
+
// for each module subscribe to multicast and make header
// take one sample from selected observable object for headers
localObservable$ = window.multicastRaw$.pipe(
- take(1)
+ take(1)
);
//take one sample to get header info
localObservable$.subscribe({
@@ -297,9 +311,13 @@ function saveToCSV(Settings) {
);
}
});
+
+ // Create timer
+ const timer$ = timer(Settings.secondsToSave * 1000);
+
// put selected observable object into local and start taking samples
localObservable$ = window.multicastRaw$.pipe(
- take(numSamplesToSave)
+ takeUntil(timer$)
);
// now with header in place subscribe to each epoch and log it
diff --git a/src/components/PageSwitcher/components/EEGEduSpectra/EEGEduSpectra.js b/src/components/PageSwitcher/components/EEGEduSpectra/EEGEduSpectra.js
index 09535f9..f4c9899 100644
--- a/src/components/PageSwitcher/components/EEGEduSpectra/EEGEduSpectra.js
+++ b/src/components/PageSwitcher/components/EEGEduSpectra/EEGEduSpectra.js
@@ -3,8 +3,8 @@ import { catchError, multicast } from "rxjs/operators";
import { TextContainer, Card, Stack, RangeSlider, Button, ButtonGroup, Modal } from "@shopify/polaris";
import { saveAs } from 'file-saver';
-import { take } from "rxjs/operators";
-import { Subject } from "rxjs";
+import { take, takeUntil } from "rxjs/operators";
+import { Subject, timer } from "rxjs";
import { channelNames } from "muse-js";
import { Line } from "react-chartjs-2";
@@ -33,7 +33,9 @@ export function getSettings() {
sliceFFTHigh: 30,
duration: 1024,
srate: 256,
- name: 'Spectra'
+ name: 'Spectra',
+ secondsToSave: 10
+
}
};
@@ -244,10 +246,23 @@ export function renderSliders(setData, setSettings, status, Settings) {
)
}
-export function renderRecord(recordPopChange, recordPop, status, Settings) {
+export function renderRecord(recordPopChange, recordPop, status, Settings, setSettings) {
+
+ function handleSecondsToSaveRangeSliderChange(value) {
+ setSettings(prevState => ({...prevState, secondsToSave: value}));
+ }
+
return(
+
{
@@ -283,8 +298,7 @@ export function renderRecord(recordPopChange, recordPop, status, Settings) {
function saveToCSV(Settings) {
- const numSamplesToSave = 50;
- console.log('Saving ' + numSamplesToSave + ' samples...');
+ console.log('Saving ' + Settings.secondsToSave + ' seconds...');
var localObservable$ = null;
const dataToSave = [];
@@ -311,9 +325,13 @@ function saveToCSV(Settings) {
);
}
});
+
+ // Create timer
+ const timer$ = timer(Settings.secondsToSave * 1000);
+
// put selected observable object into local and start taking samples
localObservable$ = window.multicastSpectra$.pipe(
- take(numSamplesToSave)
+ takeUntil(timer$)
);
diff --git a/src/components/PageSwitcher/components/EEGEduSsvep/EEGEduSsvep.js b/src/components/PageSwitcher/components/EEGEduSsvep/EEGEduSsvep.js
index cfc29a1..053ba5d 100644
--- a/src/components/PageSwitcher/components/EEGEduSsvep/EEGEduSsvep.js
+++ b/src/components/PageSwitcher/components/EEGEduSsvep/EEGEduSsvep.js
@@ -3,8 +3,8 @@ import { catchError, multicast } from "rxjs/operators";
import { TextContainer, Card, Stack, RangeSlider, Button, ButtonGroup, Modal } from "@shopify/polaris";
import { saveAs } from 'file-saver';
-import { take } from "rxjs/operators";
-import { Subject } from "rxjs";
+import { take, takeUntil } from "rxjs/operators";
+import { Subject, timer } from "rxjs";
import { channelNames } from "muse-js";
import { Line } from "react-chartjs-2";
@@ -37,7 +37,8 @@ export function getSettings() {
sliceFFTHigh: 30,
duration: 1024,
srate: 256,
- name: 'Ssvep'
+ name: 'Ssvep',
+ secondsToSave: 10
}
};
@@ -248,14 +249,25 @@ export function renderSliders(setData, setSettings, status, Settings) {
)
}
-export function renderRecord(recordPopChange, recordPop, status, Settings, recordTwoPopChange, recordTwoPop) {
- const cond1 = "11Hz";
- const cond2 = "14Hz";
+export function renderRecord(recordPopChange, recordPop, status, Settings, recordTwoPopChange, recordTwoPop, setSettings) {
+ const cond1 = "Slow Frequency";
+ const cond2 = "Fast Frequency";
+
+ function handleSecondsToSaveRangeSliderChange(value) {
+ setSettings(prevState => ({...prevState, secondsToSave: value}));
+ }
return(
-
+
{
@@ -327,8 +339,7 @@ export function renderRecord(recordPopChange, recordPop, status, Settings, recor
function saveToCSV(Settings, condition) {
- const numSamplesToSave = 50;
- console.log('Saving ' + numSamplesToSave + ' samples...');
+ console.log('Saving ' + Settings.secondsToSave + ' seconds...');
var localObservable$ = null;
const dataToSave = [];
@@ -355,9 +366,13 @@ function saveToCSV(Settings, condition) {
);
}
});
+
+ //create timer
+ const timer$ = timer(Settings.secondsToSave * 1000);
+
// put selected observable object into local and start taking samples
localObservable$ = window.multicastSsvep$.pipe(
- take(numSamplesToSave)
+ takeUntil(timer$)
);