From 37ba3a5f18112d2453f427388b66b1da6fdcb5e7 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 8 Mar 2015 18:42:07 -0400 Subject: General cleanup. Purge fixed paths. --- scripts/Makefile.am | 9 +- scripts/Makefile.in | 9 +- scripts/calfuse.wavecal | 4 +- scripts/cf_make_all.csh | 487 ---------------------------------------- scripts/cf_make_all.csh.in | 487 ++++++++++++++++++++++++++++++++++++++++ scripts/cfsetup.csh.in | 2 +- src/cal/get_tle/GetTLE.class.in | Bin 2897 -> 0 bytes src/cal/get_tle/GetTLE.java.in | 5 +- src/cal/get_tle/Makefile.am | 21 +- src/cal/get_tle/Makefile.in | 92 +++++--- 10 files changed, 574 insertions(+), 542 deletions(-) delete mode 100755 scripts/cf_make_all.csh create mode 100755 scripts/cf_make_all.csh.in delete mode 100644 src/cal/get_tle/GetTLE.class.in diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 981689b..9f94a0c 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -19,14 +19,15 @@ EXTRA_DIST = \ calfuse.sh \ calfuse.wavecal \ cf_make_900_obs.csh \ - cf_make_all.csh \ + cf_make_all.csh.in \ cf_make_all_obs.csh \ idl_obsplot.pl \ idlplot_rate.pl \ idlplot_spex.pl CLEANFILES = cfsetup.csh \ - cfsetup.sh + cfsetup.sh \ + cf_make_all.csh do_subst = sed -e 's,[@]DATADIR[@],$(pkgdatadir)-$(VERSION),g' \ -e 's,[@]PREFIX[@],$(prefix),g' \ @@ -39,3 +40,7 @@ cfsetup.csh: cfsetup.csh.in Makefile cfsetup.sh: cfsetup.sh.in Makefile $(do_subst) < cfsetup.sh.in > cfsetup.sh chmod +x cfsetup.sh + +cf_make_all.csh: cf_make_all.csh.in Makefile + $(do_subst) < cf_make_all.csh.in > cf_make_all.csh + chmod +x cf_make_all.csh diff --git a/scripts/Makefile.in b/scripts/Makefile.in index b1a79bf..4dc5d3f 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -357,14 +357,15 @@ EXTRA_DIST = \ calfuse.sh \ calfuse.wavecal \ cf_make_900_obs.csh \ - cf_make_all.csh \ + cf_make_all.csh.in \ cf_make_all_obs.csh \ idl_obsplot.pl \ idlplot_rate.pl \ idlplot_spex.pl CLEANFILES = cfsetup.csh \ - cfsetup.sh + cfsetup.sh \ + cf_make_all.csh do_subst = sed -e 's,[@]DATADIR[@],$(pkgdatadir)-$(VERSION),g' \ -e 's,[@]PREFIX[@],$(prefix),g' \ @@ -730,6 +731,10 @@ cfsetup.sh: cfsetup.sh.in Makefile $(do_subst) < cfsetup.sh.in > cfsetup.sh chmod +x cfsetup.sh +cf_make_all.csh: cf_make_all.csh.in Makefile + $(do_subst) < cf_make_all.csh.in > cf_make_all.csh + chmod +x cf_make_all.csh + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/scripts/calfuse.wavecal b/scripts/calfuse.wavecal index fc00c54..552efda 100755 --- a/scripts/calfuse.wavecal +++ b/scripts/calfuse.wavecal @@ -63,10 +63,10 @@ set ttag = `echo $froot | grep -c ttag` # Put a time stamp in the log file (the OPUS trailer file). if $ttag then - echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin TTAG file $1" + echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin TTAG file $1" echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin TTAG file $1" >>& $logfile else - echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin HIST file $1" + echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin HIST file $1" echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Begin HIST file $1" >>& $logfile endif diff --git a/scripts/cf_make_all.csh b/scripts/cf_make_all.csh deleted file mode 100755 index b63fde0..0000000 --- a/scripts/cf_make_all.csh +++ /dev/null @@ -1,487 +0,0 @@ -#!/usr/bin/env tcsh -f - -#****************************************************************************** -#* Johns Hopkins University -#* Center For Astrophysical Sciences -#* FUSE -#****************************************************************************** -#* -#* Synopsis: cf_make_all.csh -#* -#* Description: Creates 3 files from a Calfuse output (properly run): -#* -#* 1) An "all" file containing 1 extension per detector (= 8). -#* Each extension contains a combined spectrum from the set -#* of exposures, using "Xcorr" or "Background" method. -#* 2) In the case of TTAG data, creates an "ano" file. Same as -#* the "all" file but considering "night only" exposure time. -#* 3) A National Virtual Observatory "nvo" file. One extension -#* containing wavelengths that span the whole FUSE range. -#* -#* The Xcorr method consists in co-adding spectra, the latter -#* being corrected for a possible shift. The Background method -#* consists in combining all the IDF files. -#* -#* The Xcorr test is performed on 4 (detector, channel) pairs, the -#* method of other pairs are given by them: -#* LiF 1a -> Lif 1b -#* LiF 2b -> LiF 2a -#* SiC 1a -> Sic 1b -#* Sic 2b -> Sic 2a -#* In the script, the left segments are referred as to $seg (or -#* $det) and the right segments are referred as to $seg2 (or -#* $det2). -#* -#* When an expected data set is missing, the script stops, cleans -#* directory, and returns 1. -#* -#* History: 04/15/05 1.0 tc First release -#* -#*****************************************************************************/ - -# Set program path -set rm = "rm -f" - -set cf_xcorr = cf_xcorr -set cf_combine = cf_combine -set cf_pack = cf_pack -set cf_nvo = cf_nvo -set modhead = modhead - -#set cf_xcorr = /home/vela/civeit/Work/CalFuse/Xcorr/New/cf_xcorr -#set cf_combine = /home/vela/civeit/Work/CalFuse/Shiftexp/cf_combine -#set cf_pack = /home/vela/civeit/Work/CalFuse/Pack/cf_pack -#set cf_nvo = /home/vela/civeit/Work/CalFuse/Nvo/cf_nvo -#set modhead = /home/vela/civeit/local/bin/modhead - -set cf_obsplot = /data1/fuse/calfuse/v3.1/idl/cf_obsplot.pro - - -# Init var list -set detector = (1a 2b) -set channel = (lif sic) -set resolution = (2 3 4) -set obsmod = (hist ttag) - -# Determine the root name -ls [A-Z][0-9][0-9][0-9][0-9][0-9][0-9][0-9]000asnf.fit >& tmp_asnf -if ($? == 0) then - set asnf = `cat tmp_asnf` - set rn = ${asnf:s/000asnf.fit//} - $rm tmp_asnf -else - echo "ERROR: asnf file is missing" - $rm tmp_asnf - goto crash -endif - -# Clean tmp files that the script will create (safe) -$rm tmp_xcorr.res tmp_bpm1.lis tmp_bpm2.lis tmp_combine.lis tmp_night_exp.lis -$rm tmp_all_night_exp.lis tmp_good_exp.lis tmp_exp.lis tmp_seg_dn.lis tmp_seg_no.lis -$rm DN_${rn}*.fit NO_${rn}*.fit - -foreach om ($obsmod) - foreach res ($resolution) - foreach chan ($channel) - foreach det ($detector) - - # Find exposures that match the current segment - set seg = $det$chan$res$om - ls ${rn}[0-8][0-9][0-9]${seg}fcal.fit |& grep -v 000 > tmp_exp.lis # Reject EXP "9xx" and "000" - - if ($? == 0) then # There are one or more exposures - - echo " " - echo "*** Processing: $seg ***" - # [1a][lif] -> [1b][lif], [2b][lif] -> [2a][lif] etc... - if ($det == 1a) set det2 = 1b - if ($det == 2b) set det2 = 2a - set seg2 = $det2$chan$res$om - - echo "----- cf_xcorr input -----" - cat tmp_exp.lis - echo "----------------------------" - $cf_xcorr tmp_exp.lis tmp_xcorr.res # Compute shift and sigma_shift - echo "----- cf_xcorr results -----" - cat tmp_xcorr.res - echo "----------------------------" - - awk '{if ($5 > 0) print $6, $4, $5}' tmp_xcorr.res > tmp_all_night_exp.lis - awk '{if ($3 >= 0) print $6,$2}' tmp_xcorr.res > tmp_good_exp.lis - awk '{if (($3 >= 0) && ($5 > 0)) print $6,$2, $4, $5}' tmp_xcorr.res > tmp_night_exp.lis - set time_good = `awk 'BEGIN{$t = 0} {if ($3 >= 0) $t = $t + $4} END{print $t}' tmp_xcorr.res` - set time_bad = `awk 'BEGIN{$t = 0} {if ($3 < 0) $t = $t + $4} END{print $t}' tmp_xcorr.res` - echo "Xcorr time: $time_good - Background time: $time_bad" - - if ($time_good > 2 * $time_bad) then - - # - # --- Path 1: Optimize resolution --- - # - - echo "Optimize resolution..." - set n_good = `cat tmp_good_exp.lis | wc -l` - - # Extract [Day + Night] spectra - set s = DN_${rn}000${seg}fcal.fit - awk '{print "'$rn'"$1"'$seg'fcal.fit",$2}' tmp_good_exp.lis > tmp_combine.lis # Combine $seg [dn] - $cf_combine tmp_combine.lis $s -k - # $modhead "${s}[1]" NUM_EXP $n_good - $modhead "${s}[1]" COMBMETH XCORR - echo $s >> tmp_seg_dn.lis - - set s = DN_${rn}000${seg2}fcal.fit - awk '{print "'$rn'"$1"'$seg2'fcal.fit",$2}' tmp_good_exp.lis > tmp_combine.lis # Combine $seg2 [dn] - $cf_combine tmp_combine.lis $s -k - # $modhead "${s}[1]" NUM_EXP $n_good - $modhead "${s}[1]" COMBMETH XCORR - echo $s >> tmp_seg_dn.lis - - set n_night = `cat tmp_night_exp.lis | wc -l` - if ($om == ttag && $n_night > 0) then # Create and combine night only files - - echo "*** Creating night only files ***" - set exp_nums = `awk '{print $1}' tmp_night_exp.lis` - - foreach exp ($exp_nums) - - # Create night-only BPM and FCAL files if they do not already exist. - set bno1 = NO_$rn$exp$det${om}fbpm.fit # Bad-pixel maps - set bno2 = NO_$rn$exp$det2${om}fbpm.fit - set cno1 = NO_$rn$exp${seg}fcal.fit # Extracted spectra - set cno2 = NO_$rn$exp${seg2}fcal.fit - - set etime = `egrep "^$exp" tmp_night_exp.lis | awk '{print $3}'` - set ntime = `egrep "^$exp" tmp_night_exp.lis | awk '{print $4}'` - set ratio = `egrep "^$exp" tmp_night_exp.lis | awk '{printf "%.0f", 0.5+$4/$3*10.}'` - - if (!(-e $cno1)) then - if ($etime == $ntime) then - echo "$cno1 is a symbolic link to $rn$exp${seg}fcal.fit" - ln -s $rn$exp${seg}fcal.fit $cno1 - else - - set idf_file = $rn$exp$det${om}fidf.fit - if (!(-e $bno1)) then - if ($ratio > 9) then - echo "$bno1 is a symbolic link to $rn$exp$det${om}fbpm.fit" - ln -s $rn$exp$det${om}fbpm.fit $bno1 - else - echo "Creating BPM: $bno1 ..." - cf_bad_pixels -n $bno1 $idf_file - endif - endif - - echo "Creating (LiF + SiC) FCAL: $cno1 ..." - cf_extract_spectra -n $bno1 -r NO_$rn$exp $idf_file # Existence of $bno1 is not required - endif - endif - - if (!(-e $cno2)) then - if ($etime == $ntime) then - echo "Using a symbolic link to $cno2" - ln -s $rn$exp${seg2}fcal.fit NO_$rn$exp${seg2}fcal.fit - else - - set idf_file = $rn$exp$det2${om}fidf.fit - if (!(-e $bno2)) then - if ($ratio > 9) then - echo "Using a symbolic link to $bno2" - ln -s $rn$exp$det2${om}fbpm.fit NO_$rn$exp$det2${om}fbpm.fit - else - echo "Creating BPM: $bno2 ..." - cf_bad_pixels -n $bno2 $idf_file - endif - endif - - echo "Creating (LiF + SiC) FCAL: $cno2 ..." - cf_extract_spectra -n $bno2 -r NO_$rn$exp $idf_file # Existence of $bno2 is not required - endif - endif - - end - - # Combine exposures into a single spectrum. - set s = NO_${rn}000${seg}fcal.fit - awk '{print "NO_'$rn'"$1"'$seg'fcal.fit",$2}' tmp_night_exp.lis > tmp_combine.lis # Combine $seg [no] - $cf_combine tmp_combine.lis $s -k - # $modhead "${s}[1]" NUM_EXP $n_night - $modhead "${s}[0]" DAYNIGHT NIGHT - $modhead "${s}[1]" COMBMETH XCORR - echo $s >> tmp_seg_no.lis - - set s = NO_${rn}000${seg2}fcal.fit - awk '{print "NO_'$rn'"$1"'$seg2'fcal.fit",$2}' tmp_night_exp.lis > tmp_combine.lis # Combine $seg2 [no] - $cf_combine tmp_combine.lis $s -k - # $modhead "${s}[1]" NUM_EXP $n_night - $modhead "${s}[0]" DAYNIGHT NIGHT - $modhead "${s}[1]" COMBMETH XCORR - echo $s >> tmp_seg_no.lis - - endif - - else - - # - # --- Path 2: Optimize background --- - # - - echo "Optimize background..." - - # Combine IDF files - set idf1_all = DN_${rn}000$det${om}fidf.fit # Same for [dn] and [no] - set idf2_all = DN_${rn}000$det2${om}fidf.fit - - if (!(-e $idf1_all)) then - echo "Creating IDF: $idf1_all ..." - ls ${rn}[0-8][0-9][0-9]$det${om}fidf.fit |& grep -v 000 > tmp_idf.lis # Reject EXP "9xx" and "000" - if ($? == 0) then # IDF files exist - - set idf_lis = `awk '{printf "%s ",$1}' tmp_idf.lis` - idf_combine -c $idf1_all $idf_lis # Create combined IDF file for $seg - $rm tmp_idf.lis - - else - - echo "ERROR: IDF files are missing" - $rm -f tmp_idf.lis - goto crash - - endif - endif - - if (!(-e $idf2_all)) then - echo "Creating IDF: $idf2_all ..." - ls ${rn}[0-8][0-9][0-9]$det2${om}fidf.fit |& grep -v 000 > tmp_idf.lis # Reject EXP "9xx" and "000" - if ($? == 0) then # IDF files exist - - set idf_lis = `awk '{printf "%s ",$1}' tmp_idf.lis` - idf_combine $idf2_all $idf_lis # Create combined IDF file for $seg2 - $rm tmp_idf.lis - - else - - echo "ERROR: IDF files are missing" - $rm -f tmp_idf.lis - goto crash - - endif - endif - - # Get the number of (valid) combined IDF files - set tmp_buf = `$modhead $idf1_all NSPEC` - set n_comb1 = $tmp_buf[3] - set tmp_buf = `$modhead $idf1_all SPEC001` - set idf1_1 = $tmp_buf[3] - set tmp_buf = `$modhead $idf2_all NSPEC` - set n_comb2 = $tmp_buf[3] - set tmp_buf = `$modhead $idf2_all SPEC001` - set idf2_1 = $tmp_buf[3] - - # Combine BPM files - set bpm1_all = DN_${rn}000$det${om}fbpm.fit - set bpm2_all = DN_${rn}000$det2${om}fbpm.fit - - if (!(-e $bpm1_all)) then - echo "Combine all BPM (from IDF): $bpm1_all ..." - bpm_combine $bpm1_all $idf1_all # Create combined BPM file [dn] for $seg - endif - - if (!(-e $bpm2_all)) then - echo "Combine all BPM (from IDF): $bpm2_all ..." - bpm_combine $bpm2_all $idf2_all # Idem for $seg2 - endif - - # Extract [Day + Night] spectra - set s = DN_${rn}000${seg}fcal.fit - set xxx = DN_${rn}xxx${seg}fcal.fit - if (!(-e $xxx)) cf_extract_spectra -r DN_${rn}xxx $idf1_all # Avoid overwrite LiF | SiC - echo $xxx > tmp_combine.lis - $cf_combine tmp_combine.lis $s -k # Does not combine, just update keywords - $modhead "${s}[0]" NSPEC $n_comb1 - $modhead "${s}[0]" SPEC001 $idf1_1 - $modhead "${s}[1]" COMBMETH BACKGRND - echo $s >> tmp_seg_dn.lis - - set s = DN_${rn}000${seg2}fcal.fit - set xxx = DN_${rn}xxx${seg2}fcal.fit - if (!(-e $xxx)) cf_extract_spectra -r DN_${rn}xxx $idf2_all # Avoid overwrite LiF | SiC - echo $xxx > tmp_combine.lis - $cf_combine tmp_combine.lis $s -k # Does not combine, just update keywords - $modhead "${s}[0]" NSPEC $n_comb2 - $modhead "${s}[0]" SPEC001 $idf2_1 - $modhead "${s}[1]" COMBMETH BACKGRND - echo $s >> tmp_seg_dn.lis - - set n_night = `cat tmp_all_night_exp.lis | wc -l` - if ($om == ttag && $n_night > 0) then # Create and combine night only files - - echo "*** Creating night only files ***" - set exp_nums = `awk '{print $1}' tmp_all_night_exp.lis` - $rm tmp_bpm1.lis tmp_bpm2.lis - - foreach exp ($exp_nums) - - # Create bpm night only files (if they do not exist yet) - set bno1 = NO_$rn$exp$det${om}fbpm.fit - set bno2 = NO_$rn$exp$det2${om}fbpm.fit - - set idf_file = $rn$exp$det${om}fidf.fit - if (!(-e $bno1)) then - echo "Creating BPM: $bno1 ..." - cf_bad_pixels -n $bno1 $idf_file - endif - if (-e $bno1) echo $bno1 >> tmp_bpm1.lis # If valid, add in $seg list - - set idf_file = $rn$exp$det2${om}fidf.fit - if (!(-e $bno2)) then - echo "Creating BPM: $bno2 ..." - cf_bad_pixels -n $bno2 $idf_file - endif - if (-e $bno2) echo $bno2 >> tmp_bpm2.lis # If valid, add in $seg2 list - - end - - - # Combine BPM for $seg and extract spectra - - set bpm1_all = NO_${rn}000$det${om}fbpm.fit - set n_bpm = `cat tmp_bpm1.lis | wc -l` - echo "Number of valid BPM files: $n_bpm" - - if ($n_bpm > 0) then - - echo $n_bpm > tmp_bpm.lis - cat tmp_bpm1.lis >> tmp_bpm.lis - - if (!(-e $bpm1_all)) then - echo "Combine all BPM (from list): $bpm1_all ..." - bpm_combine $bpm1_all tmp_bpm.lis # Create combined BPM file [no] for $seg - endif - $rm tmp_bpm.lis - - endif - - # Extract [Night only] spectra. The existence of $bpm1_all is not required - set s = NO_${rn}000${seg}fcal.fit - set xxx = NO_${rn}xxx${seg}fcal.fit - if (!(-e $xxx)) cf_extract_spectra -n $bpm1_all -r NO_${rn}xxx $idf1_all # Avoid overwrite LiF | SiC - echo $xxx > tmp_combine.lis - $cf_combine tmp_combine.lis $s -k # Does not combine, just update keywords - $modhead "${s}[0]" NSPEC $n_comb1 - $modhead "${s}[0]" SPEC001 $idf1_1 - $modhead "${s}[1]" COMBMETH BACKGRND - echo $s >> tmp_seg_no.lis - - - # Combine BPM for $seg2 and extract spectra - - set bpm2_all = NO_${rn}000$det2${om}fbpm.fit - set n_bpm = `cat tmp_bpm2.lis | wc -l` - echo "Number of valid BPM files: $n_bpm" - - if ($n_bpm > 0) then - - echo $n_bpm > tmp_bpm.lis - cat tmp_bpm2.lis >> tmp_bpm.lis - - if (!(-e $bpm2_all)) then - echo "Combine all BPM (from list): $bpm2_all ..." - bpm_combine $bpm2_all tmp_bpm.lis # Create combined BPM file [no] for $seg2 - endif - $rm tmp_bpm.lis - - endif - - # Extract [Night only] spectra. The existence of $bpm2_all is not required - set s = NO_${rn}000${seg2}fcal.fit - set xxx = NO_${rn}xxx${seg2}fcal.fit - if (!(-e $xxx)) cf_extract_spectra -n $bpm2_all -r NO_${rn}xxx $idf2_all # Avoid overwrite LiF | SiC - echo $xxx > tmp_combine.lis - $cf_combine tmp_combine.lis $s -k # Does not combine, just update keywords - $modhead "${s}[0]" NSPEC $n_comb2 - $modhead "${s}[0]" SPEC001 $idf2_1 - $modhead "${s}[1]" COMBMETH BACKGRND - echo $s >> tmp_seg_no.lis - - endif - endif - endif - end - - $rm tmp_xcorr.res tmp_bpm1.lis tmp_bpm2.lis tmp_combine.lis - $rm tmp_all_night_exp.lis tmp_good_exp.lis tmp_exp.lis tmp_night_exp.lis - - end - - # Pack the 8 [detector][channel] pairs together ([dn] and [no] for ttag) - if (-e tmp_seg_dn.lis) then - - set fcal_all = ${rn}00000all$res${om}fcal.fit # Final output name - $rm $fcal_all # Clean (safe) - set n_segs = `cat tmp_seg_dn.lis | wc -l` - - if (!($n_segs == 8)) then - - @ mseg = 8 - $n_segs - echo "ERROR: $mseg (day + night) segments are missing" - $rm tmp_seg_dn.lis - goto crash - - else - - $cf_pack tmp_seg_dn.lis $fcal_all - $rm tmp_seg_dn.lis - - # Plot figures - echo ".compile '$cf_obsplot'" > tmp_idl_batch - echo "cf_obsplot, '$rn'" >> tmp_idl_batch - echo "exit" >> tmp_idl_batch - idl tmp_idl_batch - $rm tmp_idl_batch - - # Create National Virtual Observatory file - set nvo_file = ${rn}00000nvo$res${om}fcal.fit - $rm $nvo_file # Clean (safe) - $cf_nvo $fcal_all $nvo_file # Create file - - if (-e tmp_seg_no.lis) then - - set fcal_all = ${rn}00000ano$res${om}fcal.fit # Final output name - $rm $fcal_all # Clean (safe) - set n_segs = `cat tmp_seg_no.lis | wc -l` - - if (!($n_segs == 8)) then - - @ mseg = 8 - $n_segs - echo "ERROR: $mseg (night only) segments are missing" - $rm tmp_seg_no.lis - goto crash - - else - - $cf_pack tmp_seg_no.lis $fcal_all - $rm tmp_seg_no.lis - - endif - - endif - endif - endif - end -end - -# Clean [dn] and [no] files. Just keep: all, (ano) and nvo -$rm DN_${rn}*.fit NO_${rn}*.fit -exit(0) - - -crash: # Procedure when script crashes - -# Clean directory -$rm tmp_xcorr.res tmp_bpm1.lis tmp_bpm2.lis tmp_combine.lis tmp_night_exp.lis -$rm tmp_all_night_exp.lis tmp_good_exp.lis tmp_exp.lis tmp_seg_dn.lis tmp_seg_no.lis -$rm DN_*.fit NO_*.fit - -# Return 1 -exit(1) diff --git a/scripts/cf_make_all.csh.in b/scripts/cf_make_all.csh.in new file mode 100755 index 0000000..25abc93 --- /dev/null +++ b/scripts/cf_make_all.csh.in @@ -0,0 +1,487 @@ +#!/usr/bin/env tcsh -f + +#****************************************************************************** +#* Johns Hopkins University +#* Center For Astrophysical Sciences +#* FUSE +#****************************************************************************** +#* +#* Synopsis: cf_make_all.csh +#* +#* Description: Creates 3 files from a Calfuse output (properly run): +#* +#* 1) An "all" file containing 1 extension per detector (= 8). +#* Each extension contains a combined spectrum from the set +#* of exposures, using "Xcorr" or "Background" method. +#* 2) In the case of TTAG data, creates an "ano" file. Same as +#* the "all" file but considering "night only" exposure time. +#* 3) A National Virtual Observatory "nvo" file. One extension +#* containing wavelengths that span the whole FUSE range. +#* +#* The Xcorr method consists in co-adding spectra, the latter +#* being corrected for a possible shift. The Background method +#* consists in combining all the IDF files. +#* +#* The Xcorr test is performed on 4 (detector, channel) pairs, the +#* method of other pairs are given by them: +#* LiF 1a -> Lif 1b +#* LiF 2b -> LiF 2a +#* SiC 1a -> Sic 1b +#* Sic 2b -> Sic 2a +#* In the script, the left segments are referred as to $seg (or +#* $det) and the right segments are referred as to $seg2 (or +#* $det2). +#* +#* When an expected data set is missing, the script stops, cleans +#* directory, and returns 1. +#* +#* History: 04/15/05 1.0 tc First release +#* +#*****************************************************************************/ + +# Set program path +set rm = "rm -f" + +set cf_xcorr = cf_xcorr +set cf_combine = cf_combine +set cf_pack = cf_pack +set cf_nvo = cf_nvo +set modhead = modhead + +#set cf_xcorr = /home/vela/civeit/Work/CalFuse/Xcorr/New/cf_xcorr +#set cf_combine = /home/vela/civeit/Work/CalFuse/Shiftexp/cf_combine +#set cf_pack = /home/vela/civeit/Work/CalFuse/Pack/cf_pack +#set cf_nvo = /home/vela/civeit/Work/CalFuse/Nvo/cf_nvo +#set modhead = /home/vela/civeit/local/bin/modhead + +set cf_obsplot = @DATADIR@/idl/cf_obsplot.pro + + +# Init var list +set detector = (1a 2b) +set channel = (lif sic) +set resolution = (2 3 4) +set obsmod = (hist ttag) + +# Determine the root name +ls [A-Z][0-9][0-9][0-9][0-9][0-9][0-9][0-9]000asnf.fit >& tmp_asnf +if ($? == 0) then + set asnf = `cat tmp_asnf` + set rn = ${asnf:s/000asnf.fit//} + $rm tmp_asnf +else + echo "ERROR: asnf file is missing" + $rm tmp_asnf + goto crash +endif + +# Clean tmp files that the script will create (safe) +$rm tmp_xcorr.res tmp_bpm1.lis tmp_bpm2.lis tmp_combine.lis tmp_night_exp.lis +$rm tmp_all_night_exp.lis tmp_good_exp.lis tmp_exp.lis tmp_seg_dn.lis tmp_seg_no.lis +$rm DN_${rn}*.fit NO_${rn}*.fit + +foreach om ($obsmod) + foreach res ($resolution) + foreach chan ($channel) + foreach det ($detector) + + # Find exposures that match the current segment + set seg = $det$chan$res$om + ls ${rn}[0-8][0-9][0-9]${seg}fcal.fit |& grep -v 000 > tmp_exp.lis # Reject EXP "9xx" and "000" + + if ($? == 0) then # There are one or more exposures + + echo " " + echo "*** Processing: $seg ***" + # [1a][lif] -> [1b][lif], [2b][lif] -> [2a][lif] etc... + if ($det == 1a) set det2 = 1b + if ($det == 2b) set det2 = 2a + set seg2 = $det2$chan$res$om + + echo "----- cf_xcorr input -----" + cat tmp_exp.lis + echo "----------------------------" + $cf_xcorr tmp_exp.lis tmp_xcorr.res # Compute shift and sigma_shift + echo "----- cf_xcorr results -----" + cat tmp_xcorr.res + echo "----------------------------" + + awk '{if ($5 > 0) print $6, $4, $5}' tmp_xcorr.res > tmp_all_night_exp.lis + awk '{if ($3 >= 0) print $6,$2}' tmp_xcorr.res > tmp_good_exp.lis + awk '{if (($3 >= 0) && ($5 > 0)) print $6,$2, $4, $5}' tmp_xcorr.res > tmp_night_exp.lis + set time_good = `awk 'BEGIN{$t = 0} {if ($3 >= 0) $t = $t + $4} END{print $t}' tmp_xcorr.res` + set time_bad = `awk 'BEGIN{$t = 0} {if ($3 < 0) $t = $t + $4} END{print $t}' tmp_xcorr.res` + echo "Xcorr time: $time_good - Background time: $time_bad" + + if ($time_good > 2 * $time_bad) then + + # + # --- Path 1: Optimize resolution --- + # + + echo "Optimize resolution..." + set n_good = `cat tmp_good_exp.lis | wc -l` + + # Extract [Day + Night] spectra + set s = DN_${rn}000${seg}fcal.fit + awk '{print "'$rn'"$1"'$seg'fcal.fit",$2}' tmp_good_exp.lis > tmp_combine.lis # Combine $seg [dn] + $cf_combine tmp_combine.lis $s -k + # $modhead "${s}[1]" NUM_EXP $n_good + $modhead "${s}[1]" COMBMETH XCORR + echo $s >> tmp_seg_dn.lis + + set s = DN_${rn}000${seg2}fcal.fit + awk '{print "'$rn'"$1"'$seg2'fcal.fit",$2}' tmp_good_exp.lis > tmp_combine.lis # Combine $seg2 [dn] + $cf_combine tmp_combine.lis $s -k + # $modhead "${s}[1]" NUM_EXP $n_good + $modhead "${s}[1]" COMBMETH XCORR + echo $s >> tmp_seg_dn.lis + + set n_night = `cat tmp_night_exp.lis | wc -l` + if ($om == ttag && $n_night > 0) then # Create and combine night only files + + echo "*** Creating night only files ***" + set exp_nums = `awk '{print $1}' tmp_night_exp.lis` + + foreach exp ($exp_nums) + + # Create night-only BPM and FCAL files if they do not already exist. + set bno1 = NO_$rn$exp$det${om}fbpm.fit # Bad-pixel maps + set bno2 = NO_$rn$exp$det2${om}fbpm.fit + set cno1 = NO_$rn$exp${seg}fcal.fit # Extracted spectra + set cno2 = NO_$rn$exp${seg2}fcal.fit + + set etime = `egrep "^$exp" tmp_night_exp.lis | awk '{print $3}'` + set ntime = `egrep "^$exp" tmp_night_exp.lis | awk '{print $4}'` + set ratio = `egrep "^$exp" tmp_night_exp.lis | awk '{printf "%.0f", 0.5+$4/$3*10.}'` + + if (!(-e $cno1)) then + if ($etime == $ntime) then + echo "$cno1 is a symbolic link to $rn$exp${seg}fcal.fit" + ln -s $rn$exp${seg}fcal.fit $cno1 + else + + set idf_file = $rn$exp$det${om}fidf.fit + if (!(-e $bno1)) then + if ($ratio > 9) then + echo "$bno1 is a symbolic link to $rn$exp$det${om}fbpm.fit" + ln -s $rn$exp$det${om}fbpm.fit $bno1 + else + echo "Creating BPM: $bno1 ..." + cf_bad_pixels -n $bno1 $idf_file + endif + endif + + echo "Creating (LiF + SiC) FCAL: $cno1 ..." + cf_extract_spectra -n $bno1 -r NO_$rn$exp $idf_file # Existence of $bno1 is not required + endif + endif + + if (!(-e $cno2)) then + if ($etime == $ntime) then + echo "Using a symbolic link to $cno2" + ln -s $rn$exp${seg2}fcal.fit NO_$rn$exp${seg2}fcal.fit + else + + set idf_file = $rn$exp$det2${om}fidf.fit + if (!(-e $bno2)) then + if ($ratio > 9) then + echo "Using a symbolic link to $bno2" + ln -s $rn$exp$det2${om}fbpm.fit NO_$rn$exp$det2${om}fbpm.fit + else + echo "Creating BPM: $bno2 ..." + cf_bad_pixels -n $bno2 $idf_file + endif + endif + + echo "Creating (LiF + SiC) FCAL: $cno2 ..." + cf_extract_spectra -n $bno2 -r NO_$rn$exp $idf_file # Existence of $bno2 is not required + endif + endif + + end + + # Combine exposures into a single spectrum. + set s = NO_${rn}000${seg}fcal.fit + awk '{print "NO_'$rn'"$1"'$seg'fcal.fit",$2}' tmp_night_exp.lis > tmp_combine.lis # Combine $seg [no] + $cf_combine tmp_combine.lis $s -k + # $modhead "${s}[1]" NUM_EXP $n_night + $modhead "${s}[0]" DAYNIGHT NIGHT + $modhead "${s}[1]" COMBMETH XCORR + echo $s >> tmp_seg_no.lis + + set s = NO_${rn}000${seg2}fcal.fit + awk '{print "NO_'$rn'"$1"'$seg2'fcal.fit",$2}' tmp_night_exp.lis > tmp_combine.lis # Combine $seg2 [no] + $cf_combine tmp_combine.lis $s -k + # $modhead "${s}[1]" NUM_EXP $n_night + $modhead "${s}[0]" DAYNIGHT NIGHT + $modhead "${s}[1]" COMBMETH XCORR + echo $s >> tmp_seg_no.lis + + endif + + else + + # + # --- Path 2: Optimize background --- + # + + echo "Optimize background..." + + # Combine IDF files + set idf1_all = DN_${rn}000$det${om}fidf.fit # Same for [dn] and [no] + set idf2_all = DN_${rn}000$det2${om}fidf.fit + + if (!(-e $idf1_all)) then + echo "Creating IDF: $idf1_all ..." + ls ${rn}[0-8][0-9][0-9]$det${om}fidf.fit |& grep -v 000 > tmp_idf.lis # Reject EXP "9xx" and "000" + if ($? == 0) then # IDF files exist + + set idf_lis = `awk '{printf "%s ",$1}' tmp_idf.lis` + idf_combine -c $idf1_all $idf_lis # Create combined IDF file for $seg + $rm tmp_idf.lis + + else + + echo "ERROR: IDF files are missing" + $rm -f tmp_idf.lis + goto crash + + endif + endif + + if (!(-e $idf2_all)) then + echo "Creating IDF: $idf2_all ..." + ls ${rn}[0-8][0-9][0-9]$det2${om}fidf.fit |& grep -v 000 > tmp_idf.lis # Reject EXP "9xx" and "000" + if ($? == 0) then # IDF files exist + + set idf_lis = `awk '{printf "%s ",$1}' tmp_idf.lis` + idf_combine $idf2_all $idf_lis # Create combined IDF file for $seg2 + $rm tmp_idf.lis + + else + + echo "ERROR: IDF files are missing" + $rm -f tmp_idf.lis + goto crash + + endif + endif + + # Get the number of (valid) combined IDF files + set tmp_buf = `$modhead $idf1_all NSPEC` + set n_comb1 = $tmp_buf[3] + set tmp_buf = `$modhead $idf1_all SPEC001` + set idf1_1 = $tmp_buf[3] + set tmp_buf = `$modhead $idf2_all NSPEC` + set n_comb2 = $tmp_buf[3] + set tmp_buf = `$modhead $idf2_all SPEC001` + set idf2_1 = $tmp_buf[3] + + # Combine BPM files + set bpm1_all = DN_${rn}000$det${om}fbpm.fit + set bpm2_all = DN_${rn}000$det2${om}fbpm.fit + + if (!(-e $bpm1_all)) then + echo "Combine all BPM (from IDF): $bpm1_all ..." + bpm_combine $bpm1_all $idf1_all # Create combined BPM file [dn] for $seg + endif + + if (!(-e $bpm2_all)) then + echo "Combine all BPM (from IDF): $bpm2_all ..." + bpm_combine $bpm2_all $idf2_all # Idem for $seg2 + endif + + # Extract [Day + Night] spectra + set s = DN_${rn}000${seg}fcal.fit + set xxx = DN_${rn}xxx${seg}fcal.fit + if (!(-e $xxx)) cf_extract_spectra -r DN_${rn}xxx $idf1_all # Avoid overwrite LiF | SiC + echo $xxx > tmp_combine.lis + $cf_combine tmp_combine.lis $s -k # Does not combine, just update keywords + $modhead "${s}[0]" NSPEC $n_comb1 + $modhead "${s}[0]" SPEC001 $idf1_1 + $modhead "${s}[1]" COMBMETH BACKGRND + echo $s >> tmp_seg_dn.lis + + set s = DN_${rn}000${seg2}fcal.fit + set xxx = DN_${rn}xxx${seg2}fcal.fit + if (!(-e $xxx)) cf_extract_spectra -r DN_${rn}xxx $idf2_all # Avoid overwrite LiF | SiC + echo $xxx > tmp_combine.lis + $cf_combine tmp_combine.lis $s -k # Does not combine, just update keywords + $modhead "${s}[0]" NSPEC $n_comb2 + $modhead "${s}[0]" SPEC001 $idf2_1 + $modhead "${s}[1]" COMBMETH BACKGRND + echo $s >> tmp_seg_dn.lis + + set n_night = `cat tmp_all_night_exp.lis | wc -l` + if ($om == ttag && $n_night > 0) then # Create and combine night only files + + echo "*** Creating night only files ***" + set exp_nums = `awk '{print $1}' tmp_all_night_exp.lis` + $rm tmp_bpm1.lis tmp_bpm2.lis + + foreach exp ($exp_nums) + + # Create bpm night only files (if they do not exist yet) + set bno1 = NO_$rn$exp$det${om}fbpm.fit + set bno2 = NO_$rn$exp$det2${om}fbpm.fit + + set idf_file = $rn$exp$det${om}fidf.fit + if (!(-e $bno1)) then + echo "Creating BPM: $bno1 ..." + cf_bad_pixels -n $bno1 $idf_file + endif + if (-e $bno1) echo $bno1 >> tmp_bpm1.lis # If valid, add in $seg list + + set idf_file = $rn$exp$det2${om}fidf.fit + if (!(-e $bno2)) then + echo "Creating BPM: $bno2 ..." + cf_bad_pixels -n $bno2 $idf_file + endif + if (-e $bno2) echo $bno2 >> tmp_bpm2.lis # If valid, add in $seg2 list + + end + + + # Combine BPM for $seg and extract spectra + + set bpm1_all = NO_${rn}000$det${om}fbpm.fit + set n_bpm = `cat tmp_bpm1.lis | wc -l` + echo "Number of valid BPM files: $n_bpm" + + if ($n_bpm > 0) then + + echo $n_bpm > tmp_bpm.lis + cat tmp_bpm1.lis >> tmp_bpm.lis + + if (!(-e $bpm1_all)) then + echo "Combine all BPM (from list): $bpm1_all ..." + bpm_combine $bpm1_all tmp_bpm.lis # Create combined BPM file [no] for $seg + endif + $rm tmp_bpm.lis + + endif + + # Extract [Night only] spectra. The existence of $bpm1_all is not required + set s = NO_${rn}000${seg}fcal.fit + set xxx = NO_${rn}xxx${seg}fcal.fit + if (!(-e $xxx)) cf_extract_spectra -n $bpm1_all -r NO_${rn}xxx $idf1_all # Avoid overwrite LiF | SiC + echo $xxx > tmp_combine.lis + $cf_combine tmp_combine.lis $s -k # Does not combine, just update keywords + $modhead "${s}[0]" NSPEC $n_comb1 + $modhead "${s}[0]" SPEC001 $idf1_1 + $modhead "${s}[1]" COMBMETH BACKGRND + echo $s >> tmp_seg_no.lis + + + # Combine BPM for $seg2 and extract spectra + + set bpm2_all = NO_${rn}000$det2${om}fbpm.fit + set n_bpm = `cat tmp_bpm2.lis | wc -l` + echo "Number of valid BPM files: $n_bpm" + + if ($n_bpm > 0) then + + echo $n_bpm > tmp_bpm.lis + cat tmp_bpm2.lis >> tmp_bpm.lis + + if (!(-e $bpm2_all)) then + echo "Combine all BPM (from list): $bpm2_all ..." + bpm_combine $bpm2_all tmp_bpm.lis # Create combined BPM file [no] for $seg2 + endif + $rm tmp_bpm.lis + + endif + + # Extract [Night only] spectra. The existence of $bpm2_all is not required + set s = NO_${rn}000${seg2}fcal.fit + set xxx = NO_${rn}xxx${seg2}fcal.fit + if (!(-e $xxx)) cf_extract_spectra -n $bpm2_all -r NO_${rn}xxx $idf2_all # Avoid overwrite LiF | SiC + echo $xxx > tmp_combine.lis + $cf_combine tmp_combine.lis $s -k # Does not combine, just update keywords + $modhead "${s}[0]" NSPEC $n_comb2 + $modhead "${s}[0]" SPEC001 $idf2_1 + $modhead "${s}[1]" COMBMETH BACKGRND + echo $s >> tmp_seg_no.lis + + endif + endif + endif + end + + $rm tmp_xcorr.res tmp_bpm1.lis tmp_bpm2.lis tmp_combine.lis + $rm tmp_all_night_exp.lis tmp_good_exp.lis tmp_exp.lis tmp_night_exp.lis + + end + + # Pack the 8 [detector][channel] pairs together ([dn] and [no] for ttag) + if (-e tmp_seg_dn.lis) then + + set fcal_all = ${rn}00000all$res${om}fcal.fit # Final output name + $rm $fcal_all # Clean (safe) + set n_segs = `cat tmp_seg_dn.lis | wc -l` + + if (!($n_segs == 8)) then + + @ mseg = 8 - $n_segs + echo "ERROR: $mseg (day + night) segments are missing" + $rm tmp_seg_dn.lis + goto crash + + else + + $cf_pack tmp_seg_dn.lis $fcal_all + $rm tmp_seg_dn.lis + + # Plot figures + echo ".compile '$cf_obsplot'" > tmp_idl_batch + echo "cf_obsplot, '$rn'" >> tmp_idl_batch + echo "exit" >> tmp_idl_batch + idl tmp_idl_batch + $rm tmp_idl_batch + + # Create National Virtual Observatory file + set nvo_file = ${rn}00000nvo$res${om}fcal.fit + $rm $nvo_file # Clean (safe) + $cf_nvo $fcal_all $nvo_file # Create file + + if (-e tmp_seg_no.lis) then + + set fcal_all = ${rn}00000ano$res${om}fcal.fit # Final output name + $rm $fcal_all # Clean (safe) + set n_segs = `cat tmp_seg_no.lis | wc -l` + + if (!($n_segs == 8)) then + + @ mseg = 8 - $n_segs + echo "ERROR: $mseg (night only) segments are missing" + $rm tmp_seg_no.lis + goto crash + + else + + $cf_pack tmp_seg_no.lis $fcal_all + $rm tmp_seg_no.lis + + endif + + endif + endif + endif + end +end + +# Clean [dn] and [no] files. Just keep: all, (ano) and nvo +$rm DN_${rn}*.fit NO_${rn}*.fit +exit(0) + + +crash: # Procedure when script crashes + +# Clean directory +$rm tmp_xcorr.res tmp_bpm1.lis tmp_bpm2.lis tmp_combine.lis tmp_night_exp.lis +$rm tmp_all_night_exp.lis tmp_good_exp.lis tmp_exp.lis tmp_seg_dn.lis tmp_seg_no.lis +$rm DN_*.fit NO_*.fit + +# Return 1 +exit(1) diff --git a/scripts/cfsetup.csh.in b/scripts/cfsetup.csh.in index 69dc3df..c31a8c1 100644 --- a/scripts/cfsetup.csh.in +++ b/scripts/cfsetup.csh.in @@ -6,4 +6,4 @@ setenv PATH "${CF_DIR}/bin:${PATH}" setenv CF_CALDIR "@DATADIR@/calfiles" setenv CF_PARMDIR "@DATADIR@/parmfiles" setenv CF_IDLDIR "@DATADIR@/idl" - +setenv CF_HISTDIR `pwd` diff --git a/src/cal/get_tle/GetTLE.class.in b/src/cal/get_tle/GetTLE.class.in deleted file mode 100644 index 6d32037..0000000 Binary files a/src/cal/get_tle/GetTLE.class.in and /dev/null differ diff --git a/src/cal/get_tle/GetTLE.java.in b/src/cal/get_tle/GetTLE.java.in index 68e88d3..1f814f0 100644 --- a/src/cal/get_tle/GetTLE.java.in +++ b/src/cal/get_tle/GetTLE.java.in @@ -28,8 +28,9 @@ public class GetTLE { static final String username="mromelfanger"; static final String password="FuseJHU1"; - static final String outputFile = "/data1/fuse/calfuse/caltemp/five.tle"; - static final String logFile = "/data1/fuse/calfuse/caltemp/get_tle.logfile"; + static final String curdir = System.getProperty("user.dir"); + static final String outputFile = curdir + "/five.tle"; + static final String logFile = curdir + "/get_tle.logfile"; /* static final String outputFile = "/caltemp/five.tle"; static final String logFile = "/caltemp/get_tle.logfile"; diff --git a/src/cal/get_tle/Makefile.am b/src/cal/get_tle/Makefile.am index a2a12ee..fb50fae 100644 --- a/src/cal/get_tle/Makefile.am +++ b/src/cal/get_tle/Makefile.am @@ -1,3 +1,7 @@ +DATADIR = $(pkgdatadir)-$(VERSION) +javadir = $(DATADIR)/java +JAVAROOT = $(builddir) + bin_SCRIPTS = \ add_tle.pl \ check_tle.pl \ @@ -8,12 +12,9 @@ bin_SCRIPTS = \ test_get_tle.pl \ update_tle.csh -noinst_SCRIPTS = \ - GetTLE.class \ - GetTLE.java +java_JAVA = GetTLE.java EXTRA_DIST = \ - GetTLE.class.in \ GetTLE.java.in \ add_tle.pl.in \ check_tle.pl.in \ @@ -36,14 +37,10 @@ CLEANFILES = \ test_get_tle.pl \ update_tle.csh -do_subst = sed -e 's,[@]DATADIR[@],$(pkgdatadir)-$(VERSION),g' \ +do_subst = sed -e 's,[@]DATADIR[@],$(DATADIR),g' \ -e 's,[@]PREFIX[@],$(prefix),g' \ -e 's,[@]VERSION[@],$(VERSION),g' -GetTLE.class: GetTLE.class.in Makefile - $(do_subst) < GetTLE.class.in > GetTLE.class - chmod 644 GetTLE.class - GetTLE.java: GetTLE.java.in Makefile $(do_subst) < GetTLE.java.in > GetTLE.java chmod 644 GetTLE.java @@ -80,7 +77,5 @@ update_tle.csh: update_tle.csh.in Makefile $(do_subst) < update_tle.csh.in > update_tle.csh chmod +x update_tle.csh -install-data-local: GetTLE.class GetTLE.java - mkdir -p $(DESTDIR)$(pkgdatadir)-$(VERSION)/java - install -D -m 644 GetTLE.class $(DESTDIR)$(pkgdatadir)-$(VERSION)/java - install -D -m 644 GetTLE.java $(DESTDIR)$(pkgdatadir)-$(VERSION)/java +install-data-local: + $(INSTALL) -D -m 644 GetTLE.class $(DESTDIR)$(pkgdatadir)-$(VERSION)/java diff --git a/src/cal/get_tle/Makefile.in b/src/cal/get_tle/Makefile.in index 4b2a155..9e2aee8 100644 --- a/src/cal/get_tle/Makefile.in +++ b/src/cal/get_tle/Makefile.in @@ -128,8 +128,8 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(bindir)" -SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS) +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(javadir)" +SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -149,6 +149,9 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +JAVAC = javac +CLASSPATH_ENV = CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT)$${CLASSPATH:+":$$CLASSPATH"} +am__java_sources = $(java_JAVA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -276,6 +279,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +DATADIR = $(pkgdatadir)-$(VERSION) +javadir = $(DATADIR)/java +JAVAROOT = $(builddir) bin_SCRIPTS = \ add_tle.pl \ check_tle.pl \ @@ -286,12 +292,8 @@ bin_SCRIPTS = \ test_get_tle.pl \ update_tle.csh -noinst_SCRIPTS = \ - GetTLE.class \ - GetTLE.java - +java_JAVA = GetTLE.java EXTRA_DIST = \ - GetTLE.class.in \ GetTLE.java.in \ add_tle.pl.in \ check_tle.pl.in \ @@ -314,7 +316,7 @@ CLEANFILES = \ test_get_tle.pl \ update_tle.csh -do_subst = sed -e 's,[@]DATADIR[@],$(pkgdatadir)-$(VERSION),g' \ +do_subst = sed -e 's,[@]DATADIR[@],$(DATADIR),g' \ -e 's,[@]PREFIX[@],$(prefix),g' \ -e 's,[@]VERSION[@],$(VERSION),g' @@ -391,6 +393,35 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs + +classjava.stamp: $(am__java_sources) + @list1='$?'; list2=; if test -n "$$list1"; then \ + for p in $$list1; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + list2="$$list2 $$d$$p"; \ + done; \ + echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) '"$$list2"; \ + $(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) $$list2; \ + else :; fi + echo timestamp > $@ +install-javaJAVA: classjava.stamp + @$(NORMAL_INSTALL) + @test -n "$(java_JAVA)" && test -n "$(javadir)" || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(javadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(javadir)"; \ + set x *.class; shift; test "$$1" != "*.class" || exit 0; \ + echo " $(INSTALL_DATA)" "$$@" "'$(DESTDIR)$(javadir)/$$p'"; \ + $(INSTALL_DATA) "$$@" "$(DESTDIR)$(javadir)" + +uninstall-javaJAVA: + @$(NORMAL_UNINSTALL) + @test -n "$(java_JAVA)" && test -n "$(javadir)" || exit 0; \ + set x *.class; shift; test "$$1" != "*.class" || exit 0; \ + echo " ( cd '$(DESTDIR)$(javadir)' && rm -f" "$$@" ")"; \ + cd "$(DESTDIR)$(javadir)" && rm -f "$$@" + +clean-javaJAVA: + -rm -f *.class classjava.stamp tags TAGS: ctags CTAGS: @@ -430,9 +461,9 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(SCRIPTS) +all-am: Makefile $(SCRIPTS) classjava.stamp installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(javadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -468,7 +499,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool mostlyclean-am +clean-am: clean-generic clean-javaJAVA clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile @@ -486,7 +517,7 @@ info: info-am info-am: -install-data-am: install-data-local +install-data-am: install-data-local install-javaJAVA install-dvi: install-dvi-am @@ -530,30 +561,27 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binSCRIPTS +uninstall-am: uninstall-binSCRIPTS uninstall-javaJAVA .MAKE: install-am install-strip -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-binSCRIPTS install-data \ - install-data-am install-data-local install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am uninstall-binSCRIPTS +.PHONY: all all-am check check-am clean clean-generic clean-javaJAVA \ + clean-libtool cscopelist-am ctags-am distclean \ + distclean-generic distclean-libtool distdir dvi dvi-am html \ + html-am info info-am install install-am install-binSCRIPTS \ + install-data install-data-am install-data-local install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-javaJAVA \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags-am uninstall uninstall-am uninstall-binSCRIPTS \ + uninstall-javaJAVA .PRECIOUS: Makefile -GetTLE.class: GetTLE.class.in Makefile - $(do_subst) < GetTLE.class.in > GetTLE.class - chmod 644 GetTLE.class - GetTLE.java: GetTLE.java.in Makefile $(do_subst) < GetTLE.java.in > GetTLE.java chmod 644 GetTLE.java @@ -590,10 +618,8 @@ update_tle.csh: update_tle.csh.in Makefile $(do_subst) < update_tle.csh.in > update_tle.csh chmod +x update_tle.csh -install-data-local: GetTLE.class GetTLE.java - mkdir -p $(DESTDIR)$(pkgdatadir)-$(VERSION)/java - install -D -m 644 GetTLE.class $(DESTDIR)$(pkgdatadir)-$(VERSION)/java - install -D -m 644 GetTLE.java $(DESTDIR)$(pkgdatadir)-$(VERSION)/java +install-data-local: + $(INSTALL) -D -m 644 GetTLE.class $(DESTDIR)$(pkgdatadir)-$(VERSION)/java # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. -- cgit