def run(exptfilename): foldname = [] filenames = [] foldname, filenames = re.read_exptlist(exptfilename, lines_per_expt=3, fileline=1) for i in range(len(foldname)): # do matlab stuff to save cropping rectangles print('hope you saved a cropping rectangle for ' + foldname[i]) for i in range(len(foldname)): matlab_options = "options.green_only = 0; options.targetfold = '" + raw_fold + "'; options.data_foldbase = '" + sbx_fold + "'; " matlab_cmd = '"' + matlab_options + "gen_2channel_tiffs('" + foldname[ i] + "'," + str(filenames[i]) + ",options); exit" + '"' print(matlab_cmd) os.system('matlab -r ' + matlab_cmd) fileparts = foldname[i].split('/') date = fileparts[0] animalid = fileparts[1] expt_ids = [str(x) for x in filenames[i]] rpt.process_data(animalid, date, expt_ids, nchannels=1, delete_raw=True, result_base=result_fold, raw_base=raw_fold)
def run(exptfilename): foldname = [] filenames = [] foldname, filenames = re.read_exptlist(exptfilename, lines_per_expt=3, fileline=1) # for i in range(len(foldname)): # # do matlab stuff to save cropping rectangles # print('now saving a cropping rectangle for ' + foldname[i]) for i in range(len(foldname)): fileparts = foldname[i].split('/') date = fileparts[0] animalid = fileparts[1] expt_ids = [str(x) for x in filenames[i]] subfold = '_'.join(expt_ids) thisfold = suite2p_fold + animalid + '/' + date + '/' + subfold + '/' save_meanImg(thisfold) matlab_cmd = '"' + "s2p_output_to_opto_corrected_rois('" + thisfold + "','datafold','" + matfile_fold + "'); exit;" + '"' print(matlab_cmd) os.system('matlab -r ' + matlab_cmd)
def run(exptfilename, diameter=15, sbx_fold='/home/mossing/modulation/2P/', suite2p_fold='/home/mossing/data1/suite2P/', fast_disk='/home/mossing/data_ssd/suite2P/bin/', matfile_fold='/home/mossing/modulation/matfiles/'): raw_fold = suite2p_fold + 'raw/' result_fold = suite2p_fold + 'results/' foldname = [] filenames = [] foldname, filenames = re.read_exptlist(exptfilename, lines_per_expt=3, fileline=1) for i in range(len(foldname)): # do matlab stuff to save cropping rectangles print('hope you saved a cropping rectangle for ' + foldname[i]) for i in range(len(foldname)): try: #shutil.rmtree(fast_disk+'suite2p') os.system('rm -rf ' + fast_disk + 'suite2p') print('fast disk contents deleted') except: print('fast disk location empty') matlab_options = "options.green_only = 0; options.targetfold = '" + raw_fold + "'; options.data_foldbase = '" + sbx_fold + "'; options.matfile_foldbase = '" + matfile_fold + "';" matlab_cmd = '"' + matlab_options + "gen_2channel_tiffs('" + foldname[ i] + "'," + str(filenames[i]) + ",options); exit; " + '"' # exit print(matlab_cmd) os.system('matlab -r ' + matlab_cmd) fileparts = foldname[i].split('/') date = fileparts[0] animalid = fileparts[1] expt_ids = [str(x) for x in filenames[i]] rpt.process_data(animalid, date, expt_ids, nchannels=1, delete_raw=True, result_base=result_fold, raw_base=raw_fold, diameter=diameter, fast_disk=fast_disk) try: #shutil.rmtree(fast_disk+'suite2p') os.system('rm -rf ' + fast_disk + 'suite2p') print('fast disk contents deleted') except: print('fast disk location empty')
def run(exptfilename): foldname = [] filenames = [] foldname,filenames = re.read_exptlist(exptfilename,lines_per_expt=3,fileline=1) for i in range(len(foldname)): # do matlab stuff to save cropping rectangles print('now saving a cropping rectangle for ' + foldname[i]) thisfold = matfile_fold+foldname[i] if not os.path.exists(thisfold): os.makedirs(thisfold) matlab_cmd = '"' + "save_and_transfer_crop_remote('" + thisfold + "','" + sbx_fold + "',true); exit;" + '"' print(matlab_cmd) os.system('matlab -r ' + matlab_cmd)
import sys import os sys.path.insert(0, '/home/mossing/code/adesnal') import run_pipeline_tiffs as rpt import read_exptlist as re suite2p_fold = '/home/mossing/data1/suite2P/' sbx_fold = '/home/mossing/modulation/2P/' raw_fold = suite2p_fold + 'raw/' result_fold = suite2p_fold + 'results/' foldname = [] filenames = [] foldname, filenames = re.read_exptlist('exptlist_191118.txt', lines_per_expt=4, fileline=(1, 2)) # 190709 for i in range(len(foldname)): matlab_options = "options.green_only = 1; options.targetfold = '" + raw_fold + "'; options.data_foldbase = '" + sbx_fold + "'; " matlab_cmd = '"' + matlab_options + "gen_2channel_tiffs('" + foldname[ i] + "'," + str(filenames[i]) + ",options); exit" + '"' print(matlab_cmd) os.system('matlab -r ' + matlab_cmd) fileparts = foldname[i].split('/') date = fileparts[0] animalid = fileparts[1] expt_ids = [str(x) for x in filenames[i]]
import os sys.path.insert(0, '/home/mossing/code/adesnal') import run_pipeline_tiffs as rpt import read_exptlist as re suite2p_fold = '/home/mossing/data1/suite2P/' sbx_fold = '/home/mossing/modulation/2P/' raw_fold = suite2p_fold + 'raw/' result_fold = suite2p_fold + 'results/' foldname = [] filenames = [] foldname, filenames = re.read_exptlist('exptlist_190623.txt', lines_per_expt=4, fileline=2) for i in range(len(foldname)): matlab_options = "options.green_only = 0; options.targetfold = '" + raw_fold + "'; options.data_foldbase = '" + sbx_fold + "'; " matlab_cmd = '"' + matlab_options + "gen_2channel_tiffs('" + foldname[ i] + "'," + str(filenames[i]) + ",options); exit" + '"' print(matlab_cmd) os.system('matlab -r ' + matlab_cmd) fileparts = foldname[i].split('/') date = fileparts[0] animalid = fileparts[1] expt_ids = [str(x) for x in filenames[i]]
def run(exptfilename, diameter=15, sbx_fold='/home/mossing/modulation/2P/', suite2p_fold='/home/mossing/data1/suite2P/', fast_disk='/home/mossing/data_ssd/suite2P/bin', matfile_fold='/home/mossing/modulation/matfiles/'): raw_fold = suite2p_fold + 'raw/' result_fold = suite2p_fold + 'results/' foldname = [] filenames = [] foldname, filenames_1ch = re.read_exptlist( exptfilename, lines_per_expt=4, fileline=(1, 2)) # should this be (1,2) ? _, filenames_2ch = re.read_exptlist(exptfilename, lines_per_expt=4, fileline=2) for i in range(len(foldname)): fileparts = foldname[i].split('/') date = fileparts[0] animalid = fileparts[1] expt_ids_1ch = [str(x) for x in filenames_1ch[i]] expt_ids_2ch = [str(x) for x in filenames_2ch[i]] try: shutil.rmtree(fast_disk + '/suite2p') os.system('rm -rf ' + fast_disk + '/suite2p') print('fast disk contents deleted') except: print('fast disk location empty') matlab_options = "options.green_only = 1; options.targetfold = '" + raw_fold + "'; options.data_foldbase = '" + sbx_fold + "'; options.matfile_foldbase = '" + matfile_fold + "';" matlab_cmd = '"' + matlab_options + "gen_2channel_tiffs('" + foldname[ i] + "'," + str(filenames_1ch[i]) + ",options); exit" + '"' print(matlab_cmd) os.system('matlab -r ' + matlab_cmd) try: shutil.rmtree(fast_disk + '/suite2p') os.system('rm -rf ' + fast_disk + '/suite2p') print('fast disk contents deleted') except: print('fast disk location empty') rpt.process_data(animalid, date, expt_ids_1ch, delete_raw=delete_raw, raw_base=raw_fold, result_base=result_fold, diameter=diameter, nchannels=1, fast_disk=fast_disk) matlab_options = "addpath(genpath('~/adesnal')); options.green_only = 0; options.targetfold = '" + raw_fold + "'; options.data_foldbase = '" + sbx_fold + "'; options.matfile_foldbase = '" + matfile_fold + "';" matlab_cmd = '"' + matlab_options + "gen_2channel_tiffs('" + foldname[ i] + "'," + str(filenames_2ch[i]) + ",options); exit" + '"' print(matlab_cmd) os.system('matlab -r ' + matlab_cmd) rpt.add_2ch_data(animalid, date, expt_ids_1ch, expt_ids_2ch, raw_base=raw_fold, result_base=result_fold, delete_raw=delete_raw, diameter=diameter, fast_disk=fast_disk) try: shutil.rmtree(fast_disk + '/suite2p') os.system('rm -rf ' + fast_disk + '/suite2p') print('fast disk contents deleted') except: print('fast disk location empty')