CHUNK_TYPE = 'Fixed Time' # 'Fixed beats number' if CHUNK_TYPE == 'Fixed Time': CHUNK_TIME_INTERVAL = 5.0 # minutes MIN_NUMBER_OF_BEATS_IN_CHUNK = 10 # beats elif CHUNK_TYPE == 'Fixed beats number': NUMBER_OF_BEATS_IN_CHUNK = 1000 TEST_PARTITION = 'random' # method for train / test separation TEST_PORTION = 0.3 ############################################################### # Initial configuration np.random.seed(SEED) logg.configure_logging() # For more details use logg.configure_logging(console_level=logging.DEBUG) stat_info = { 'mortality': dl.read_dta('mortality_SAHR_ver101214', data_folder=conf.path_to_dta), 'selected_pp': dl.read_dta('selected_pp', data_folder=conf.path_to_dta), 'sleep': dl.get_sleep_time(conf.path_to_dta), 'selected': pd.read_csv(conf.path_to_dta+'selected.csv') } #print stat_info['selected'] #!!! #zxc ################################################################# # Specify patients GIDNS for study if FIXED_GIDNS_LIST is not None: logging.warning('Only %s patients are used in this study: %s'%(len(FIXED_GIDNS_LIST), FIXED_GIDNS_LIST)) asked_GIDNS = FIXED_GIDNS_LIST
trainX = h5f['trainX'][:] trainY = h5f['trainY'][:] testX = h5f['testX'][:] testY = h5f['testY'][:] h5f.close() picke_filename = conf.path_to_sample+sample_name+'.pkl' with open(picke_filename, 'rb') as f: sample_info = pickle.load(f) sample_info['path'] = hdf5_filename return trainX, trainY, testX, testY, sample_info if __name__ == '__main__': logg.configure_logging(console_level=logging.DEBUG) mortality = read_dta('mortality_SAHR_ver101214', data_folder=conf.path_to_dta) selected_pp = read_dta('selected_pp', data_folder=conf.path_to_dta) GIDNS = get_GIDNS(path_to_dta=conf.path_to_dta) print GIDNS print len(GIDNS), 'patients' GIDN = GIDNS[0] data_RR = load_RR_data(GIDN, path=conf.path_to_RR) print '\ndata_RR:\n', data_RR, '\n' data_RR = load_RR_data(GIDN=1234567890, path=conf.path_to_RR) print 'data_RR:', data_RR
def load_hdf5_sample(sample_name): hdf5_filename = conf.path_to_sample+sample_name+'.h5' h5f = h5py.File(hdf5_filename,'r') trainX = h5f['trainX'][:] trainY = h5f['trainY'][:] testX = h5f['testX'][:] testY = h5f['testY'][:] sample_info = {'path': hdf5_filename} return trainX, trainY, testX, testY, sample_info if __name__ == '__main__': logg.configure_logging(console_level=logging.DEBUG) mortality = read_dta('mortality_SAHR_ver101214', data_folder=conf.path_to_dta) selected_pp = read_dta('selected_pp', data_folder=conf.path_to_dta) GIDNS = get_GIDNS(path_to_dta=conf.path_to_dta) print GIDNS print len(GIDNS), 'patients' GIDN = GIDNS[0] data_RR = load_RR_data(GIDN, path=conf.path_to_RR) print '\ndata_RR:\n', data_RR, '\n' data_RR = load_RR_data(GIDN=1234567890, path=conf.path_to_RR) print 'data_RR:', data_RR
CHUNK_TYPE = 'Fixed Time' # 'Fixed beats number' if CHUNK_TYPE == 'Fixed Time': CHUNK_TIME_INTERVAL = 5.0 # minutes MIN_NUMBER_OF_BEATS_IN_CHUNK = 10 # beats elif CHUNK_TYPE == 'Fixed beats number': NUMBER_OF_BEATS_IN_CHUNK = 1000 TEST_PARTITION = 'random' # method for train / test separation TEST_PORTION = 0.3 ############################################################### # Initial configuration np.random.seed(SEED) logg.configure_logging( ) # For more details use logg.configure_logging(console_level=logging.DEBUG) stat_info = { 'mortality': dl.read_dta('mortality_SAHR_ver101214', data_folder=conf.path_to_dta), 'selected_pp': dl.read_dta('selected_pp', data_folder=conf.path_to_dta), 'sleep': dl.read_dta('sleep', data_folder=conf.path_to_dta) } ################################################################# # Specify patients GIDNS for study if FIXED_GIDNS_LIST is not None: logging.warning('Only %s patients are used in this study: %s' %