!
! SPECTRAL_INDEX  determination
!
!   Inputs:
!     a file filter (default *-C)
!     a file type (UV or Image)
!       for UV data, a source model (E_GAUSS by default)
!       for Image data, a Mask or Support
!     an output filename (default flux.txt)
!     a reference frequency
!
!   Steps
!     find-flux   Fit the source model (UV data) or compute
!                 the source flux for all channels of all
!                 data sets, and store them in "flux.txt"
!     s_spindex
!                 read the "flux.txt" file and fit a spectral index
!                 as a function of Frequency
!
!
@ d_spindex
!
let spi%type 'spi%type' /lower
if spi%type.ne."uvt" then
  message w SPINDEX "Image mode under debug"
  @ find-flux-cube 'spi%filter'.'spi%type'   'spi%tmpname'
else
  !
  ! Setup UV_FIT parameters
  @ uvfit_setup
  @ uvfit_subpar 1
  !
  @ find-flux-uvt 'spi%filter'.'spi%type'    'spi%tmpname'
endif
!
@ s_spindex 'spi%tmpname' 'spi%freq'
