if pro%narg.eq.0 then
  SAY " "
  SAY "Usage:  @ find-flux-uvt FilterName "
  SAY "        where "
  SAY "     Filter is a filter for the names of UV tables to be selected"
  SAY "        (Searched files will be based on 'Filter'.uvt)"
  SAY "     Name is the name of the File that will contain the flux as function of frequency"
  SAY "       (with its extension) (Default sed.txt)"
  SAY " "
  SAY "  The Flux is determined by a simple model fit using UV_FIT"
  SAY " "
  SAY "Example:"
  SAY "@ find-flux-uvt s-Wide*.uvt "
  SAY "   will evaluate the flux of for the self-calibrated Wide channels data"
  SAY "   created by the all-widget suite"
  return error
endif
!
! Step 1: Make the UV_FIT
sic find &1.'sed%type'
if (dir%nfile.eq.0) then
  message E SED "No such file(s) &1."'sed%type'
  return base
endif
!
if sed%type.eq."uvt" then
  for fich /in dir%file
    message I UV_FIT "Treating file "'fich'
    clean\read uv 'fich'
    sic parse 'fich' name
    advanced\uv_fit 'sed%model' /quiet
    clean\write uv_fit 'name'.uvfit
  next
endif
!
! Step 2: prepare the output file
define integer k
define double freq
if (pro%narg.eq.2) then
  sic output &2
else
  sic output flux.txt
endif
!
for fich /in dir%file
  sic parse 'fich' name
  define image uv_fit 'name'.uvfit read
  for i 1 to uv_fit%dim[1]
    if (uv_fit[i,1].ne.0) then
      let freq (i-uv_fit%convert[1,1])*uv_fit%convert[3,1]+uv_fit%convert[2,1]
      say 'freq' 'uv_fit[i,12]' 'uv_fit[i,13]' 'k'  "'"'name'"'" 
    endif
  next
  delete /var uv_fit
  let k k+1
next
sic output
