PAKO preparation for 2012 run5
-------------------------
; v9 is at the start of 2012 (copy of v8)
; v10 is rearranged v9 for the preparation of November 2012, run5
; v11 add the new computer config (see the end)
; v12 updated at MCBT, Nov. 6th, 2012
; v13 update pako commands, new setup for NIKA, Nov. 14, 2012, SL

--------- XEphem usage -------------------------------------------------
!! preliminary: if you want to use xephem with the position of the telescope displayed in real time
! run the following sequence from the command prompt 
slogin mrt-lx3
ps xa |grep azElToXephem.py & ! check if the script is already running, if not do the following
useNCS
azElToXephem.py &
! once the script is running type:
/vis/xephem/xephem

------- Managing Imbfits file -----------------------------------------------
; Telescope fits are in mrt-lx1
/ncsServer/mrt/ncs/data/imbfits/bol
on mrt-lx1 (not gra-lx1)

or best
/ncsServer/mrt/ncs/data/20120604/scans

/ncsServer/mrt/ncs/data/20120604/datastreams/bbc

processed imbfits files are
/ncs/data/imbfits/bol/
; Or in ?
/ncsServer/mrt/ncs/data/datastreams/nika/2012
; Or in ?
/ncsServer/mrt/ncs/data/imbfits/bol

; There is a script to copy imbfits files from Iram to sami locally e.g.
./Backup_telescope.bash 20121024

; To process NIKA raw data files onto fits files and imbfits files
; log in sami on a dedicated window
idl
convert_fits_files2

---------- Pako usage ----------------------------------------------
!!!! 
Interface to NCS
Summary of PAKO user's manual


!   starts a comment line
-   command is continued
@ filename   to execute the script filename

; To start pako
; Devant l'ordinateur de commande : login as t21
ssh t21@mrt-lx1....

goPako
pakoDisplay
pakoNIKA

!!! The observer should be able to run @ini to have all the following commands in the script file
!!!  Attention, ini is the new init file for NIKA, do not use the old nini which will create problems !!!


!!! Check that the NCS knows the current project is t21
!!! otherwise the telescope will not obey you pako commands !
!!! --> look at the OperatorControl screen and/or ask the operator

set project t21
set pi "Alain"
set observer "Nika observer"  ! your name here, Nika needs you

! If not sending commands (outside normal run) do:
SET DOSUBMIT NO

SET LEVEL 0 0   ! very verbose
SET LEVEL 1 1   ! chatty
SET LEVEL 3 3   ! less
SET LEVEL 5 5   ! none

! Choose one of the 2 azimuth topology possibilities to decide on which end of the 
! azimuth overlap you want to set the origin of the 360 degrees azimuth circle
! May be usefull to avoid a complete turn (>8min) to go from one source ot another
SET TOPOLOGY LOW ! selects to use the azimuth range 60 to 420 degrees 
SET TOPOLOGY HIGH ! selects to use the azimuth range 100 to 460 degrees 

SET ANGLEUNIT arcsec   ! make sure angle units are arcsec.

! Remember to reset offsets!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
OFFSETS /Clear

! total power (no secondary wobbler)
SWTOTAL

! New: NIKA is now incorporated in NCS no need to choose a dumy instrument for pointing purpose
RECEIVER /CLEAR 
! 
RECEIVER Bolometer NIKA ! set pointing mobel of NIKA
!! No need to set a backend anymore

!
! prepare a catalog
! NIKA.sou (see wiki web) to put in the directory : 
!   t21/pako

! Choose a catalog with a .sou extension
CATALOG SOURCE NIKA
HELP source

! select a source
! No case matching, but name must be full
SOURCE W3OH

! or a planet
SOURCE Mars

! to check the catalog
HELP SOURCE

! Catalog of Pointing source from IRAM
CATALOG SOURCE iram-J2000

! Once you have entered an observing mode (See below)
! if you want that the telescope executes your commands do no forget
SET DOSUBMIT YES

! start an observation (MAKE SURE you want that)
START 
! (if you still have DOSUBMIT NO, nothing happens, but the commands 
! are in the queue and they will be executed when SET DOSUBMIT YES)

!!!!!!!!! Observing modes !!!!!!!

! procedures for tunning:
@ diy-test-00.pako ! 11 seconds track with 440 330 RA DEC offset to tune NIKA resonances
!   Note the text parameter "Tune" is sent through NCS (then Elvin) to be used by data acquisition
! 
@ diy-test-03.pako ! big 600x600 arcsec OTF map with 66 steps of 20" each, and 10 seconds pause
!  at each end of subscan for frequency tunning, the text parameter sent by NCS is "big OTF with tunes"
!
@ diy-test-12.pako ! sky dip from 1.1 to 3.5 airmass by step of 0.4, with 11 sec for tunning
!  followed by 22 sec for measure at each step, the text parameter sent by NCS is "tuned Tip"

! procedure to focus
! to set focus correction in mm wrt the current focus
SET FOCUS -2.4

