def test_create_csv_path(): """ Test create_csv_path functionality """ base_dir = str(Path(__file__).parent/"examples") # fmri case dir_path = base_dir + '/002/fmri' network = 'Default' ID = '002' models = ['corr', 'cov', 'sps', 'partcorr'] roi = None node_size = 6 smooth = 6 c_boot = 100 hpass = 100 parc = True directget = 'prob' max_length = 200 # Cross test various connectivity models, thresholds, and parc true/false. for conn_model in models: for val in range(1, 10): thr = round(val*0.1, 1) for thr_type in ['prop', 'abs', 'dens', 'mst', 'disp']: for parc in [True, False]: est_path = utils.create_est_path_func(ID, network, conn_model, thr, roi, dir_path, node_size, smooth, c_boot, thr_type, hpass, parc) out_path = utils.create_csv_path(dir_path, est_path) assert out_path is not None dir_path = base_dir + '/002/dmri' network = 'Default' ID = '002' models = ['corr', 'cov', 'sps', 'partcorr'] roi = None node_size = 6 for conn_model in models: for val in range(1, 10): thr = round(val*0.1, 1) for thr_type in ['prop', 'abs', 'dens', 'mst', 'disp']: for target_samples in range(0, 100, 1000): for track_type in ['local', 'particle']: for parc in [True, False]: est_path = utils.create_est_path_diff(ID, network, conn_model, thr, roi, dir_path, node_size, target_samples, track_type, thr_type, parc, directget, max_length) out_path = utils.create_csv_path(dir_path, est_path) assert out_path is not None
def test_create_csv_path(): """ Test create_csv_path functionality """ import tempfile dir_path = str(tempfile.TemporaryDirectory().name) os.makedirs(dir_path) # fmri case network = 'Default' ID = '002' conn_model = 'corr' roi = None node_size = 6 smooth = 6 hpass = 100 parc = True thr = 0.75 thr_type = 'prop' extract_strategy = 'mean' est_path = utils.create_est_path_func(ID, network, conn_model, thr, roi, dir_path, node_size, smooth, thr_type, hpass, parc, extract_strategy) out_path = utils.create_csv_path(dir_path, est_path) assert out_path is not None
def test_create_csv_path(): """ Test create_csv_path functionality """ import tempfile tmp = tempfile.TemporaryDirectory() dir_path = str(tmp.name) os.makedirs(dir_path, exist_ok=True) # fmri case subnet = 'Default' ID = '002' conn_model = 'corr' roi = None node_size = 6 smooth = 6 hpass = 100 parc = True thr = 0.75 thr_type = 'prop' signal = 'mean' est_path = utils.create_est_path_func(ID, subnet, conn_model, thr, roi, dir_path, node_size, smooth, thr_type, hpass, parc, signal) out_path = utils.create_csv_path(dir_path, est_path) assert out_path is not None tmp.cleanup()
def test_create_csv_path(): """ Test create_csv_path functionality """ base_dir = str(Path(__file__).parent / "examples") # fmri case dir_path = base_dir + '/002/fmri' network = 'Default' ID = '002' conn_model = 'corr' roi = None node_size = 6 smooth = 6 c_boot = 100 hpass = 100 parc = True thr = 0.75 thr_type = 'prop' # Delete pre-existing graphs dir graph_dir = dir_path + '/graphs' if os.path.exists(graph_dir): shutil.move(graph_dir, graph_dir + '_tmp') # Delete pre-existing netmetrics dir netmetrics_dir = str(Path(dir_path).parent) + '/netmetrics' if os.path.exists(netmetrics_dir): shutil.move(netmetrics_dir, netmetrics_dir + '_tmp') est_path = utils.create_est_path_func(ID, network, conn_model, thr, roi, dir_path, node_size, smooth, c_boot, thr_type, hpass, parc) out_path = utils.create_csv_path(dir_path, est_path) assert out_path is not None # Restore pre-existing graph dir if os.path.exists(graph_dir + '_tmp'): shutil.rmtree(graph_dir) shutil.move(graph_dir + '_tmp', graph_dir) if os.path.exists(netmetrics_dir + '_tmp'): shutil.rmtree(netmetrics_dir) shutil.move(netmetrics_dir + '_tmp', netmetrics_dir)