def test_system(): '''Print simple system info and some other junk, just to see if system has been set up and homeworks are from different machines.''' try: import mne except ImportError: raise ImportError('Nie masz biblioteki `mne`!') mne.sys_info() modules = ['seaborn', 'borsar', 'sarna'] longest_str = max(map(len, modules)) + 8 txt = '\n{} {}\n{}\n'.format(platform.system(), platform.machine(), platform.processor()) # check module presence and versions for module in modules: txt += '\n{}: '.format(module) try: mdl = importlib.import_module(module) base_txt = '{:>%d}' % (longest_str - len(module)) txt += base_txt.format(mdl.__version__) except ImportError: txt += 'BRAK :(' if module in ('borsar', 'sarna'): txt += "; instalacja z git'a" if is_git_installed(mdl) \ else "; zwykła instalacja" # print some random junk values = np.random.randint(0, 1001, (2, 3)) txt += '\n\nTwoje szczęśliwe liczby to:\n{}'.format(values) print(txt)
def write_log_header(log_savepath, width=80, sep="=", alt_sep="-"): with open(log_savepath, "a") as log_file: log_file.write(sep * width + "\n") log_file.write(str(datetime.now()).center(width, sep) + "\n") log_file.write(sep * width + "\n") sys_info(fid=log_file) log_file.write("mne-bids:".ljust(15) + mne_bids_version + "\n") log_file.write(alt_sep * width + "\n")
def run(): """Run command.""" parser = mne.commands.utils.get_optparser(__file__, usage='mne sys_info') options, args = parser.parse_args() if len(args) != 0: parser.print_help() sys.exit(1) mne.sys_info()
def run(): """Run command.""" parser = mne.commands.utils.get_optparser(__file__, usage='mne sys_info') parser.add_option('-p', '--show-paths', dest='show_paths', help='Show module paths', action='store_true') parser.add_option('-d', '--developer', dest='developer', help='Show additional developer module information', action='store_true') options, args = parser.parse_args() dependencies = 'developer' if options.developer else 'user' if len(args) != 0: parser.print_help() sys.exit(1) mne.sys_info(show_paths=options.show_paths, dependencies=dependencies)
# %% import os import numpy as np import mne #from properties import filename import matplotlib.pyplot as plt # Este codigo es un plot basico para ver la señal, los datos concretos. from matplotlib.transforms import Bbox from scipy import signal import matplotlib.pyplot as plt mne.sys_info() #chequear sistema # Acá leemos un archivo particular mne.set_log_level("WARNING") raw = mne.io.read_raw_brainvision( 'C:/Users/Nicola/Documents/eeg/VISBRAIN/ExpS35.vhdr', preload=True, eog=('EOG1_1', 'EOG2_1'), misc=('EMG1_1', 'EMG2_1'), verbose=True) raw.rename_channels(lambda s: s.strip(".")) # ----------------------------------------------------------------- data = raw.get_data() # data(chan,samp), times(1xsamples) info = raw.info #info sfreq = info.get('sfreq') #frecuencia de muestreo #Con este código extraigo los datos que necesito y me rearmo la estructura que necesito para poder analizarlo mejor data = raw.get_data() # Saco los datos concretos, una matriz de numpy new_data = data.copy() canal_eogs = data[6, :] - data[
pkg_resources.working_set.require(dependencies) # Check that the data is present on the system if not os.path.exists(fname.data_dir): raise ValueError('The `data_dir` points to non-existent directory: ' + fname.data_dir) # Make sure the output directories exist os.makedirs(fname.derivatives_dir, exist_ok=True) # directories for reports os.makedirs(fname.reports_dir, exist_ok=True) # directories for results os.makedirs(fname.results, exist_ok=True) os.makedirs(fname.figures, exist_ok=True) os.makedirs(fname.rt, exist_ok=True) # prints some information about the system mne.sys_info() with open(fname.system_check, 'w') as f: f.write('System check OK.') # creates .json with results of sourcedata/ validation data_val = validate_sourcedata(path=parent_dir, source_type=['eeg']) with open('validator.json', 'w') as outfile: json.dump(data_val, outfile, indent=4) print("\nAll seems to be in order." "\nYou can now run the entire pipeline with: python -m doit")
def Supera75(): # versión de MNE, chequear que estamos usando mne3 mne.sys_info() # Acá leemos un archivo particular mne.set_log_level("WARNING") raw = mne.io.read_raw_brainvision( 'C:\\Users\\julia\\Desktop\\Tesis\\Registros\\RCnew\\ExpS11.vhdr', preload=True, eog=('EOG1_1', 'EOG2_1'), misc=('EMG1_1', 'EMG2_1'), verbose=True) raw.rename_channels(lambda s: s.strip(".")) data = raw.get_data() # Saco los datos concretos, una matriz de numpy time_shape = data.shape[1] print(time_shape) # ----------------------------------------------------------------- # data(chan,samp), times(1xsamples) # (1) Aca voy a ver los datos en crudo, ploteandolos por afuera de MNE. Fijense que los datos estan en Volts lo paso a microvolts. channel = 0 eeg = raw[channel][0][0][0:250 * 4] * pow(10, 6) # Tomo 4 segundos. #print(eeg) eeg2 = raw[channel][0][0][0:250 * 1] * pow( 10, 6) #tomo las señales del eeg en el 1 segundo eeg3 = raw[channel][0][0][250:500 * 1] * pow( 10, 6) #tomo las señales del eeg en el 2 segundo print(eeg2) dat = np.concatenate((np.zeros((1, data.shape[1])), data), axis=0) #print(dat) arraysenial = [] arraysenial = np.asarray(arraysenial) i = 0 j = 1 while i <= time_shape: eeg4 = raw[channel][0][0][i:200 * j * 1] * pow( 10, 6) #tomo los valores del eeg cada 1 segundo #print(eeg4) eeg2 = raw[channel][0][0][i:100 * j] * pow( 10, 6) #tomo las señales del eeg en el 0.5 segundos signal = eeg4 - np.mean( eeg4 ) # le resto la media de la señal a mi señal y la cenrtro en cero signal = signal + np.min( signal) * -1 # le sumo a la señal el minimo en positivo newsignal = signal newsignal[signal > 75] = 100 newsignal[signal <= 75] = 0 newsignal = list(newsignal) arraysenial = np.concatenate((arraysenial, newsignal), axis=0) i += 200 # @FIXME: Ver que pasa con el tema de ventanas solapadas (poner la mitad) j += 1 print(arraysenial.shape) return arraysenial