Check and open input emllist.fits file from emldetect. Clone input file. Loop: if (ID_BAND .eq. 0) then read next 3 rows if (.not.flux .eq. NULL) sum flux sum flux_err endif flux(i) = sumflux/n endif EndLoop