#!/bin/csh -f #++++++++++++++++ #.IDENTIFICATION afoev #.LANGUAGE C-shell #.AUTHOR Francois Ochsenbein [CDS] #.ENVIRONMENT VizieR #.KEYWORDS #.VERSION 1.0 30-Dec-2004 #.PURPOSE Find whether data exist in in AFOEV data-base (option -t) # or plots (called from /viz-bin/vizExec/afoev) #.COMMENTS This program id sued to plot AFOEV light curves. # It can be called: # 1. With -t star_name # option, to check a variable star exists. # 2. From vizExec (phase 1: HTML text) or vizPlot (phase 2, actual plot) # Therefore, when this program is called, I'm in the catalogue # directory, and the following variables are defined: # - theCat = name of catalog # - theTab = name of table (eventually) # - thePro = name of Prgram to execute to generate ascii table eg fits2a # - SCRIPT_NAME PATH_INFO etc.. (HTTPD variables) # On input, PATH_INFO is always set to /afoev[/gif|ps|...] #---------------- if (! $?SCRIPT_NAME) setenv SCRIPT_NAME $0 if (! $?CATS) setenv CATS /ftp/cats if (! $?PATH_INFO) setenv PATH_INFO "/afoev" if (! $?Vroot) setenv Vroot /usr/httpd # Or ~cds/httpd... if (! $?Local) then set local = 0 if ($SCRIPT_NAME =~ /local/* ) then set local = 1 endif endif #Redirect to cdsarc if does not exist here if (! -d $CATS) then aclient 130.79.128.5 1660 afoev $argv:q exit $status endif #set local=1 if ($local) then (echo ""; echo "----$0 (`date`)"; \ echo " PATH_INFO=$PATH_INFO"; \ echo " SCRIPT_NAME=$SCRIPT_NAME" \ ) >> /tmp/Vgraph.arg if ($?Vgraph) then echo " Vgraph=$Vgraph" >> /tmp/Vgraph.arg endif if ($?theTab) then echo " theTab=$theTab" >> /tmp/Vgraph.arg endif @ i = 1 while ($i <= $#argv) echo " #$i=$argv[$i]" >> /tmp/Vgraph.arg @ i += 1 end endif ###################################################################### # Option -t : Test whether the star exists ###################################################################### if ("$1" == "-t") then shift # Now $1 = Name, $2 = Constell set file = `echo $1 $2 | acut -Tlow -d' ' -f2T -i/ -f1T | sed 's/v0/v/'` shift; shift fcat -f $CATS/afoev/$file && echo1 \ "\vExec{afoev}{afoev/./$file}{$*}{AFOEV}" exit 0 endif ###################################################################### # Here, when called from Vgraph, i.e. # thePro = afoev # theCat = afoev # theTab = const/star # Otherwise, when called directly from afoevList, arguments are: # $1 = star (theTab) # $2 = JDmin/max (limits on x, P=0) # Arguments for X limits may be -x0= -x1= # or -x x0 x1 ###################################################################### ### Be sure libraries are known (done also in Vgraph) if (-x $Vroot/bin/libplot.so) then if ($?LD_LIBRARY_PATH) then setenv LD_LIBRARY_PATH $Vroot/bin:$LD_LIBRARY_PATH else setenv LD_LIBRARY_PATH $Vroot/bin endif endif set tmp = `echo $PATH_INFO | sed 's%/*afoev[\/.]*%%'` setenv Vgraph "$tmp" if (! $?theCat) setenv theCat afoev if (! $?theTab) then setenv theTab "$1"; shift endif set star = `echo $theTab | trcol -t1 'a-z' 'A-Z'|sed 's/^\(.\)m\([ai]\)/\1M\2/'` set Star = `echo $star | sed s/Cvn/CVn/ | gawk -F/ '{print toupper($2),$1}'` #### Definitions of P Ep xlim xarg Xarg done in #### the sourced file $Vroot/lib/timeSerie.csh source $Vroot/lib/timeSerie.csh if ($local) then echo " inplot=$inplot" >> /tmp/Vgraph.arg echo " a2shift=$a2shift" >> /tmp/Vgraph.arg echo " xlim=($xlim)" >> /tmp/Vgraph.arg @ i = 1 while ($i <= $#argv) echo " #$i=$argv[$i]" >> /tmp/Vgraph.arg @ i += 1 end endif if ("$Vgraph" != "") goto do_Plot ###################################################################### # Step 1: No Vgraph defined ==> Prepare the Frame ###################################################################### unsetenv Vgraph if ($local) then echo1 "{\bf\fg{blue}Arguments=$* }\br" echo1 "{\bf\fg{blue}inplot=$inplot }\br" #echo1 "\begin{verbatim}" #printenv | sort endif set ploty = ( -y - - - ) if ($local) then #echo1 "\end{verbatim}" #echo1 "{\bf\fg{blue}Arguments=$* }\br" echo1 "{\bf\fg{blue}pwd=$cwd }\br" endif ## Introduction cat <<====StarPage \begin{center}\bf\large Variation de l'\'etoile \quad {\em Variation of the star }\br ====StarPage ## Title includes links to Simbad / VizieR / Aladin echo $Star | gawk ' # sname = name for Simbad \ /^sn[12]/{sname=$1}/^n[a-z][a-z]/{sname=$1}\ {if(sname=="") sname="GCVS " $0; printf("\\bf\\large\\fg{red3}%s (", $0); \ printf("\\glutag{smb.query,w \"%s\"|Simbad}\n", sname); printf("\\cdot{ }");\ printf("\\glutag{SimViz,w \"V* %s %s\"|VizieR}\n",$1,$2);\ #printf("\\glutag{VizDetail.www 2214/gcvs \"GCVS=%s *%s\"|VizieR}\n",$1,$2);\ printf("\\cdot{ }"); \ printf("\\glutag{AladinJava,w \"%s\" 10 Aladin,Simbad,VizieR GSC1.2|Aladin}",\ sname); printf(")\n"); \ sname=""; }\ ' cgigraph -img -ps:"Postscript Figure" -txt:"Data as a Table" -form -nolog -htx \ P=$P Ep=$Ep -graph $ploty:q $argv:q echo1 "\end{center}" exit 0 do_Plot: ###################################################################### # Step 2: Vgraph defined (ps, gif, etc) ==> Actual Plot # Xarg and xarg are defined (from timeSerie.csh) ###################################################################### # Write the header (done in Vgraph too) switch("$Vgraph") case "gif": echo "Content-type:image/gif"; echo "" breaksw case "ps": echo "Content-type:application/postscript" echo "Content-Disposition: inline; filename='$*.ps'" echo "" breaksw case "htm*": echo "Content-type:text/html"; echo "" breaksw case "htx": echo "Content-type:text/htx"; echo "" breaksw case "txt": echo "Content-type:text/plain"; echo "" breaksw default: set error_title = "'$Vgraph' option" set error_text = "Related to $cwd" goto vizError endsw #set verbose set Y = "mag (BVRI)" set filters = "1= AHN:2=BGM:3=JOCQ:4=PK" ; # Colors vs Magnitude Symbols set tt = /tmp/afoev.$$ # Temporary File echo2 "....afoev: limits in JD: lims=$xlim" fcat $theTab | gawk -v P=$P -v filters="$filters" -v Ep=$Ep -v lims="$xlim" '\ BEGIN{ split(lims,lim," "); ncol=split(filters, col, ":"); mmax=-20;mmin=99;\ if (Ep >= 2400000) Ep -= 2400000; if (P>0) ph0 = (Ep/P) - int(Ep/P)}\ { u=substr($0,15,1); m=substr($0,16,5); c=substr($0,14,1);\ if(m == " ")next; m = m+0;if(m>mmax)mmax=m; if(m 0) { if (jd < lim[1]) next }\ if (lim[2] > 0) { if (jd > lim[2]) next }\ if(jd0==0) jd0=int(jd); jd1=int(jd+1);\ if (P>0) {N=int(jd/P); jd = (jd/P) - N + ph0; if (jd>=1) jd -= 1; }\ for(k=1;k<=ncol; k++){if(index(col[k],c)>0)break}\ if (u != " ") k += 10; print k,jd,m; # Limit indicator\ }\ END{print "\t" mmin-0.1,mmax+0.1, jd0, jd1}\ ' | sort > $tt # $tt contains a first line with "\t mag-min mag-max JDmin JDmax" magnitudes set lims = `head -1 $tt` #echo2 "....afoev: limit line: lims=$lims" #echo2 "....afoev: call graph -T $Vgraph ... -X "$Xarg" -Y "$Y" -m -1 $argv:q" gawk 'NR==1{sym[5]=6; sym[6]=5; next}\ { if($1 != symb) { \ symb=$1; col=$1%10; S=symb+1; \ if (S>10) S=10;if(S in sym) S = sym[S]; \ printf("# m = -%d, S = %s\n", col, S)\ }\ print $2,$3;\ }' $tt \ | tee /tmp/vizPlot\ | graph -T $Vgraph --pen-colors 1=green3:2=blue3:3=red3:4=red4:5=black \ -C -S 3 -w 0.86 -r 0.11 -h 0.75 -u 0.1 -f 0.035 \ --title-font-size 0.05 -L "$Star (JD24$lims[3]/$lims[4])" \ $Xarg:q $xarg:q -Y "$Y" -m -1 $argv:q \ | tee /tmp/vizPlot.$Vgraph rm -f $tt exit 0