pro missing_files_report, report, miss_files, miss_pkts, miss_pfiles, nfiles, n_outliers

  openu, unit, report, /get_lun, /append

 ; nfiles = n_elements(files)

;; Useful fractions.
  

  printf, unit
  printf, unit, '-Missing Files:'
  printf, unit
  printf, unit, 'There were ' + strcompress(miss_files,/rem) $
          + ' missing files out of ' + strcompress(nfiles,/rem) $
          + ' files (' + strcompress(miss_files*100./nfiles,/rem)  + '%).'
  if n_outliers eq 1 then $
     printf, unit, 'There was ' +  strcompress(n_outliers,/rem) $
             + ' file with an incorrect timestamp.'$
  else $
     printf, unit, 'There were ' +  strcompress(n_outliers,/rem) $
          + ' files with incorrect timestamps.'

  printf, unit, 'There were ' + strcompress(miss_pfiles,/rem) $
         + ' files with missing packets out of ' + strcompress(nfiles,/rem) $
         + ' files (' + strcompress(miss_pfiles*100./nfiles,/rem)  + '%).'
  printf, unit, 'There were ' + strcompress(miss_pkts,/rem) $
         + ' missing packets out of ' + strcompress(miss_pfiles,/rem) $
         + ' files. That averages to about ' $
         + strcompress(miss_pkts/miss_pfiles,/rem)  + ' packets per file.'
  printf, unit, '(There are 64 pixels in a packet.)'
  printf, unit, 'Missing packets and files are typically due to problems '  + $
         'located outside of the XRT instrument, such as in the telemetry ' + $
         'downlink, the ground transmission to JAXA, or the reformatter.'
  printf, unit

  free_lun, unit 
end