! On the fly mode (cover all array pixels) for pointing and alignment. Expensive.
OTFMAP -180 -180 180 -180  - ! offsets at start and end of first otf subscan
  /notf 61 ! number of subscans
  /step 0 6  ! steps between subscans in arcsecond (az el)
  /system truehorizon ! projection AzEl is used to define the map
  /totf 36 ! time of a subscan
  /zigzag  ! go back and forth
  /reference no ! not necessary except if there's a conflict with /system

!! Attention to the tracking speed (= subscan length / totf) if you choose >10"/s keep an eye
!! on the tracking errors trackAz and trackEl in real time on the telescope control screen
!! this information is also stored in the FITs files (you can go much faster, 
!! check tabble of speed limit depending on elevation

! Correct pointing to center on the array by giving a and b
! Pointing corrections should be done in az, el, not nasmyth, R. Zylka private communication
OFFSET 0 0 /SYSTEM Nasmyth


! Small map to check the focus quickly
OTFMAP -48 -48 48 -48  - ! offsets at start and end of first otf subscan
  /notf 17 ! number of subscans
  /step 0 6  ! steps between subscans in arcsecond
  /system truehorizon ! projection AzEl is used to define the map
  /totf 10 ! time of a subscan
  /zigzag  ! go back and forth

! 4 switching modes (3 useful for bolometers)
! total power
SWTOTAL
! Beam switching
SWBEAM
! wobbler switching negAmplitude posAmplitude  0.6 seconds per phase!
SWWOBBLER -30 +30 /TPHASE 0.6

! Observing modes
! to send the proper command to the macs for tuning
! Should last a few seconds
!!! TUNING   !!!! Probably obsolete need to check (SL 14/11/2012)

! pointing cross of given length (in trueHorizon system)
POINTING 120
! Go on the source first, then @Cross

! skydip
! stop wobbler
SWTOTAL /tphase 0.6
! tip at azimuth 180, scan airmass from 1.1 to 4.1 by steps of 0.6
TIP  180 /airmass 1.1 4.1 0.6 /tsubscan 12.0

! position switching
ONOFF   !
! example (give ON offsets and OFF offsets, 2 positions each, 2 systems)
ONOFF 30 40 /reference -600 -700 projection /SYSTEM projection
! other options (30 seconds per subscan):
/nsubscans 12 /symmetric /tsubscan 30

! projection is RADEC system here
! can use /SYSTEM trueHorizon too

! if wobbler on use the following special mode
! in that case the off position is automatically on the off wobbler position
ONOFF /swwobbler /nsubscans 12 /symmetric /tsubscan 30

! not used by bolometers
TRACK

! everything in J2000
! x=(l-lsource)*cos(b)
! y=b-bsource
! to define the source
SOURCE
! if needs to offset from source use
OFFSET a b /SYSTEM projection
! then it is in x and y as above

! or

OFFSET a b /SYSTEM trueHorizon
! then Delta az= (az-azsource)*cos(elev)
! and  Delta el= elev-elevsource

! or 
OFFSET a b /SYSTEM Nasmyth

! Remember to reset offsets!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
OFFSETS /Clear

!options
/t... refers to time
/n... refers to number
/f... refers to frequency
/temp... refers to temperature

! See example of startup p21

! Pointing
SWBEAM
POINTING /default
START

! Set the corrections
! Corrections in arcsec found during the "cross" reduction.
! These corrections are to be added as is, there's no "offset" to remember whatsoever
SET POINTING 3.4 -1.2

! Focus ( total length in mm), 0, +1, +1, -1, -1, 0 mm in this example
! 0, +1, -1 etc... are referenced to the current position
FOCUS 2  /nsubscans 6 /tsubscans 12
START

! enter the correction
! This is the absolute value
SET FOCUS -2.1

! Useful in a script
PAUSE "Sequence Something OK to start ? [c/q]"  ! a chance to check

! and also
SAY " blabla "

! save last command
SAVE name
! retrieve a command
@ command_name


! To erase graphics in greg
Clear




----------------------------------------------------------------
; Computer configuration
----------------------------------------------------------------
The new sami is installed (24/10/21012) along with a mac, a PC windows, a
router/switch and an ethernet-IP triggered power plug.
The CVS file Camera/documentation/Installation_IRAM.txt contains most of the 
information


; Internal NIKA network addresses
192.168.1.30 Switch
192.168.1.31 NIKA_Win31
192.168.1.32 NIKA_Lin32 new sami (00 50 C2 B2 11 ED)
192.168.1.33 NIKA_Mac33

; Iram network
150.214.224.22 = mrt-nika1.iram.es  :   Router (ssh connection goes to sami)
150.214.224.223 gateway
150.214.224.100 DNS
gra-lx1.iram.es  : ntp server

; Old sami for ref
192.168.1.23 (Local)
150.214.224.22 (via routeur address with ssh)


; From iram computers to archeops@sami do
ssh_sami