! specsetup.greg 
! written by Carsten Kramer, March 2013
!
! Task:
! Show lines to be observed with one of the 4 EMIR receivers 
! and frequency coverage of various backends for a given
! local oscillator frequency.
! Frequency edges of spectrometers from Gabriel Paubert 
! (see backend 30m homepage). For VESPA, the maximum bandwidth
! of 500MHz is shown.
!
! Examples are given below.
!
! Input:
!   line frequencies in increasing(!) frequency in GHz, 
!   number of lines (iend),
!   local oscillator frequency in GHz (flo)
! Output:
!   Plot
!
set font duplex
define real line[10] fts50[10] vespa[10] fts200[10]
define real flo
define integer iend
pen 0 /weight 3
clear

!! Examples:
! -------------------
! Input of lines to be observed in one EMIR band:
! 031-13:
let line[1] =  89.2 ! Line frequencies [GHz]
let line[2] =  90.6 ! Line list needs to be sorted !!
let line[3] =  93.2
let line[4] = 109.8
let iend = 4 ! number of last line
let flo = 99.5 ! 102.5 ! Local Oscillator Frequency [GHz]
! -------------------
! 032-13:
!let line[1] = 87.3
!let line[2] = 88.6
!let line[3] = 89.2
!let line[4] = 90.6
!let line[5] = 93.2
!let iend = 5
!let flo = 98.
! -------------------
! 034-13:
!let line[1] = 99.3
!let line[2] = 109.8
!let iend = 2
!let flo = 104.5
! -------------------

! ----------------------------------------------------------------
! Don't touch the part below:

set box landscape
g\set box 3 27 16 20
limits line[1]-2 line[iend]+2 -0.4 0.6
!box
greg1\axis xlow
greg1\axis xup
greg1\axis yleft /tick none
greg1\axis yright
label " Frequency [GHz] " /x

pen 2
set coord user
draw relocate 'flo' -0.4
draw line 'flo' 0.6
pen 0
draw text 'flo' 0.2 "Flo="'flo'"GHz" 5
pen 0

! Plot lines:
set coord user
for i 1 to 'iend' by 1
  draw relocate 'line[i]' -10; draw line 'line[i]' 10 /clip
next

if (flo.gt.line[iend]) then
  draw text flo-7.84 0.62 "One EMIR sideband of 7.78GHz width"
else
  draw text flo 0.62 "Both EMIR sidebands of 7.78GHz width each"
endif
! Plot FTS@200 setup for a given local oscillator frequency flo:
let fts200[1] = flo-11.73
let fts200[2] = flo-3.95
let fts200[3] = flo+3.95
let fts200[4] = flo+11.73
pen 3
for i 1 to 4 by 1
  draw relocate 'fts200[i]' 0.3; draw line 'fts200[i]' 0.5
next
draw relocate 'fts200[1]' 0.3; draw line 'fts200[2]' 0.3
draw relocate 'fts200[3]' 0.3; draw line 'fts200[4]' 0.3
draw relocate 'fts200[1]' 0.5; draw line 'fts200[2]' 0.5
draw relocate 'fts200[3]' 0.5; draw line 'fts200[4]' 0.5
draw text  line[1]-2 0.4 "FTS@200" 4

! Plot FTS@50 setup for a given local oscillator frequency flo:
let fts50[1] = flo-10.39
let fts50[2] = flo-8.57
let fts50[3] = flo-7.11
let fts50[4] = flo-5.29
let fts50[5] = flo+5.29
let fts50[6] = flo+7.11
let fts50[7] = flo+8.57
let fts50[8] = flo+10.39
pen 3
for i 1 to 8 by 1
  draw relocate 'fts50[i]' 0; draw line 'fts50[i]' 0.2
next
draw relocate 'fts50[1]' 0.2; draw line 'fts50[2]' 0.2
draw relocate 'fts50[3]' 0.2; draw line 'fts50[4]' 0.2
draw relocate 'fts50[5]' 0.2; draw line 'fts50[6]' 0.2
draw relocate 'fts50[7]' 0.2; draw line 'fts50[8]' 0.2
draw relocate 'fts50[1]' 0.0; draw line 'fts50[2]' 0.0
draw relocate 'fts50[3]' 0.0; draw line 'fts50[4]' 0.0
draw relocate 'fts50[5]' 0.0; draw line 'fts50[6]' 0.0
draw relocate 'fts50[7]' 0.0; draw line 'fts50[8]' 0.0
draw text  line[1]-2 0.1 "FTS@50" 4

pen 1 ! VESPA, rough maximum band range only
! the true band range depends on the selected VESPA setting
! see the VESPA manual of G.Paubert
let vespa[1] = flo-9.43-0.25
let vespa[2] = flo-9.43+0.25
let vespa[3] = flo-6.25-0.25
let vespa[4] = flo-6.25+0.25
let vespa[5] = flo+6.25-0.25
let vespa[6] = flo+6.25+0.25
let vespa[7] = flo+9.43-0.25
let vespa[8] = flo+9.43+0.25
for i 1 to 8 by 1
  draw relocate 'vespa[i]' -0.3; draw line 'vespa[i]' -0.1
next
draw relocate 'vespa[1]' -0.3; draw line 'vespa[2]' -0.3
draw relocate 'vespa[3]' -0.3; draw line 'vespa[4]' -0.3
draw relocate 'vespa[5]' -0.3; draw line 'vespa[6]' -0.3
draw relocate 'vespa[7]' -0.3; draw line 'vespa[8]' -0.3
draw relocate 'vespa[1]' -0.1; draw line 'vespa[2]' -0.1
draw relocate 'vespa[3]' -0.1; draw line 'vespa[4]' -0.1
draw relocate 'vespa[5]' -0.1; draw line 'vespa[6]' -0.1
draw relocate 'vespa[7]' -0.1; draw line 'vespa[8]' -0.1
draw text  line[1]-2 -0.2 "VESPA" 4

pen 0

say "FTS @ 50kHz: "
say "Diff to lower edge = "'(line[1]-fts50[1])*1e3'" MHz "
say "Diff to upper edge = "'(fts50[8]-line[iend])*1e3'" MHz "

hardc specsetup.eps /dev eps color /overwrite




