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

Preprocessing #10

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Pre-processing/PlotAllChannels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import numpy as np
import matplotlib.pyplot as plt
from mne.io import concatenate_raws, read_raw_edf


#Load Data
load_path = 'C:/Users/User/Desktop/CSE 481C - Neruo Capstone/Project Repo/Data/TUH/00003010_s003_t000.edf'
Copy link
Collaborator

Choose a reason for hiding this comment

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

local path needs to change, won't work on another computer.

print(load_path)
Copy link
Owner

Choose a reason for hiding this comment

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

We should remove debugging code when we integrate w master

raw = read_raw_edf(load_path, preload=True)

#Inspect the .edf file
print(raw.info)

#Plotting begins!
#Raw data
raw.plot(duration=100, block=True)
plt.show()

#Power spectrum
raw.plot_psd(tmax=np.inf)
plt.show()
44 changes: 44 additions & 0 deletions Pre-processing/PlotOneChannel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import numpy as np
import matplotlib.pyplot as plt
from mne.io import concatenate_raws, read_raw_edf


#Load Data
load_path = 'C:/Users/User/Desktop/CSE 481C - Neruo Capstone/Project Repo/Data/TUH/00003010_s003_t000.edf'
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, need to point to file not an absolute path.

print(load_path)
raw = read_raw_edf(load_path, preload=True)

#Inspect the .edf file
print(raw.info['ch_names'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to inspect the file when running? Or are these just for debugging? If the latter, I think we can remove all inspection print statements.

ch_name = raw.info['ch_names']
print("Total Channels: ", len(ch_name))

#Select the required Channel
#requiredChannel = ch_name[1]
#raw.pick(requiredChannel)

#Plotting begins!
#Raw data
#raw.plot()
#plt.show()


#Better plot of one channel
data, times = raw[1:2, :]
fig = plt.subplots(figsize=(10,8))
plt.plot(times, data.T);
plt.xlabel('Seconds')
plt.ylabel('$\mu V$')
plt.title('Channels: 1-5');
plt.legend(raw.ch_names[1:2]);
plt.show()

requiredChannel = ch_name[1]
raw.pick(requiredChannel)


#Power spectrum
raw.plot_psd(tmax=np.inf)
plt.show()


9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"postcss": "^8.2.9",
"postcss": "^8.2.12",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
"react-scripts": "^4.0.3",
"web-vitals": "^1.0.1",
"yarn": "^1.22.10"
},
"scripts": {
"build:css": "postcss src/styles/tailwind.css -o src/styles/app.css",
"watch:css": "postcss src/styles/tailwind.css -o src/styles/app.css --watch",
"react-scripts:start": "sleep 5 && react-scripts start",
"react-scripts:start": "timeout 5 && react-scripts start",
Copy link
Collaborator

Choose a reason for hiding this comment

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

windows specific changes should be handled dynamically and not hardcoded. We should think about this carefully before merging to master.

Copy link
Owner

Choose a reason for hiding this comment

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

agreed.

"start": "run-p watch:css react-scripts:start",
"start-api": "cd api && venv/bin/flask run --no-debugger",
"build": "run-s build:css react-scripts:build",
Expand Down
15 changes: 7 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"resolved" "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.13.tgz"
"version" "7.13.13"
dependencies:
"@babel/compat-data" "^7.13.12"
"@babel/compat-data" "^7.13.15"
Copy link
Collaborator

Choose a reason for hiding this comment

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

same with these changes. We should probably have an OS-specific switch that determines the correct versions here.

"@babel/helper-validator-option" "^7.12.17"
"browserslist" "^4.14.5"
"semver" "^6.3.0"
Expand Down Expand Up @@ -237,8 +237,8 @@
"resolved" "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.13.0.tgz"
"version" "7.13.0"
dependencies:
"@babel/traverse" "^7.13.0"
"@babel/types" "^7.13.0"
"@babel/traverse" "^7.13.15"
"@babel/types" "^7.13.16"

"@babel/helper-member-expression-to-functions@^7.13.0", "@babel/helper-member-expression-to-functions@^7.13.12":
"integrity" "sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw=="
Expand Down Expand Up @@ -836,7 +836,7 @@
"resolved" "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.13.tgz"
"version" "7.12.13"
dependencies:
"@babel/helper-plugin-utils" "^7.12.13"
"@babel/helper-plugin-utils" "^7.13.0"

"@babel/plugin-transform-classes@^7.12.1", "@babel/plugin-transform-classes@^7.13.0":
"integrity" "sha512-9BtHCPUARyVH1oXGcSJD3YpsqRLROJx5ZNP6tN5vnk17N0SVf9WCtf8Nuh1CFmgByKKAIMstitKduoCmsaDK5g=="
Expand Down Expand Up @@ -1443,7 +1443,7 @@
"version" "7.13.15"
dependencies:
"@babel/code-frame" "^7.12.13"
"@babel/generator" "^7.13.9"
"@babel/generator" "^7.13.16"
"@babel/helper-function-name" "^7.12.13"
"@babel/helper-split-export-declaration" "^7.12.13"
"@babel/parser" "^7.13.15"
Expand Down Expand Up @@ -2092,7 +2092,6 @@
"resolved" "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz"
"version" "7.1.1"
dependencies:
"@types/events" "*"
"@types/minimatch" "*"
"@types/node" "*"

Expand Down Expand Up @@ -2306,8 +2305,8 @@
"resolved" "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.21.0.tgz"
"version" "4.21.0"
dependencies:
"@typescript-eslint/types" "4.21.0"
"@typescript-eslint/visitor-keys" "4.21.0"
"@typescript-eslint/types" "4.22.0"
"@typescript-eslint/visitor-keys" "4.22.0"

"@typescript-eslint/[email protected]":
"integrity" "sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ=="
Expand Down