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

Preprocessing #10

wants to merge 11 commits into from

Conversation

devyansh
Copy link
Collaborator

No description provided.

@devyansh devyansh requested review from minneker and saketh-n May 12, 2021 06:04


#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.



#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.

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.

},
"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.

@@ -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.

2 plots for each Channel: one for RAW Data and other is Spectral Power Density

PlotAllChannels plots and saves the images as well


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

Choose a reason for hiding this comment

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

I guess it's fine for now, but when I integrate with front end I want to pull this filename from the api call instead of hardcoded



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

Choose a reason for hiding this comment

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

Idk if this would be necessary if filename passed through api call

load_path = 'C:/Users/User/Desktop/CSE 481C - Neruo Capstone/Project Repo/Data/TUH/00003010_s003_t000.edf'
filename = '00003010_s003_t000'
fileformat = '.edf'
load_path = 'C:/Users/User/Desktop/CSE 481C - Neruo Capstone/Project Repo/Data/TUH/' + filename + fileformat
Copy link
Owner

Choose a reason for hiding this comment

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

In general relative paths are preferred, but passing in filename should make this a non-issue. When web-hosting this will be a more interesting problem. We should try to have pre-processing code run on the front end

load_path = 'C:/Users/User/Desktop/CSE 481C - Neruo Capstone/Project Repo/Data/TUH/00003010_s003_t000.edf'
filename = '00003010_s003_t000'
fileformat = '.edf'
load_path = 'C:/Users/User/Desktop/CSE 481C - Neruo Capstone/Project Repo/Data/TUH/' + filename + fileformat
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

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

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

#Make a directory
directory = filename + '_allChannels'
parent_path = 'C:/Users/User/Desktop/CSE 481C - Neruo Capstone/Project Repo/Data/GeneratedPlots/'
Copy link
Owner

Choose a reason for hiding this comment

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

Nice! once again relative paths, maybe something like os.pwd()

#Plotting begins!
#Raw data
raw.plot(duration=100, block=True)
plt.show()
#todo: instead of scrolly image, get a static image
Copy link
Owner

Choose a reason for hiding this comment

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

If we get this running on the front end, we might not even need to save anything! Tricky problem though since browser only runs js/css/html



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

Choose a reason for hiding this comment

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

Same note as above, relative paths + filename either passed in, or raw data is


#Make a directory
directory = filename
parent_path = 'C:/Users/User/Desktop/CSE 481C - Neruo Capstone/Project Repo/Data/GeneratedPlots/'
Copy link
Owner

Choose a reason for hiding this comment

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

relative path

devyansh added 2 commits May 18, 2021 06:19
Plots RAW data of all channels in an interactive GUI
@@ -0,0 +1,69 @@
import os
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code is largely taken from: https://mne.tools/mne-realtime/_modules/mne/epochs.html.

Please make sure to cite any code you copy-paste.

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Collaborator

Choose a reason for hiding this comment

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

All of these .idea files are not necessary. They help render the project in your local IDE. Please remove any .idea/ files. We should add this to .gitignore to avoid in future pushes.

@@ -0,0 +1,69 @@
import os
import mne
import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also this code seems to already exists in the MNE package. Why are we writing it locally instead of calling it from the package?

devyansh added 4 commits June 1, 2021 03:31
RAW of all channels
TFR of all channels
SPD of all channels
also changed the relative path of parent_path
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.

3 participants