#!/usr/bin/env python """Read symlink targets of the cube dirs; check if real path is reachable.""" import os, glob LOG=open('check_symlinks.log','w') def p(*a): s=' '.join(str(x) for x in a);print(s);print(s,file=LOG);LOG.flush() base='/orange/adamginsburg/ALMAIMF_Images/W51-IRS2' for nm in ['linecubes_12m','fullcubes_12m','linecubes_7m12m']: pth=os.path.join(base,nm) p(f'\n{nm}:') p(' islink:',os.path.islink(pth),' isdir:',os.path.isdir(pth),' exists:',os.path.exists(pth)) if os.path.islink(pth): tgt=os.readlink(pth) p(' -> target:',tgt) p(' target exists:',os.path.exists(tgt),' isdir:',os.path.isdir(tgt)) if os.path.isdir(tgt): h=glob.glob(os.path.join(tgt,'*spw3*.fits'))[:3] p(' spw3 cubes at target:',len(glob.glob(os.path.join(tgt,'*spw3*.fits')))) for x in h: p(' ',os.path.basename(x)) LOG.close()