#!/bin/csh -f source /star/etc/login >& /dev/null source /star/etc/cshrc >& /dev/null kappa >& /dev/null if (`alias kappa` == "") then echo "" echo "Fatal: Initialization error of kappa environment" echo "" exit endif set kap = $KAPPA_DIR if ($#argv < 2) set argv = "help" if ($argv[1] =~ *"help"* || $argv[1] == "-h") then echo "" echo "Use: sp_bin file nchan" echo " e.g. 'sp_bin myfile 10'" echo "" exit endif set infile = $argv[1] set infile = `echo "$infile" | cut -d\. -f1` set infile = "${infile}.sdf" shift argv if !(-e "$infile") then echo "" echo "Fatal: file $infile not found" echo "" exit endif set nchan = "$argv[1]" echo "" echo "Binning ${infile} over $nchan channels." # ---------------------------------------------------------------------- # Bin spectrum / cube # set base = `echo $infile | sed s/.sdf//` set outfile = ${base}_bin.sdf ${kap}/block in=$infile out=$outfile axes='[1,3]' box='[1,'${nchan}']' if (-e "$outfile") then echo "The binned spectrum has been saved in '$outfile'" else echo "ERROR: bin failed" endif echo ""