1	#! /bin/csh -f
     2	#Example for HILO system -
     3	#jhz 2018-2-26: intiate a script for developing/testing the prototype
     4	#               program swarm2uvfits
     5	#jhz 2018-4-23: updated for new disk names on RTDC/RG
     6	#jhz 2018-4-26: update for testing swarmRead for the LSB data               
     7	#jhz 2018-5-02: update for USB test               
     8	#jhz 2018-5-09: develop swarm2ms.py to execute CASA tasks
     9	#jhz 2018-5-10: export swarm2ms.py a bin area where swarmRead
    10	#               is located.
    11	#jhz 2018-5-11: add instruction lines
    12	#jhz 2018-5-24: updated for test on RTDC/RG system
    13	#jhz 2018-5-25: updated for test on Hilo system (hilodr2)
    14	#jhz 2018-5-29: add optinx to input variables
    15	#               add alias casa /usr/local/casa-release-4.7.0-1-el6/bin/casa (from Holly)
    16	#               test CASA 4.7.0
    17	date            
    18	# --------------------------------------------------------------------
    19	#
    20	# requirement -
    21	#
    22	# RH 6.7 to 6.9; or CentOS 6.7 to 6.9
    23	# CASA 4.7.0 and higher
    24	# --------------------------------------------------------------------
    25	#
    26	# set up c-shell and environment variables -
    27	#
    28	# INPUT_FILE_DIR     - the path of the SMA archived data produced by online 
    29	#                      system with the SWARM correlator
    30	# INPUT_FILE_NAME    - the file name of the SMA archived data that users want
    31	#                      to interpret to measurementSet of CASA
    32	# OUTPUT_FILE_PREFIX - the prefix of output file name,  for example, SMA180506
    33	#                      will result in SMA180506.ms for the data in measurementSet
    34	#                      for CASA       
    35	# PATH               - the location of the executable binary code and the Python 
    36	#                      script                                               
    37	set    INPUT_FILE_DIR = /sma/data/science/mir_data/
    38	set    INPUT_FILE_NAME = 180506_03:52:53 
    39	setenv OUTPUT_FILE_PREFIX SMA180506
    40	set    PATH = /sma/reduction/jzhao/SMA2CASA_TESTING/swarm2measurementSet/bin/ 
    41	#----------------------------------------------------------------------
    42	echo 'Start swarm2uvfits.csh script -'
    43	echo ''
    44	#
    45	# process start -
    46	#
    47	#for LSB -
    48	$PATH/swarmRead $INPUT_FILE_DIR $INPUT_FILE_NAME $OUTPUT_FILE_PREFIX 0 0
    49	#for USB -
    50	$PATH/swarmRead $INPUT_FILE_DIR $INPUT_FILE_NAME $OUTPUT_FILE_PREFIX 1 0
    51	#
    52	alias casa "/usr/local/casa-release-4.7.0-1-el6/bin/casa"
    53	#
    54	# run CASA batch process -
    55	#
    56	#
    57	casa -c $PATH/swarm2ms.py
    58	echo ''
    59	echo 'CASA measurementSet data file '$OUTPUT_FILE_PREFIX'.ms is produced.'
    60	echo 'Done, congratulation! exit from the script!'
    61	date
    62	exit