Structure
This commit is contained in:
		
							parent
							
								
									1480bf60ca
								
							
						
					
					
						commit
						5fcf60921c
					
				
					 24 changed files with 38 additions and 23 deletions
				
			
		|  | @ -5,8 +5,8 @@ Created on Tue Nov 23 11:11:41 2021 | |||
| 
 | ||||
| @author: adamr | ||||
| """ | ||||
| import NeurOne | ||||
| import RDA | ||||
| from connection import NeurOne, RDA | ||||
| # import RDA | ||||
| 
 | ||||
| import time | ||||
| import matplotlib | ||||
|  | @ -21,16 +21,16 @@ import matplotlib.cm as cm | |||
| import PyQt5.uic as uic | ||||
| import pandas as pd | ||||
| import json | ||||
| #import scipy.stats as st | ||||
| import scipy.stats as st | ||||
| import csv | ||||
| import datetime | ||||
| import ctypes | ||||
| import scipy  | ||||
| import pywt | ||||
| import queue | ||||
| # import queue | ||||
| 
 | ||||
| from cycler import cycler | ||||
| from matplotlib.backend_bases import MouseButton | ||||
| # from matplotlib.backend_bases import MouseButton | ||||
| from PyQt5.QtCore import QTimer, Qt | ||||
| from PyQt5.QtGui import QImage, QPixmap, QIcon, QFont | ||||
| from PyQt5.QtWidgets import (QMainWindow, QFileDialog, QMessageBox, QCheckBox, QLineEdit, QWidget, QPushButton, | ||||
|  | @ -46,9 +46,9 @@ if sys.platform=='darwin': | |||
|     #from multiprocessing import Queue as QueueOld #Queue doesn't work on MacOS | ||||
| else: | ||||
|     from multiprocessing import Process, Queue, Value | ||||
| from Waiting import Waiting_window | ||||
| from FirstWindow import First_window | ||||
| from Functions import (apply_montage, eye_reg, most_frequent, connect_sig, set_to_gray, update_stem,  | ||||
| from utils.Waiting import Waiting_window | ||||
| from utils.FirstWindow import First_window | ||||
| from utils.Functions import (apply_montage, eye_reg, most_frequent, connect_sig, set_to_gray, update_stem,  | ||||
|                        adjust_hist, min_zero, pentropy, entropy, check_integrity, doubleMADsfromMedian) | ||||
|          | ||||
| if sys.platform=='darwin': | ||||
|  | @ -215,7 +215,7 @@ def acquire_data(q, size, run, speed, downsample, sleep_time, ip = '192.168.200. | |||
|     run: Value class from multiprocessing library. That value can be changed in main process | ||||
|     downsample: boolean value. Says if data will be downsampled to 1000 Hz | ||||
|     sleep_time: int, set how often function should refresh. Usually it takes a bit more that that""" | ||||
|     # offline = 'offline' | ||||
|     offline = 'offline' | ||||
|     #import NeurOne_v3 | ||||
|     if offline=="offline": | ||||
|         NO = NeurOneOffline() | ||||
|  | @ -385,7 +385,7 @@ class AppForm(QMainWindow): | |||
|          | ||||
|         #montage matrix is a matrix that is multiplied with the signal | ||||
|         #identity matrix multiply all channels by 1, so we have the same signal as an output | ||||
|         settings_file = pd.read_csv('TMS_protocol.txt',sep=':', header=None) #read file with settings | ||||
|         settings_file = pd.read_csv('settings/TMS_protocol.txt',sep=':', header=None) #read file with settings | ||||
|         print(restarted) | ||||
|         #open the file to save values during the experiment | ||||
|         self.log_file = open('logs//TMS_log_'+str(f"{datetime.datetime.now():%Y-%m-%d-%H-%M}"+restarted+'.csv'), 'w') | ||||
|  | @ -396,7 +396,7 @@ class AppForm(QMainWindow): | |||
|         self.size_of_up = 2*self.Fs #5000 how much data we get from NeurOne function | ||||
|          | ||||
|         #file with settings and assigning variables to them | ||||
|         settings_file = pd.read_csv('TMS_protocol.txt',sep=':', header=None) | ||||
|         # settings_file = pd.read_csv('settings/TMS_protocol.txt',sep=':', header=None) | ||||
|          | ||||
|         #params can be set in GUI, so then no need for using ones from the file | ||||
|         if passed_params is not None: | ||||
|  | @ -470,7 +470,7 @@ class AppForm(QMainWindow): | |||
|         print(self.included_ch) | ||||
|         # self.montage_matrix = np.identity(self.num_of_ch) | ||||
|         if self.montage_file_path in [None, '']: | ||||
|             self.montage_file_path = 'montage_18ch.csv' | ||||
|             self.montage_file_path = 'settings/montage_18ch.csv' | ||||
|         self.montage_matrix = np.array(pd.read_csv(self.montage_file_path, header=None)) | ||||
|          | ||||
|              | ||||
|  | @ -743,7 +743,7 @@ class AppForm(QMainWindow): | |||
|             self.timer.setInterval(int(self.speed_general*1.03)) | ||||
|              | ||||
|         times = time.time() | ||||
|         # self.offline='offline' #remove this! | ||||
|         self.offline='offline' #remove this! | ||||
|         if self.offline=="offline": | ||||
|             incl = [0,2,6,7,8,10,13,16,18,22,25,28,31,34,41,43,-3,-2,-1] # For offline only | ||||
|             loaded_temp = self.q.get()[incl]/10 # Load data | ||||
|  | @ -1359,7 +1359,7 @@ class Ui(QMainWindow): | |||
|     def __init__(self, main_file): | ||||
|         self.main_file = main_file | ||||
|         super(Ui, self).__init__() | ||||
|         uic.loadUi('soft2.ui', self) | ||||
|         uic.loadUi('settings/soft2.ui', self) | ||||
|         self.show()         | ||||
|         self.load_button = self.findChild(QPushButton, 'pushButton') | ||||
|         self.load_button.clicked.connect(self.get_file) | ||||
|  | @ -1,2 +0,0 @@ | |||
| full_cap_file_path: /home/adamr/Documents/PYTHON/TMS TV/EStiMo/easycap-M10_63_NO.txt | ||||
| cap_file_path: /home/adamr/Documents/PYTHON/TMS TV/EStiMo/easycap-M10_16_NO.txt | ||||
							
								
								
									
										0
									
								
								connection/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								connection/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										
											BIN
										
									
								
								connection/__pycache__/NeurOne.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								connection/__pycache__/NeurOne.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								connection/__pycache__/RDA.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								connection/__pycache__/RDA.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								connection/__pycache__/__init__.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								connection/__pycache__/__init__.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										12
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| matplotlib==3.6.2 | ||||
| mne==1.3.1 | ||||
| numpy==1.23.5 | ||||
| scipy==1.7.3 | ||||
| pandas==2.0.0 | ||||
| json==2.0.9 | ||||
| csv | ||||
| datetime | ||||
| ctypes==1.1.0 | ||||
| pywt==1.4.1 | ||||
| cycler==0.10.0 | ||||
| PyQt5 | ||||
							
								
								
									
										2
									
								
								settings/Electrode_selection.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								settings/Electrode_selection.txt
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| full_cap_file_path: /home/adamr/Documents/PYTHON/TMS TV/EStiMo/settings/easycap-M10_63_NO.txt | ||||
| cap_file_path: /home/adamr/Documents/PYTHON/TMS TV/EStiMo/settings/easycap-M10_16_NO.txt | ||||
|  | @ -6,6 +6,7 @@ Created on Mon Jan 24 11:26:23 2022 | |||
| """ | ||||
| import mne | ||||
| import os, sys, traceback, time | ||||
| 
 | ||||
| from PyQt5.QtWidgets import (QMainWindow, QFileDialog, QMessageBox, QCheckBox, QLineEdit, QWidget, QPushButton, | ||||
|                              QLabel, QHBoxLayout, QGridLayout, QAction, QApplication, QDialog, QDialogButtonBox, | ||||
|                              QVBoxLayout, QFrame, QTabWidget, QComboBox, QScrollArea, QFormLayout) | ||||
|  | @ -21,14 +22,13 @@ if sys.platform=='darwin': | |||
|     #from multiprocessing import Queue as StupidNotWorkingQueue | ||||
| else: | ||||
|     from multiprocessing import Process, Queue, Value | ||||
| import NeurOne | ||||
| import RDA | ||||
| import ctypes | ||||
| from connection import NeurOne, RDA | ||||
| 
 | ||||
| import pandas as pd | ||||
| from mne.channels.layout import _find_topomap_coords as get_pos | ||||
| import json | ||||
| import numpy as np | ||||
| import ctypes | ||||
| 
 | ||||
| if sys.platform=='darwin': | ||||
|     from multiprocessing.queues import Queue as QueueOld | ||||
|  | @ -225,15 +225,15 @@ class First_window(QMainWindow): | |||
|         self.setWindowTitle('EStiMo Configuration') | ||||
|          | ||||
|         try: | ||||
|             cap_loc_file = pd.read_csv('Electrode_selection.txt', sep=':', header=None) | ||||
|             cap_loc_file = pd.read_csv('settings/Electrode_selection.txt', sep=':', header=None) | ||||
|             self.cap_file_path = cap_loc_file[cap_loc_file[0]=='cap_file_path'].values[0][1].strip() | ||||
|             self.full_cap_file_path = cap_loc_file[cap_loc_file[0]=='full_cap_file_path'].values[0][1].strip() #'easycap-M10_63_NO.txt' | ||||
|         except: | ||||
|             print("CAP FILE EXCEPTION") | ||||
|             self.cap_file_path = 'easycap-M10_16_NO.txt' | ||||
|             self.full_cap_file_path = 'easycap-M10_63_NO.txt' | ||||
|             self.cap_file_path = 'settings/easycap-M10_16_NO.txt' | ||||
|             self.full_cap_file_path = 'settings/easycap-M10_63_NO.txt' | ||||
|          | ||||
|         self.conf_path = 'TMS_protocol.txt' | ||||
|         self.conf_path = 'settings/TMS_protocol.txt' | ||||
|         montage = mne.channels.read_custom_montage(self.cap_file_path) | ||||
|         montage_file = pd.read_csv(self.cap_file_path, sep='\t') | ||||
|          | ||||
							
								
								
									
										3
									
								
								utils/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								utils/__init__.py
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| import sys, os | ||||
| # sys.path.append("..") | ||||
| sys.path.append(os.path.dirname(os.path.abspath(__file__)))  | ||||
							
								
								
									
										
											BIN
										
									
								
								utils/__pycache__/FirstWindow.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								utils/__pycache__/FirstWindow.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								utils/__pycache__/Functions.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								utils/__pycache__/Functions.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								utils/__pycache__/Waiting.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								utils/__pycache__/Waiting.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								utils/__pycache__/__init__.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								utils/__pycache__/__init__.cpython-38.pyc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in a new issue