import os import pandas as pd from IPython import embed copy_cube = False copy_continuum = False copy_mom0 = True source_list = pd.read_csv('Lists_SBs_names.csv', sep = ';') data_path = '/home/mbethermin/a2c2s/observations/ALMA_DATA/2017.1.00428.L/' MOU_list = [] GOU_list = [] for SBname in source_list['SBname']: Path2GOU = os.popen('find '+data_path+SBname+' -mindepth 1 -maxdepth 1 -type d').read() GOUname = Path2GOU.split('/')[-1].replace('\n','') GOU_list.append(GOUname) Path2MOU = os.popen('find '+data_path+SBname+' -mindepth 2 -maxdepth 2 -type d').read() MOUname = Path2MOU.split('/')[-1].replace('\n','') MOU_list.append(MOUname) source_list = source_list.assign(MOUname = MOU_list) source_list = source_list.assign(GOUname = GOU_list) #create the MOUs directories for MOUname in source_list['MOUname']: if os.path.exists('FILES/'+MOUname) == False: os.mkdir('FILES/'+MOUname) #copy the RAW cubes if copy_cube: for MOUname, k in zip(source_list['MOUname'], range(0, len(source_list))): path = '/home/mbethermin/a2c2s/observations/ALMA_DATA/DR1/raw_cubes/' data_type = ['psf', 'flux','image'] ext = '.clean.RAW.cube.fits' for sname in [source_list['source1'][k], source_list['source2'][k]]: sname = str(sname) for dattype in data_type: if os.path.isfile(path+sname+'.'+dattype+ext): os.system('cp '+path+sname+'.'+dattype+ext+' ./FILES/'+MOUname+'/'+MOUname+'.lp_olefevre.'+sname+'.cube.'+dattype+'.fits') #Copy the continuum maps if copy_continuum: for MOUname, k in zip(source_list['MOUname'], range(0, len(source_list))): path = '/home/mbethermin/a2c2s/observations/ALMA_DATA/DR1/continuum_maps/' data_type = ['psf', 'flux','image'] ext = '.clean.cont.fits' for sname in [source_list['source1'][k], source_list['source2'][k]]: sname = str(sname) for dattype in data_type: if os.path.isfile(path+sname+'.'+dattype+ext): os.system('cp '+path+sname+'.'+dattype+ext+' ./FILES/'+MOUname+'/'+MOUname+'.lp_olefevre.'+sname+'.continuum.'+dattype+'.fits') #Copy the mom0 maps if copy_mom0: for MOUname, k in zip(source_list['MOUname'], range(0, len(source_list))): path = '/home/mbethermin/a2c2s/observations/ALMA_DATA/DR1/cii_mom0_maps/' data_type = ['psf', 'flux','image'] ext = '.clean.fits' for sname in [source_list['source1'][k], source_list['source2'][k]]: sname = str(sname) for dattype in data_type: if os.path.isfile(path+sname+'.'+dattype+ext): os.system('cp '+path+sname+'.'+dattype+ext+' ./FILES/'+MOUname+'/'+MOUname+'.lp_ol\ efevre.'+sname+'.CIImom0.'+dattype+'.fits') embed()