! Procedure to automatically setup  asimple NOEMA receiver/correlator configuration
! @ autosetup Ftune Df
! Ftune in GHz, CorrelMode = Resolution im kHz
!----------------------------------------------------------------------------------
define double finp
define real dfinp df2
define character*16 proname
let proname "AUTOSETUP"
if pro%narg.eq.0 then
  message e 'proname' "Nothing to do"
  return base
else if pro%narg.gt.2 then
  message e 'proname' "Too many arguments"
  return base
endif
let finp &1
let dfinp 62.5
let df2 2000
if pro%narg.eq.2 then
  ! Accpected values: 62.5, 250, 2000
  let dfinp &2
  if dfinp.eq.2000 then
    let df2 62.5
  else if dfinp.eq.62.5 then
    let df2 2000
  else if  dfinp.eq.250 then
    let df2 -1
  else
    message e 'proname' "Problem with correlator mode"
    return base
  endif
endif
set frequency rest
obs noema offline
tuning 'finp'
if df2.ne.-1 then
  baseband /mode 'dfinp' 'df2'
else
  baseband /mode 'dfinp'
endif
