MAPTRANS
Description
These tools will allow you to visualize individual maplet translations.
getMapl.sh
Input Files
 BEFORE running getMapl.sh, build a bigmap of the region you wish to study, and run RESIDUALS. USED_MAPS.TXT and MAPINFO.TXT need to be up to date. getMapl.sh should be run from your working directory. 
Here's a sample input:
sh getMapl.sh Input region name. (ex: TAG1) >TAG1
Output Files
- TAG1mapl.txt
 
Temp Files
- .o
 - .oo
 
Script File
                                         File: getMapl.sh                                                             
#!/bin/bash
########################
# USAGE: sh getMapl.sh #
#                      #
########################
echo "Input region name. (ex: TAG1)"
read ans
file=$ans
cp USED_MAPS.TXT .o
sed '$d' .o > .oo
list=`cat .oo`
for i in $list
do
        grep $i MAPINFO.TXT >> ${file}mapl.txt
done
rm .o .oo
calTrans.sh
Input Files
 This should also be run from your working directory, and requires the output file from  
getMapl.sh to be in that directory.
Here's a sample input:
sh calTrans.sh Input region name. (ex: TAG1) >TAG1 Input TAG1 mapinfo list. (ex: TAG1mapl.txt) >TAG1mapl.txt
Output files
- TAG1.txt
 
Temp Files
- CompOBJ.out
 - fit
 - *.obj
 
For each maplet within the bigmap that was created earlier, an .obj file is made. one at a time, and then delteted.
Script File
                                           File: calTrans.sh                                                            
#!/bin/bash
##########################################
#        USAGE: sh calTrans.sh           #
#                                        #
# N.B. You must have your region mapinfo #
#      file in your working directory.   #
##########################################
echo "Input region name. (ex: TAG1)"
read ans1
file=$ans1
echo "Input $ans1 mapinfo list. (ex: TAG1mapl.txt)"
read ans2
mapl=$ans2
list=`cat $mapl | cut -c -6`
mv -f $file.txt old.$file.txt
for i in $list
do
        Maplet2FITS MAPFILES/$i.MAP fit
        FITS2OBJ --local fit $i.obj
        rm fit
        CompareOBJ --compute-optimal-translation $i.obj SHAPEFILES/shape3.4-truth.obj > CompOBJ.out
        rm $i.obj
        trans=`awk '/Translation/{print $2 " " $3 " " $4}'  CompOBJ.out`
        coord=`grep $i $mapl | awk '{print $4 " " $5 " " $6}'`
        printf "\n$i $coord $trans" >> $file.txt
done
rm CompOBJ.out
plotVectors.sh
=== Input Files ====
 Run this from your working directory, and keep the output from calTrans.sh there too. 
Here's a sample input:
sh plotVectors.sh Input region name. (ex: TAG1) >TAG1 Input view Scaling factor. (ex: 1.5) >1.5
Output Files
- TAG1xyzV[000:015:165].png
 - TAG1vec.gif
 
Temp Files
- pvTrans.gpi
 
Script File
                                          File: plotVectors.sh                                                          
#!/bin/bash
######################################
#      USAGE: sh plotVectors.sh      #
#                                    #
# N.B. You must have the output from #
#      calTrans.sh in your working   #
#      directory.                    #
######################################
echo "Input region name. (ex: TAG1)"
read ans1
file=$ans1
echo "Input view scaling factor. (ex: 1.5)"
read ans2
fac=$ans2
scale=0.00436        # Conversion from LON to m, change if r mag deviates from 0.25km #
list='0 15 30 45 60 75 90 105 120 135 150 165'
list2='000 015 030 045 060 075 090 105 120 135 150 165'
arr=($list2)
cnt=0
for i in $list
do
        echo "set term x11" > pvTrans.gpi
        echo "unset key" >> pvTrans.gpi
        echo "unset border" >> pvTrans.gpi
        echo "unset xtics" >> pvTrans.gpi
        echo "unset ytics" >> pvTrans.gpi
        echo "unset ztics" >> pvTrans.gpi
        echo "scale="$scale >> pvTrans.gpi
        echo "fac="$fac >> pvTrans.gpi
        echo "set view 86,"$i",," >> pvTrans.gpi
        echo "splot '"$file".txt' using ((360-\$3)*scale):(\$2*scale):4:(\$5*fac):(\$6*fac):(\$7*fac) with vectors" >> $
        echo " " >> pvTrans.gpi
        echo "set output '"$file"xyzV"${arr[$cnt]}".png'" >> pvTrans.gpi
        echo "set term png" >> pvTrans.gpi
        echo "replot" >> pvTrans.gpi
        echo "unset output" >> pvTrans.gpi
        gnuplot < pvTrans.gpi
        cnt=$(($cnt+1))
done
rm pvTrans.gpi
convert -delay 50 -loop 0 ${file}xyzV*.png ${file}vec.gif
