#!/usr/bin/env python """Discover available ALMA-IMF line moment maps (cheap 2D FITS) for Phase 6 accretion-signature test. Looks for hot-core (CH3CN, CH3OH), dense-gas (N2H+, H2CO, DCN), and RRL (H41a) tracers near the source fields.""" import os, glob LOG=open('discover_lines.log','w') def p(*a): s=' '.join(str(x) for x in a);print(s);print(s,file=LOG);LOG.flush() R='/orange/adamginsburg/ALMAIMF_Images' LINES=['h41a','h41','ch3cn','ch3oh','n2hp','n2h','h2co','dcn','sio','hc3n','c18o','ch3oh'] # top-level moments dir for d in ['moments','statcont_results']: pp=os.path.join(R,d) if os.path.isdir(pp): fits=glob.glob(os.path.join(pp,'*.fits')) p(f'\n[{d}] {len(fits)} fits; sample:') for f in fits[:12]: p(' ',os.path.basename(f)) # per-field moments (W51-IRS2 as probe) for field in ['W51-IRS2','G338.93']: p(f'\n=== {field} line products ===') for band in ['B3','B6']: # look for moment maps anywhere under field/band for pat in ['*mom0*.fits','*moment0*.fits','*.image.tt0.fits']: hits=glob.glob(os.path.join(R,field,band,'moments',pat))[:6] if hits: p(f' {band}/moments/{pat}: {len(hits)}') for h in hits[:6]: p(' ',os.path.basename(h)) # also list moments subdir if exists md=os.path.join(R,field,band,'moments') if os.path.isdir(md): names=os.listdir(md)[:20] p(f' {band}/moments/ entries ({len(os.listdir(md))}):') for n in names: p(' ',n) LOG.close()