diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/.trailer | 0 | ||||
-rw-r--r-- | scripts/Makefile.am | 30 | ||||
-rw-r--r-- | scripts/Makefile.in | 544 | ||||
-rwxr-xr-x | scripts/calfuse.csh | 165 | ||||
-rwxr-xr-x | scripts/calfuse.sh | 142 | ||||
-rwxr-xr-x | scripts/calfuse.wavecal | 130 | ||||
-rwxr-xr-x | scripts/cf_make_900_obs.csh | 193 | ||||
-rwxr-xr-x | scripts/cf_make_all.csh | 487 | ||||
-rwxr-xr-x | scripts/cf_make_all_obs.csh | 555 | ||||
-rw-r--r-- | scripts/cfsetup.csh.in | 9 | ||||
-rw-r--r-- | scripts/cfsetup.sh.in | 10 | ||||
-rwxr-xr-x | scripts/idl_obsplot.pl | 48 | ||||
-rwxr-xr-x | scripts/idlplot_rate.pl | 48 | ||||
-rwxr-xr-x | scripts/idlplot_spex.pl | 48 | ||||
-rwxr-xr-x | scripts/listhead | bin | 0 -> 573860 bytes | |||
-rwxr-xr-x | scripts/listtra | bin | 0 -> 598468 bytes |
16 files changed, 2409 insertions, 0 deletions
diff --git a/scripts/.trailer b/scripts/.trailer new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/scripts/.trailer diff --git a/scripts/Makefile.am b/scripts/Makefile.am new file mode 100644 index 0000000..1f3b7d7 --- /dev/null +++ b/scripts/Makefile.am @@ -0,0 +1,30 @@ +bin_SCRIPTS = \ + calfuse.wavecal \ + cf_make_900_obs.csh \ + cf_make_all.csh \ + cf_make_all_obs.csh \ + cfsetup.csh \ + cfsetup.sh \ + idl_obsplot.pl \ + idlplot_rate.pl \ + idlplot_spex.pl \ + listhead \ + listtra + +EXTRA_DIST = cfsetup.csh.in \ + cfsetup.sh.in + +CLEANFILES = cfsetup.csh \ + cfsetup.sh + +do_subst = sed -e 's,[@]DATADIR[@],$(datadir),g' \ + -e 's,[@]PREFIX[@],$(prefix),g' \ + -e 's,[@]VERSION[@],$(VERSION),g' + +cfsetup.csh: cfsetup.csh.in Makefile + $(do_subst) < cfsetup.csh.in > cfsetup.csh + chmod +x cfsetup.csh + +cfsetup.sh: cfsetup.sh.in Makefile + $(do_subst) < cfsetup.sh.in > cfsetup.sh + chmod +x cfsetup.sh diff --git a/scripts/Makefile.in b/scripts/Makefile.in new file mode 100644 index 0000000..57e8ec5 --- /dev/null +++ b/scripts/Makefile.in @@ -0,0 +1,544 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = scripts +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/include/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(bindir)" +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 +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cfitsio_CFLAGS = @cfitsio_CFLAGS@ +cfitsio_LIBS = @cfitsio_LIBS@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +bin_SCRIPTS = \ + calfuse.wavecal \ + cf_make_900_obs.csh \ + cf_make_all.csh \ + cf_make_all_obs.csh \ + cfsetup.csh \ + cfsetup.sh \ + idl_obsplot.pl \ + idlplot_rate.pl \ + idlplot_spex.pl \ + listhead \ + listtra + +EXTRA_DIST = cfsetup.csh.in \ + cfsetup.sh.in + +CLEANFILES = cfsetup.csh \ + cfsetup.sh + +do_subst = sed -e 's,[@]DATADIR[@],$(datadir),g' \ + -e 's,[@]PREFIX[@],$(prefix),g' \ + -e 's,[@]VERSION[@],$(VERSION),g' + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign scripts/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binSCRIPTS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binSCRIPTS + +.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-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 + +.PRECIOUS: Makefile + + +cfsetup.csh: cfsetup.csh.in Makefile + $(do_subst) < cfsetup.csh.in > cfsetup.csh + chmod +x cfsetup.csh + +cfsetup.sh: cfsetup.sh.in Makefile + $(do_subst) < cfsetup.sh.in > cfsetup.sh + chmod +x cfsetup.sh + +# 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.csh b/scripts/calfuse.csh new file mode 100755 index 0000000..4a828d1 --- /dev/null +++ b/scripts/calfuse.csh @@ -0,0 +1,165 @@ +#!/usr/local/bin/tcsh -f +#****************************************************************************** +#* Johns Hopkins University +#* Center For Astrophysical Sciences +#* FUSE +#****************************************************************************** +#* +#* Synopsis: calfuse.csh file_name +#* +#* Description: Shell script for processing FUSE Ver 3.0 time-tagged exposures. +#* All messages are written to stdout or stderr. +#* +#* Arguments: char file_name File name to process is 1st command- +#* line argument +#* +#* Returns: Exit codes: +#* 0 Successful execution +#* +#* +#* Environment variables: CF_CALDIR Path to directory which contains the +#* calibration files. +#* CF_IDLDIR Path to CalFUSE IDL directory +#* CF_PIPELINE Flag to determine if CALFUSE +#* is running as part of the JHU +#* pipeline. +#* +#* History: 02/26/03 1.1 peb Begin work on V3.0 +#* 03/19/03 1.2 wvd Add IDL plots +#* 03/31/03 1.3 peb Add cf_ttag_countmap/gainmap programs +#* and changed the timestamp format to be +#* similar to cf_timestamp +#* 05/16/03 1.4 wvd Distinguish between TTAG and HIST files. +#* Changed name to calfuse.csh +#* 05/22/03 1.5 wvd Direct STDERR to trailer file. +#* 06/03/03 1.6 rdr Incorporated bad pixel map +#* 06/09/03 1.7 rdr Do not screen on timing flags for HIST +#* data processed behind the firewall +#* 07/31/03 1.8 wvd Check error status before exiting. +#* 09/15/03 1.9 wvd Write BEGIN and END stmts to logfile. +#* 12/08/03 1.10 wvd For HIST data, always call +#* cf_extract_spectra and cf_bad_pixels +#* with -s option. +#* 12/21/03 1.13 wvd Remove underscore from idf and bpm +#* filenames. +#* 04/22/04 1.12 wvd Change name of trailer file to +#* {$froot}.trl +#* 05/12/04 1.13 wvd Remove cf_ttag_countmap and +#* cf_ttag_gainmap from pipeline. +#* 06/01/04 1.14 wvd For HIST data, no longer need to call +#* cf_extract_spectra with -s option. +#* 06/03/04 1.15 wvd Screening step now follows "Convert +#* to FARF." +#* +#*****************************************************************************/ + +# Delete files after processing? (Default is no.) +#set DELETE_IDF # Delete intermediate data file +#set DELETE_BPM # Delete bad-pixel map + +set idf = ${1:s/raw/idf/} +set froot = ${1:s/raw.fit//} +set logfile = {$froot}.trl +set ttag = `echo $froot | grep -c ttag` + +# Put a timestamp in the log file (the OPUS trailer file). +if $ttag then + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Begin TTAG file $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Begin TTAG file $1" >>& $logfile +else + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Begin HIST file $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Begin HIST file $1" >>& $logfile +endif + +set cfstat=0 + +# Step 1 -- Generate Intermediate Data File +if $ttag then + cf_ttag_init $1 $idf >>& $logfile + set cfstat=$status +else + cf_hist_init $1 $idf >>& $logfile + set cfstat=$status +endif + +# Step 2 -- Convert to FARF +if ! $cfstat then + cf_convert_to_farf $idf >>& $logfile + set cfstat=$status +endif + +# Step 3 -- Screen photons +if ! $cfstat then + cf_screen_photons $idf >>& $logfile + set cfstat=$status +endif + +# Step 4 -- Remove motions +if ! $cfstat then + cf_remove_motions $idf >>& $logfile + set cfstat=$status +endif + +if ! $cfstat then + if ($?CF_IDLDIR) then + idlplot_rate.pl {$froot} >>& $logfile + idlplot_spex.pl {$froot} >>& $logfile + endif +endif + +# Step 5 -- Assign wavelength +if ! $cfstat then + cf_assign_wavelength $idf >>& $logfile + set cfstat=$status +endif + +# Step 6 -- Flux calibrate +if ! $cfstat then + cf_flux_calibrate $idf >>& $logfile + set cfstat=$status +endif + +# Step 7 -- Create a bad-pixel file +if ! $cfstat then + cf_bad_pixels $idf >>& $logfile + set cfstat=$status +endif + +# Step 8 -- Extract spectra +if ! $cfstat then + cf_extract_spectra $idf >>& $logfile + set cfstat=$status +endif + +# Step 8a -- Delete _bursts.dat file +if ! $?CF_PIPELINE then + rm -f ${1:r:s/ttagfraw/_bursts/}.dat +endif + +# Step 8b -- Delete IDF file +if $?DELETE_IDF then + echo "NOTE: Deleting intermediate data file." + rm $idf +endif + +# Step 8c -- Delete bad pixel map (bpm) file +if $?DELETE_BPM then + echo "NOTE: Deleting bad pixel map (bpm) file." + rm -f ${1:s/raw/bpm/} +endif + +if ! $cfstat then + if $ttag then + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: End TTAG file $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: End TTAG file $1" >>& $logfile + else + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: End HIST file $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: End HIST file $1" >>& $logfile + endif +else + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Error processing $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Error processing $1" >>& $logfile +endif +exit($cfstat) + +#****************************************************************************** diff --git a/scripts/calfuse.sh b/scripts/calfuse.sh new file mode 100755 index 0000000..0cd23a9 --- /dev/null +++ b/scripts/calfuse.sh @@ -0,0 +1,142 @@ +#!/bin/sh +#****************************************************************************** +#* Johns Hopkins University +#* Center For Astrophysical Sciences +#* FUSE +#****************************************************************************** +#* +#* Synopsis: calfuse.sh file_name +#* +#* Description: Shell script for processing FUSE Ver 3.2 time-tagged exposures. +#* All messages are written to stdout or stderr. +#* +#* Arguments: char file_name File name to process is 1st command- +#* line argument +#* +#* Returns: Exit codes: +#* 0 Successful execution +#* +#* +#* Environment variables: CF_CALDIR Path to directory which contains the +#* calibration files. +#* CF_IDLDIR Path to CalFUSE IDL directory +#* CF_PIPELINE Flag to determine if CALFUSE +#* is running as part of the JHU +#* pipeline. +#* +#* History: 09/05/07 1.1 bot Adapted from tcsh script +#* +#*****************************************************************************/ + +# Delete files after processing? (Default is no.) +#DELETE_IDF=1 # Delete intermediate data file +#DELETE_BPM=1 # Delete bad-pixel map + +idf=`echo $1 | sed -e "s/raw/idf/g"` +froot=`echo $1 | sed -e "s/raw.fit//g"` +logfile=${froot}.trl +ttag=`echo $froot | grep -c ttag` + + +# Put a timestamp in the log file (the OPUS trailer file). +if [ $ttag = 1 ]; then + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Begin TTAG file $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Begin TTAG file $1" >> $logfile 2>&1 +else + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Begin HIST file $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Begin HIST file $1" >> $logfile 2>&1 +fi + +cfstat=1 + +# Step 1 -- Generate Intermediate Data File +if [ $ttag = 1 ]; then + cf_ttag_init $1 $idf >> $logfile 2>&1 + cfstat=$? +else + cf_hist_init $1 $idf >> $logfile 2>&1 + cfstat=$? +fi + +# Step 2 -- Convert to FARF +if [ $cfstat = 0 ]; then + cf_convert_to_farf $idf >> $logfile 2>&1 + cfstat=$? +fi + +# Step 3 -- Screen photons +if [ $cfstat = 0 ]; then + cf_screen_photons $idf >> $logfile 2>&1 + cfstat=$? +fi + +# Step 4 -- Remove motions +if [ $cfstat = 0 ]; then + cf_remove_motions $idf >> $logfile 2>&1 + cfstat=$? +fi + +if [ $cfstat = 0 ]; then + if [ ${CF_IDLDIR:-""} != "" ]; then + idlplot_rate.pl $froot >> $logfile 2>&1 + idlplot_spex.pl $froot >> $logfile 2>&1 + fi +fi + +# Step 5 -- Assign wavelength +if [ $cfstat = 0 ]; then + cf_assign_wavelength $idf >> $logfile 2>&1 + cfstat=$? +fi + +# Step 6 -- Flux calibrate +if [ $cfstat = 0 ]; then + cf_flux_calibrate $idf >> $logfile 2>&1 + cfstat=$? +fi + +# Step 7 -- Create a bad-pixel file +if [ $cfstat = 0 ]; then + cf_bad_pixels $idf >> $logfile 2>&1 + cfstat=$? +fi + +# Step 8 -- Extract spectra +if [ $cfstat = 0 ]; then + cf_extract_spectra $idf >> $logfile 2>&1 + cfstat=$? +fi + +# Step 8a -- Delete _bursts.dat file +if [ ${CF_PIPELINE:-""} = "" ]; then + rm -f `echo $1 | sed -e "s/ttagfraw.fit/_bursts.dat/g"` +fi + +# Step 8b -- Delete IDF file +if [ ${DELETE_IDF:-""} != "" ]; then + echo "NOTE: Deleting intermediate data file." + rm -f $idf +fi + +# Step 8c -- Delete bad pixel map (bpm) file +if [ ${DELETE_BPM:-""} != "" ]; then + echo "NOTE: Deleting bad pixel map (bpm) file." + rm -f `echo $1 | sed -e "s/raw/bpm/g"` +fi + +if [ $cfstat = 0 ]; then + if [ $ttag = 1 ]; then + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: End TTAG file $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: End TTAG file $1" >> $logfile 2>&1 + else + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: End HIST file $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: End HIST file $1" >> $logfile 2>&1 + fi +else + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Error processing $1" + echo `date '+%Y %b %e %T'` "calfuse.csh-1.15: Error processing $1" >> $logfile 2>&1 +fi + +exit $cfstat + +#****************************************************************************** diff --git a/scripts/calfuse.wavecal b/scripts/calfuse.wavecal new file mode 100755 index 0000000..eae4653 --- /dev/null +++ b/scripts/calfuse.wavecal @@ -0,0 +1,130 @@ +#!/usr/local/bin/tcsh -f +#****************************************************************************** +#* Johns Hopkins University +#* Center For Astrophysical Sciences +#* FUSE +#****************************************************************************** +#* +#* Synopsis: calfuse.wavecal file_name +#* +#* Description: Shell script for processing FUSE Ver 3.0 time-tagged exposures. +#* All messages are written to stdout or stderr. +#* +#* WARNING: THIS VERSION IS OPTIMIZED FOR PROCESSING WAVELENGTH +#* CALIBRATION DATA!!! +#* +#* Arguments: char file_name File name to process is 1st command- +#* line argument +#* +#* Returns: Exit codes: +#* 0 Successful execution +#* +#* +#* Environment variables: CF_CALDIR Path to directory which contains the +#* calibration files. +#* CF_IDLDIR Path to CalFUSE IDL directory +#* CF_PIPELINE Flag to determine if CALFUSE +#* is running as part of the JHU +#* pipeline. +#* +#* History: 02/26/03 1.1 peb Begin work on V3.0 +#* 03/19/03 1.2 wvd Add IDL plots +#* 03/31/03 1.3 peb Add cf_ttag_countmap/gainmap programs +#* and changed the timestamp format to be +#* similar to cf_timestamp +#* 05/16/03 1.4 wvd Distinguish between TTAG and HIST files. +#* Changed name to calfuse.csh +#* 05/22/03 1.5 wvd Direct STDERR to trailer file. +#* 06/03/03 1.6 rdr Incorporated bad pixel map +#* 06/09/03 1.7 rdr Do not screen on timing flags for HIST +#* data processed behind the firewall +#* 07/31/03 1.8 wvd Check error status before exiting. +#* 09/15/03 1.9 wvd Write BEGIN and END stmts to logfile. +#* 12/08/03 1.10 wvd For HIST data, always call +#* cf_extract_spectra and cf_bad_pixels +#* with -s option. +#* 12/21/03 1.13 wvd Remove underscore from idf and bpm +#* filenames. +#* 04/22/04 1.12 wvd Change name of trailer file to +#* {$froot}.trl +#* 05/12/04 1.13 wvd Remove cf_ttag_countmap and +#* cf_ttag_gainmap from pipeline. +#* 06/01/04 1.14 wvd For HIST data, no longer need to call +#* cf_extract_spectra with -s option. +#* 06/03/04 1.15 wvd Screening step now follows "Convert +#* to FARF." +#* +#*****************************************************************************/ + +set idf = ${1:s/raw/idf/} +set froot = ${1:s/raw.fit//} +set logfile = {$froot}.trl +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" >>& $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" >>& $logfile +endif + +set cfstat=0 + +# Step 1 -- Generate Intermediate Data File +if $ttag then + cf_ttag_init $1 $idf >>& $logfile + set cfstat=$status +else + cf_hist_init $1 $idf >>& $logfile + set cfstat=$status +endif + +# Step 2 -- Convert to FARF +if ! $cfstat then + cf_convert_to_farf $idf >>& $logfile + set cfstat=$status +endif + +# Step 3 -- Screen photons +if ! $cfstat then + cf_screen_photons $idf >>& $logfile + set cfstat=$status +endif + +# Step 4 -- Remove motions +if ! $cfstat then + cf_remove_motions $idf >>& $logfile + set cfstat=$status +endif + +# Step 5 -- Assign wavelength - SAVE ASTIG-CORRECTED X ARRAY +if ! $cfstat then + cf_assign_wavelength -w $idf >>& $logfile + set cfstat=$status +endif + +if ! $cfstat then + if ($?CF_IDLDIR) then + idlplot_rate.pl {$froot} >>& $logfile + idlplot_spex.pl {$froot} >>& $logfile + endif +endif + +# Step 6 -- Flux calibrate +if ! $cfstat then + cf_flux_calibrate $idf >>& $logfile + set cfstat=$status +endif + +if ! $cfstat then + echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Finish data file $1" + echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Finish data file $1" >>& $logfile +else + echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Error processing $1" + echo `date '+%Y %b %e %T'` "calfuse.wavecal-1.15: Error processing $1" >>& $logfile +endif +exit($cfstat) + +#****************************************************************************** diff --git a/scripts/cf_make_900_obs.csh b/scripts/cf_make_900_obs.csh new file mode 100755 index 0000000..9edbc70 --- /dev/null +++ b/scripts/cf_make_900_obs.csh @@ -0,0 +1,193 @@ +#!/usr/local/bin/tcsh -f + +#****************************************************************************** +#* Johns Hopkins University +#* Center For Astrophysical Sciences +#* FUSE +#****************************************************************************** +#* +#* Synopsis: cf_make_900_obs.csh association_file +#* +#* Description: This routine is derived from cf_make_all_obs.csh, but modified +#* to consider only 900+ (airglow) files. Output is a single +#* quick-look image of the airglow spactrum. +#* +#* Extracted spectra are combined, not IDF files. +#* +#* When an expected data set is missing, the script stops, cleans +#* the directory, and returns 1. +#* +#* History: 08/08/08 1.00 wvd Create separate quick-look image +#* for 900+ (airglow) exposures. +#* Always combine extracted spectra. If +#* cf_xcorr fails, combine with no shift. +#* 08/08/08 1.01 wvd Rename airglow quick-look file to +#* M112580100000airgttagf.gif +#* +#*****************************************************************************/ + +# Delete files after processing? (Default is no.) +#set DELETE_IDF # Delete intermediate data files +set DELETE_BPM # Delete bad-pixel map files + +# Set program path +set rm = "/bin/rm -f" + +set cf_xcorr = cf_xcorr +set cf_combine = cf_combine +set cf_pack = cf_pack +set cf_nvo = cf_nvo +set idl_obsplot = idl_obsplot.pl +set modhead = modhead + +# Init var list +set detector = (1a 2b) +set channel = (lif sic) +set resolution = (2 3 4) +set obsmod = (hist ttag) + +# Determine the root name and the program ID +set asnf = $1 +set rn = ${asnf:s/000asnf.fit//} +set pid = `echo $rn | awk '{print substr($1, 1, 4)}'` + +# Determine the object class +set tmp_file = `ls ${rn}*fcal.fit | awk '{if (NR == 1) print}'` +set tmp_buf = `$modhead $tmp_file OBJCLASS` +set objclass = $tmp_buf[2] + +# Clean tmp files that the script will create (safe) +$rm tmp_xcorr.res tmp_combine.lis +$rm tmp_good_exp.lis tmp_exp.lis tmp_seg_dn.lis +$rm DN_${rn}*.fit + +foreach om ($obsmod) + foreach res ($resolution) + foreach chan ($channel) + foreach det ($detector) + + set ignore_exp_stat = '' + if ($om == hist) set ignore_exp_stat = -a + if ($pid == S100) set ignore_exp_stat = -a + if ($pid == M106) set ignore_exp_stat = -a + + # Find exposures that match the current segment + set seg = $det$chan$res$om + set readfiles = 0 + ls ${rn}9[0-9][0-9]${seg}fcal.fit |& grep -v 000${seg} > tmp_exp.lis # Keep only "9xx" exposures + if ($? == 0) then + set readfiles = 2 + set ignore_exp_stat = -a + endif + + if ($readfiles >= 1) 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 ($3 >= 0) {print $6, $2} else {print $6}}' tmp_xcorr.res > tmp_good_exp.lis + + # + # --- 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}900${seg}fcal.fit + awk '{print "'$rn'"$1"'$seg'fcal.fit",$2}' tmp_good_exp.lis > tmp_combine.lis # Combine $seg [dn] + # echo "----- Combining Files ----- " + # cat tmp_combine.lis + # echo "Output: " $s + $cf_combine -k $ignore_exp_stat tmp_combine.lis $s + # $modhead "${s}[1]" NUM_EXP $n_good + $modhead "${s}[1]" COMBMETH XCORR + echo $s >> tmp_seg_dn.lis + + set s = DN_${rn}900${seg2}fcal.fit + awk '{print "'$rn'"$1"'$seg2'fcal.fit",$2}' tmp_good_exp.lis > tmp_combine.lis # Combine $seg2 [dn] + # echo "----- Combining Files ----- " + # cat tmp_combine.lis + # echo "Output: " $s + $cf_combine -k $ignore_exp_stat tmp_combine.lis $s + # $modhead "${s}[1]" NUM_EXP $n_good + $modhead "${s}[1]" COMBMETH XCORR + echo $s >> tmp_seg_dn.lis + + endif + end + + $rm tmp_xcorr.res tmp_combine.lis + $rm tmp_good_exp.lis tmp_exp.lis + + end + + # Pack the 8 [detector][channel] pairs together + if (-e tmp_seg_dn.lis) then + + set fcal_all = ${rn}00900all$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, delete unwanted files + $idl_obsplot {$rn} airglow + mv ${rn}00900spec${om}f.gif ${rn}00000airg${om}f.gif + $rm ${rn}00900lif*.gif ${rn}00900sic*.gif + $rm $fcal_all + + endif + endif + end +end + +# Clean [dn] files. +$rm DN_${rn}*.fit + +# Delete IDF files +if $?DELETE_IDF then + echo "NOTE: Deleting intermediate data files." + $rm ${rn}*idf.fit +endif + +# Delete bad-pixel-map (bpm) files +if $?DELETE_BPM then + echo "NOTE: Deleting bad pixel map (bpm) files." + $rm ${rn}*bpm.fit +endif + +exit(0) + +crash: # Procedure when script crashes + +# Clean directory +$rm tmp_xcorr.res tmp_combine.lis +$rm tmp_good_exp.lis tmp_exp.lis tmp_seg_dn.lis +$rm DN_*.fit + +# Return 1 +exit(1) diff --git a/scripts/cf_make_all.csh b/scripts/cf_make_all.csh new file mode 100755 index 0000000..2cfbc46 --- /dev/null +++ b/scripts/cf_make_all.csh @@ -0,0 +1,487 @@ +#!/usr/local/bin/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 = "/bin/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_obs.csh b/scripts/cf_make_all_obs.csh new file mode 100755 index 0000000..2a97247 --- /dev/null +++ b/scripts/cf_make_all_obs.csh @@ -0,0 +1,555 @@ +#!/usr/local/bin/tcsh -f + +#****************************************************************************** +#* Johns Hopkins University +#* Center For Astrophysical Sciences +#* FUSE +#****************************************************************************** +#* +#* Synopsis: cf_make_all_obs.csh association_file +#* +#* Description: Creates 3 files from 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 of co-adding spectra, the latter +#* being corrected for a possible shift. The Background method +#* consists of 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 +#* the directory, and returns 1. +#* +#* History: 04/15/05 1.0 tc First release +#* 08/22/05 1.1 wvd Argument is name of association file. +#* 10/20/05 1.2 wvd Use idl_obsplot.pl to call cf_obsplot. +#* 10/25/05 1.3 wvd Add option to delete BPM or IDF files. +#* 03/21/06 1.4 wvd If there's only one exposure, always +#* follow the cross-correlation path. +#* Don't check the number of night-only +#* spectra before calling cf_pack. +#* 03/28/06 1.5 wvd If there's no good time in any exposure, +#* follow the cross-correlation path. +#* 04/27/06 1.6 wvd Be smarter when discarding 000 files. +#* Always use cross-corr for HIST data. +#* 05/23/06 1.7 wvd Move -k to proper spot after cf_combine. +#* 06/02/06 1.8 wvd If OBJCLASS = 7 (Sky Background) +#* always combine IDF files. +#* 06/22/06 1.9 wvd Call idf_combine with -z flag. +#* 05/24/07 1.10 bot If only 900+ spectra are available, +#* use them. +#* 04/04/08 1.11 bot Ignore EXP_STAT in cf_combine for HIST +#* data. +#* 07/25/08 1.12 wvd Ignore EXP_STAT in cf_combine and +#* idf_combine for BR-EARTH observations +#* (S100, M106, and 900+ exposures). +#* 08/08/08 1.13 wvd Don't ignore EXP_STAT for 900+ exposures. +#* 08/15/08 1.14 wvd Call cf_make_900_obs.csh +#* to make quick-look airglow plot. +#* +#*****************************************************************************/ + +# Delete files after processing? (Default is no.) +#set DELETE_IDF # Delete intermediate data files +#set DELETE_BPM # Delete bad-pixel map files + +# Set program path +set rm = "/bin/rm -f" + +set cf_xcorr = cf_xcorr +set cf_combine = cf_combine +set cf_pack = cf_pack +set cf_nvo = cf_nvo +set idl_obsplot = idl_obsplot.pl +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 and the program ID +set asnf = $1 +set rn = ${asnf:s/000asnf.fit//} +set pid = `echo $rn | awk '{print substr($1, 1, 4)}'` + +# Determine the object class +set tmp_file = `ls ${rn}*fcal.fit | awk '{if (NR == 1) print}'` +set tmp_buf = `$modhead $tmp_file OBJCLASS` +set objclass = $tmp_buf[2] + +# 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) + + set ignore_exp_stat = '' + if ($om == hist) set ignore_exp_stat = -a + if ($pid == S100) set ignore_exp_stat = -a + if ($pid == M106) set ignore_exp_stat = -a + + # Find exposures that match the current segment + set seg = $det$chan$res$om + set readfiles = 0 + ls ${rn}[0-8][0-9][0-9]${seg}fcal.fit |& grep -v 000${seg} > tmp_exp.lis # Reject EXP "9xx" and "000" + + if ($? == 0) then + set readfiles = 1 + else + ls ${rn}9[0-9][0-9]${seg}fcal.fit |& grep -v 000${seg} > tmp_exp.lis # Keep only "9xx" exposures + if ($? == 0) set readfiles = 2 + endif + + if ($readfiles >= 1) 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" + set n_exp = `cat tmp_xcorr.res | wc -l` + + if (($time_good > 2 * $time_bad && $objclass != 7) || ($time_good == 0 && $time_bad == 0) || $n_exp == 1 || $om == hist) 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] + # echo "----- Combining Files ----- " + # cat tmp_combine.lis + # echo "Output: " $s + $cf_combine -k $ignore_exp_stat tmp_combine.lis $s + # $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] + # echo "----- Combining Files ----- " + # cat tmp_combine.lis + # echo "Output: " $s + $cf_combine -k $ignore_exp_stat tmp_combine.lis $s + # $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 -k $ignore_exp_stat tmp_combine.lis $s + # $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 -k $ignore_exp_stat tmp_combine.lis $s + # $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 ..." + if ($readfiles == 1) then + ls ${rn}[0-8][0-9][0-9]$det${om}fidf.fit |& grep -v 000${det} > tmp_idf.lis # Reject EXP "9xx" and "000" + else + ls ${rn}9[0-9][0-9]$det${om}fidf.fit |& grep -v 000${det} > tmp_idf.lis # Consider only airglow + endif + if ($? == 0) then # IDF files exist + + set idf_lis = `awk '{printf "%s ",$1}' tmp_idf.lis` + # echo "Combining IDF files: " $idf_lis + idf_combine -cz $ignore_exp_stat $idf1_all $idf_lis # Create combined IDF file for $seg + $rm tmp_idf.lis + + else + + echo "ERROR: IDF files are missing" + $rm tmp_idf.lis + goto crash + + endif + endif + + if (!(-e $idf2_all)) then + echo "Creating IDF: $idf2_all ..." + if ($readfiles == 1) then + ls ${rn}[0-8][0-9][0-9]$det2${om}fidf.fit |& grep -v 000${det2} > tmp_idf.lis # Reject EXP "9xx" and "000" + else + ls ${rn}9[0-9][0-9]$det2${om}fidf.fit |& grep -v 000${det2} > tmp_idf.lis # Consider only airglow + endif + if ($? == 0) then # IDF files exist + + set idf_lis = `awk '{printf "%s ",$1}' tmp_idf.lis` + # echo "Combining IDF files: " $idf_lis + idf_combine -cz $ignore_exp_stat $idf2_all $idf_lis # Create combined IDF file for $seg2 + $rm tmp_idf.lis + + else + + echo "ERROR: IDF files are missing" + $rm 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 -k $ignore_exp_stat tmp_combine.lis $s + $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 -k $ignore_exp_stat tmp_combine.lis $s + $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 -k $ignore_exp_stat tmp_combine.lis $s + $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 -k $ignore_exp_stat tmp_combine.lis $s + $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 + $idl_obsplot {$rn} + + # 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 + +# Delete IDF files +if $?DELETE_IDF then + echo "NOTE: Deleting intermediate data files." + $rm ${rn}*idf.fit +endif + +# Delete bad-pixel-map (bpm) files +if $?DELETE_BPM then + echo "NOTE: Deleting bad pixel map (bpm) files." + $rm ${rn}*bpm.fit +endif + +# Call routine to make quick-look airglow plot. +cf_make_900_obs.csh $1 + +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 new file mode 100644 index 0000000..8951b36 --- /dev/null +++ b/scripts/cfsetup.csh.in @@ -0,0 +1,9 @@ +# To execute, type "source cfsetup.csh" +# +set CF_DIR="@PREFIX@" +set CF_VERSION="@VERSION@" +setenv PATH "@PREFIX@/bin:${PATH}" +setenv CF_CALDIR "@DATADIR@/calfiles" +setenv CF_PARMDIR "@DATADIR@/parmfiles" +setenv CF_IDLDIR "@DATADIR@/idl" + diff --git a/scripts/cfsetup.sh.in b/scripts/cfsetup.sh.in new file mode 100644 index 0000000..bdc85d4 --- /dev/null +++ b/scripts/cfsetup.sh.in @@ -0,0 +1,10 @@ +# To execute, type "source cfsetup.sh" +# +CF_DIR="@PREFIX@" +CF_VERSION="@VERSION@" +export PATH="${CF_DIR}/bin:${PATH}" +export CF_CALDIR="${CF_DIR}/calfiles" +export CF_PARMDIR="${CF_DIR}/parmfiles" +export CF_IDLDIR="${CF_DIR}/idl" +export CF_HISTDIR=`pwd` + diff --git a/scripts/idl_obsplot.pl b/scripts/idl_obsplot.pl new file mode 100755 index 0000000..1954936 --- /dev/null +++ b/scripts/idl_obsplot.pl @@ -0,0 +1,48 @@ +#!/usr/bin/env perl +use FileHandle; + +# ****************************************************** +# idlplot_corr.pl +# +# This Perl module will run the idl script "cf_obsplot.pro" +# +# Author: Van Dixon +# +# History: Written July 3, 2001 +# +# 10/20/05 wvd Add call to .run cf_obsplot.pro +# 11/21/06 wvd Add process ID ($$) to name of +# batch file. +# 08/08/08 wvd Add airglow argument for 900+ +# files. +# +# ****************************************************** + +if (@ARGV == 0) { + print "You must enter the rootname of the observation.\n"; + print "Exiting.\n"; + + } else { + + $batch_filename = $ARGV[0] . $$."_idl.bat"; + + # Open the output batch file. + open (BAT_OUTFILE, ">$batch_filename") || die "Cannot open $batch_filename"; + print BAT_OUTFILE "!path='$ENV{CF_IDLDIR}:'+!path\n"; + print BAT_OUTFILE ".run cf_obsplot.pro\n"; + if (@ARGV == 2) { + print BAT_OUTFILE "cf_obsplot,'" . $ARGV[0] . "', airglow=1\n"; + } else { + print BAT_OUTFILE "cf_obsplot,'" . $ARGV[0] . "'\n"; + } + print BAT_OUTFILE "exit\n"; + + close (BAT_OUTFILE); + + system("idl $batch_filename > /dev/null"); + + system("rm $batch_filename"); + + } + +### end of Perl script diff --git a/scripts/idlplot_rate.pl b/scripts/idlplot_rate.pl new file mode 100755 index 0000000..9e33bed --- /dev/null +++ b/scripts/idlplot_rate.pl @@ -0,0 +1,48 @@ +#!/usr/bin/env perl +use FileHandle; + +# *************************************************** +# add_tle.pl +# +# This Perl module will read in the latest five orbital elements +# from the file five.tle (which was created by get_tle.pl) and +# add any new orbital elements to the file FUSE.TLE. The file +# FUSE.TLE is in descending order (i.e. the most recent elements +# are first). In order to prepend the new TLE onto the old list +# I found it was easiest to store everything in a temporary file +# TEMP.TLE and rewrite FUSE.TLE. +# +# Author: Ed Murphy +# +# History: Written July 27, 1999 +# 11/21/06 wvd Add process ID ($$) to name of +# batch file. +# +# *************************************************** + +# Define the file names. old_maintle_filename is not actually opened, +# but is used in a system call at the end of the program. + +if (@ARGV == 0) { + print "You must enter the rootname of the observation.\n"; + print "Exiting.\n"; + + } else { + + $batch_filename = $ARGV[0] . $$."_idl.bat"; + + # Open the output batch file. + open (BAT_OUTFILE, ">$batch_filename") || die "Cannot open $batch_filename"; + print BAT_OUTFILE "!path='$ENV{CF_IDLDIR}:'+!path\n"; + print BAT_OUTFILE "cf_plot_rate3,'" . $ARGV[0] . "'\n"; + print BAT_OUTFILE "exit\n"; + + close (BAT_OUTFILE); + + system("idl $batch_filename > /dev/null"); + + system("rm $batch_filename"); + + } + +### end of Perl script diff --git a/scripts/idlplot_spex.pl b/scripts/idlplot_spex.pl new file mode 100755 index 0000000..701d2f7 --- /dev/null +++ b/scripts/idlplot_spex.pl @@ -0,0 +1,48 @@ +#!/usr/bin/env perl +use FileHandle; + +# *************************************************** +# add_tle.pl +# +# This Perl module will read in the latest five orbital elements +# from the file five.tle (which was created by get_tle.pl) and +# add any new orbital elements to the file FUSE.TLE. The file +# FUSE.TLE is in descending order (i.e. the most recent elements +# are first). In order to prepend the new TLE onto the old list +# I found it was easiest to store everything in a temporary file +# TEMP.TLE and rewrite FUSE.TLE. +# +# Author: Ed Murphy +# +# History: Written July 27, 1999 +# 11/21/06 wvd Add process ID ($$) to name of +# batch file. +# +# *************************************************** + +# Define the file names. old_maintle_filename is not actually opened, +# but is used in a system call at the end of the program. + +if (@ARGV == 0) { + print "You must enter the rootname of the observation.\n"; + print "Exiting.\n"; + + } else { + + $batch_filename = $ARGV[0] . $$."_idl.bat"; + + # Open the output batch file. + open (BAT_OUTFILE, ">$batch_filename") || die "Cannot open $batch_filename"; + print BAT_OUTFILE "!path='$ENV{CF_IDLDIR}:'+!path\n"; + print BAT_OUTFILE "cf_plot_extract3,'" . $ARGV[0] . "'\n"; + print BAT_OUTFILE "exit\n"; + + close (BAT_OUTFILE); + + system("idl $batch_filename > /dev/null"); + + system("rm $batch_filename"); + + } + +### end of Perl script diff --git a/scripts/listhead b/scripts/listhead Binary files differnew file mode 100755 index 0000000..390f00e --- /dev/null +++ b/scripts/listhead diff --git a/scripts/listtra b/scripts/listtra Binary files differnew file mode 100755 index 0000000..4c23921 --- /dev/null +++ b/scripts/listtra |