diff --git a/ChangeLog b/ChangeLog index f2081f3..cd1749e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-10-06 Juergen Knoedlseder + + * Version 0.3.0 released + ======================== + + Renamed to ctools + + 2011-10-03 Juergen Knoedlseder * Version 0.2.5 released diff --git a/Makefile.am b/Makefile.am index 98cba44..419276f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,7 +22,7 @@ noinst_HEADERS = pkgconfigdir = $(libdir)/pkgconfig # Files to install in Pkgconfig directory -pkgconfig_DATA = ctatools.pc +pkgconfig_DATA = ctools.pc # Manual pages to install man_MANS = diff --git a/NEWS b/NEWS index ece55ee..715157b 100644 --- a/NEWS +++ b/NEWS @@ -1,18 +1,19 @@ -New Features and Important Changes in ctatools 00-02-05 +New Features and Important Changes in ctools 00-03-00 Author(s) : Juergen Knoedlseder -October 3, 2011 +October 6, 2011 1. Introduction --------------- -This document briefly summarizes executable by executable the most important changes made since the last release of ctatools. +This document briefly summarizes executable by executable the most important changes made since the last release of ctools. 2. Configuration ----------------- -None +Renamed package from ctatools to ctools + 3. Python interface ------------------- @@ -31,11 +32,7 @@ None 6. ctbin - CTA event binning ---------------------------- -If an observation container is passed to ctbin, the counts map reference -pixel is taken from the pointing of each observation and the xref and yref -parameters are ignored. This allows for pipeline processing of a list of -observations using ctbin. Note that this feature is only available if cabin -is used from Python. +None 7. ctlike - CTA maximum likelihood fitting @@ -45,17 +42,12 @@ None 8. Examples ----------- -Add folder with example scripts. These scripts will be installed in -$CTATOOLS/share/examples +None 9. Scripts ---------- -Add folder with python scripts. These scripts will be installed in -$CTATOOLS/lib/pythonX.X/site-packages. In addition, symbolic link -without the .py suffix will be created for cscripts in -$CTATOOLS/bin so that cscripts are executable as normal ctools. - +None 10. caldb --------- @@ -64,5 +56,4 @@ None 11. models ---------- -Add folder with background models and source model descriptions -(XML files). +None diff --git a/README b/README index 37b8b30..69179bc 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ -ctatools information -==================== -Version: 00-02-05 (October 3, 2011) +ctools information +================== +Version: 00-03-05 (October 6, 2011) Author: Juergen Knodlseder (knodlseder@cesr.fr) GammaLib dependency: 00-04-11 @@ -26,10 +26,10 @@ What's new in this release? See the files "NEWS" and "ChangeLog". -What are the ctatools anyway? -============================= -ctatools are ftools-like executable for the scientific analysis of -CTA observations. They are based on GammaLib, a vesatile toolbox +What are the ctools anyway? +=========================== +ctools are ftools-like executable for the scientific analysis of +CTA observations. They are based on GammaLib, a versatile toolbox for the high-level analysis of astronomical gamma-ray data. The following tools are so far available: @@ -42,14 +42,14 @@ The following tools are so far available: Web sites ========= -http://cta.irap.omp.eu/ctatools - ctatools documentation +http://cta.irap.omp.eu/ctools - ctools documentation http://gammalib.sourceforge.net - for GammaLib documentation https://sourceforge.net/projects/gammalib/ - for GammaLib downloads Prerequisites ============= -ctatools require GammaLib. Please refer to http://gammalib.sourceforge.net +ctools require GammaLib. Please refer to http://gammalib.sourceforge.net for instructions about how to install GammaLib. The GammaLib code can be downloaded from https://sourceforge.net/projects/gammalib/. @@ -68,21 +68,21 @@ If you use C shell or a variant then add the following to your If you have installed GammaLib in another directory than /usr/local/gamma, please adapt the path correspondingly. -Please do NOT attempt to install ctatools in a directory different to that +Please do NOT attempt to install ctools in a directory different to that of GammaLib. The setup procedure does NOT support this feature, although you might manage to make it work :-) Unix Installation ================= -To build and install ctatools, simply type the following: +To build and install ctools, simply type the following: % ./configure % make % make install -By default ctatools installs itself in /usr/local/gamma. If you need to -install ctatools in a different location or in your home directory, use +By default ctools installs itself in /usr/local/gamma. If you need to +install ctools in a different location or in your home directory, use the --prefix option to ./configure. For example: % ./configure --prefix=/home/yourname/projects @@ -96,7 +96,7 @@ The file INSTALL details more about using configure. Also try Macintosh OS X Installation ============================ -ctatools are known to work on various flavors of OS X. Follow the Unix +ctools are known to work on various flavors of OS X. Follow the Unix installation instructions above. In some cases, install problems have been reported with mixed @@ -113,13 +113,13 @@ as follows to enable building a bundle for various architectures: Solaris Installation ==================== -ctatools compile on Solairs, but there is an issue with using it as a +ctools compile on Solairs, but there is an issue with using it as a shared library (see "Known problems" below). Testing ======= -If you want to test ctatools before installation, type the following: +If you want to test ctools before installation, type the following: % make check @@ -142,7 +142,7 @@ To be written ... Known problems ============== Solaris - Although ctatools compile on Solaris using the Sun compiler, there are + Although ctools compile on Solaris using the Sun compiler, there are problems with global symbols in the shared GammaLib library that prevent the model registry to work correctly. Furthermore, GammaLib is not able to catch its own exceptions, which prevents the FITS interface to work @@ -152,5 +152,5 @@ Solaris Contact ======= -To get in touch with the ctatools developers and to contribute to the +To get in touch with the ctools developers and to contribute to the project please contact Juergen Knoedlseder . diff --git a/configure.ac b/configure.ac index b053b99..536a3a0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# Configuration for ctatools - a set of tools for science analysis of CTA data +# Configuration for ctools - a set of tools for science analysis of CTA data # # Copyright (C) 2011 Jurgen Knodlseder # @@ -17,7 +17,7 @@ # # Process this file with autoconf to produce a configure script -AC_INIT([ctatools], [0.2.5], [knodlseder@cesr.fr], [ctatools]) +AC_INIT([ctools], [0.3.0], [knodlseder@cesr.fr], [ctools]) AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -29,11 +29,11 @@ dnl Set prefix dnl ========== AC_PREFIX_DEFAULT([/usr/local/gamma]) if test "x$prefix" = xNONE; then - ctatools_prefix="/usr/local/gamma" + ctools_prefix="/usr/local/gamma" else - ctatools_prefix=${prefix} + ctools_prefix=${prefix} fi -AC_DEFINE_UNQUOTED([PACKAGE_PREFIX], "${ctatools_prefix}", [Location where library is installed]) +AC_DEFINE_UNQUOTED([PACKAGE_PREFIX], "${ctools_prefix}", [Location where library is installed]) dnl =========================== @@ -108,7 +108,7 @@ fi dnl ========================================================================= dnl Checks if Python bindings are to be build. Python binding requires Python -dnl and either the files ctatools_wrap.cpp and ctatools.py or swig to create +dnl and either the files ctools_wrap.cpp and ctools.py or swig to create dnl these files. The following conditionals are set: dnl WITH_PYTHON - Python bindings will be built dnl HAVE_SWIG - swig is available @@ -128,7 +128,7 @@ AC_ARG_ENABLE([python-binding], [ac_enable_python_binding="$enableval"], [ac_enable_python_binding="yes"]) if test "x$ac_enable_python_binding" = "xno"; then - AC_MSG_NOTICE([Python binding for ctatools will not be built]) + AC_MSG_NOTICE([Python binding for ctools will not be built]) AC_MSG_NOTICE([Enable Python binding module building with --enable-python-binding]) fi @@ -187,10 +187,10 @@ if test "$SWIG"; then fi AM_CONDITIONAL(HAVE_SWIG, test "x$has_swig" = "xyes") -# Do we have wrappers (ctatools_wrap.cpp and ctatools.py)? -AC_CHECK_FILES([pyext/ctatools_wrap.cpp pyext/ctatools.py],,) -if test "x$ac_cv_file_pyext_ctatools_wrap_cpp" = "xyes"; then - if test "x$ac_cv_file_pyext_ctatools_py" = "xyes"; then +# Do we have wrappers (ctools_wrap.cpp and ctools.py)? +AC_CHECK_FILES([pyext/ctools_wrap.cpp pyext/ctools.py],,) +if test "x$ac_cv_file_pyext_ctools_wrap_cpp" = "xyes"; then + if test "x$ac_cv_file_pyext_ctools_py" = "xyes"; then has_wrappers="yes" fi fi @@ -225,9 +225,9 @@ if test "x$enable_python" = "xyes"; then else if test "x$has_python_wrap" = "xno" -a "x$has_swig" = "xno"; then - AC_MSG_WARN([Neither pyext/ctatools_wrap.cpp and pyext/ctatools.py nor swig has not been found]) - AC_MSG_WARN([Python binding for ctatools cannot be built]) - AC_MSG_WARN([Either use a ctatools distribution with ctatools_wrap.cpp and ctatools.py shipped or install swig on your system]) + AC_MSG_WARN([Neither pyext/ctools_wrap.cpp and pyext/ctools.py nor swig has not been found]) + AC_MSG_WARN([Python binding for ctools cannot be built]) + AC_MSG_WARN([Either use a ctools distribution with ctools_wrap.cpp and ctools.py shipped or install swig on your system]) AC_MSG_WARN([swig can be obtained from http://www.swig.org/]) fi fi @@ -255,7 +255,7 @@ LDFLAGS=$SAVED_LDFLAGS # If GammaLib has not been found in any standard path then search now in a # number of predefined locations. if test "x$has_gammalib" = "xno"; then - for i in "$GAMMALIB" "$ctatools_prefix" /opt/local /usr/local /usr ; do + for i in "$GAMMALIB" "$ctools_prefix" /opt/local /usr/local /usr ; do if test -f $i/lib64/libgamma.so -o -f $i/lib64/libgamma.dylib; then if test -d $i/include/gammalib; then LIBDIR_GAMMALIB=$i/lib64 @@ -289,7 +289,7 @@ if test "x$has_gammalib" = "xyes"; then AC_SUBST(INCDIR_GAMMALIB) else AC_MSG_ERROR([No suitable GammaLib library found. -ctatools require GammaLib for compilation, so please install GammaLib before or, +ctools require GammaLib for compilation, so please install GammaLib before or, if you think that it is installed, set the GAMMALIB environment variable to the root directory of GammaLib.]) fi @@ -327,7 +327,7 @@ AC_CONFIG_FILES([Makefile src/ctbin/Makefile src/ctlike/Makefile src/ctobssim/Makefile - src/ctatools-setup + src/ctools-setup test/Makefile test/test_cscripts.sh pyext/Makefile @@ -336,7 +336,7 @@ AC_CONFIG_FILES([Makefile models/Makefile examples/Makefile scripts/Makefile - ctatools.pc], + ctools.pc], [if test -f test/test_cscripts.sh; then chmod +x test/test_cscripts.sh; fi]) AC_OUTPUT @@ -345,7 +345,7 @@ dnl =========================== dnl Print configuration summary dnl =========================== echo -echo " ctatools configuration summary" +echo " ctools configuration summary" echo " ==============================" if test "x$has_gammalib" = "xyes"; then echo " * GammaLib support (yes) ${LIBDIR_GAMMALIB} ${INCDIR_GAMMALIB}" @@ -418,7 +418,7 @@ if test "x$has_gammalib" = "xyes"; then echo "Now type 'make'" echo else - AC_MSG_ERROR([No suitable GammaLib library found. ctatools require GammaLib + AC_MSG_ERROR([No suitable GammaLib library found. ctools require GammaLib for compilation, so please install GammaLib before or provide the location of the library and header files using the LDFLAGS and CPPFLAGS environnment variables.]) diff --git a/examples/README b/examples/README index 1a48527..2136161 100644 --- a/examples/README +++ b/examples/README @@ -1,5 +1,5 @@ This folder contains Python example scripts that illustrate the -usage of the ctatools. +usage of the ctools. make_binned_analysis.py Example Python pipelines for binned analysis. diff --git a/examples/make_binned_analysis.py b/examples/make_binned_analysis.py index 5c2da6d..69feaea 100755 --- a/examples/make_binned_analysis.py +++ b/examples/make_binned_analysis.py @@ -1,7 +1,7 @@ #! /usr/bin/env python # ========================================================================== # This script illustrates how to build a binned analysis pipeline using the -# ctatools. If matplotlib is installed, a counts spectrum and an offset +# ctools. If matplotlib is installed, a counts spectrum and an offset # histogram will be displayed. # # Required 3rd party modules: @@ -23,7 +23,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * from math import * import os diff --git a/examples/make_pull_at_sensitivity_limit.py b/examples/make_pull_at_sensitivity_limit.py index bbc297f..5f2d1fc 100755 --- a/examples/make_pull_at_sensitivity_limit.py +++ b/examples/make_pull_at_sensitivity_limit.py @@ -24,7 +24,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * from cspull import * import sys diff --git a/examples/make_ts_distributions.py b/examples/make_ts_distributions.py index 1102e60..6777045 100755 --- a/examples/make_ts_distributions.py +++ b/examples/make_ts_distributions.py @@ -28,7 +28,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * from cstsdist import * import sys diff --git a/examples/make_unbinned_analysis.py b/examples/make_unbinned_analysis.py index cd389d7..a2e86e2 100755 --- a/examples/make_unbinned_analysis.py +++ b/examples/make_unbinned_analysis.py @@ -1,7 +1,7 @@ #! /usr/bin/env python # ========================================================================== # This script illustrates how to build an unbinned analysis pipeline with -# the ctatools. If matplotlib is installed, the spectrum will be displayed +# the ctools. If matplotlib is installed, the spectrum will be displayed # on the screen. # # Required 3rd party modules: @@ -23,7 +23,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * from math import * import os diff --git a/pyext/Makefile.am b/pyext/Makefile.am index 6c43a87..79b034a 100755 --- a/pyext/Makefile.am +++ b/pyext/Makefile.am @@ -6,17 +6,17 @@ if WITH_PYTHON # Set SWIG interface filename -SWIG_INTERFACE = ctatools.i +SWIG_INTERFACE = ctools.i # Define the targets that should be built before anything else. # These are honored by 'make all', 'make check' and 'make install'. if HAVE_SWIG - BUILT_SOURCES = ctatools_wrap.cpp ctatools.py + BUILT_SOURCES = ctools_wrap.cpp ctools.py endif # Set files to be removed in clean if HAVE_SWIG - CLEANFILES = ctatools_wrap.cpp ctatools.py + CLEANFILES = ctools_wrap.cpp ctools.py endif all-local: build @@ -26,7 +26,7 @@ all-local: build # of this specific directory. So we build one instance for checking, the other # for installation. If we could get the name built by distutils we could avoid # this. -build: ctatools_wrap.cpp ctatools.py +build: ctools_wrap.cpp ctools.py $(PYTHON_BUILD_PREFIX) $(PYTHON) setup.py build --build-platlib build $(PYTHON_BUILD_PREFIX) $(PYTHON) setup.py build @@ -37,8 +37,8 @@ clean-local: rm -rf build if HAVE_SWIG -ctatools_wrap.cpp ctatools.py: $(SWIG_INTERFACE) - $(SWIG) -c++ -python -Wall -I$(prefix)/share/gammalib/swig -I$(GAMMALIB)/share/gammalib/swig -o ctatools_wrap.cpp -outdir . $(srcdir)/$(SWIG_INTERFACE) +ctools_wrap.cpp ctools.py: $(SWIG_INTERFACE) + $(SWIG) -c++ -python -Wall -I$(prefix)/share/gammalib/swig -I$(GAMMALIB)/share/gammalib/swig -o ctools_wrap.cpp -outdir . $(srcdir)/$(SWIG_INTERFACE) endif # HAVE_SWIG endif # WITH_PYTHON diff --git a/pyext/ctatools.i b/pyext/ctools.i index e9df99e..cf4e842 100755 --- a/pyext/ctatools.i +++ b/pyext/ctools.i @@ -1,5 +1,5 @@ /*************************************************************************** - * ctatools - SWIG file * + * ctools - SWIG file * * ----------------------------------------------------------------------- * * copyright (C) 2010-2011 by Jurgen Knodlseder * * ----------------------------------------------------------------------- * @@ -19,9 +19,9 @@ * * * ----------------------------------------------------------------------- * * Usage: * - * swig -c++ -python -Wall ctatools.i * + * swig -c++ -python -Wall ctools.i * ***************************************************************************/ -%module ctatools +%module ctools %feature("autodoc", "1"); /* __ Support module _____________________________________________________ */ diff --git a/pyext/setup.py.in b/pyext/setup.py.in index 3c3ec78..a55aa14 100644 --- a/pyext/setup.py.in +++ b/pyext/setup.py.in @@ -31,12 +31,12 @@ if sys.platform.lower().startswith("darwin"): # Signal darwin compiler adjustments print 'Adjust default distutils compiler options for darwin.' -# Remove any existing symbolic link to libctatools.a +# Remove any existing symbolic link to libctools.a # This will prevent any exception in creating the symbolic link due to # an already existing link. try: - os.remove('../src/.libs/libctatools_python.a') - print 'Removed ../src/.libs/libctatools_python.a' + os.remove('../src/.libs/libctools_python.a') + print 'Removed ../src/.libs/libctools_python.a' except: pass @@ -44,9 +44,9 @@ except: # dynamic linking. We prefer here static linking to avoid any problems with # finding the gammalib shared library during checking. try: - os.symlink('libctatools.a', '../src/.libs/libctatools_python.a') - print 'Created ../src/.libs/libctatools_python.a' - libcta='ctatools_python' + os.symlink('libctools.a', '../src/.libs/libctools_python.a') + print 'Created ../src/.libs/libctools_python.a' + libcta='ctools_python' except: libcta='ctatool' @@ -66,11 +66,11 @@ else: # Add application include files. The method we use here is not very # intelligent as it simple will add all names that start with 'ct' -# in the src directory. Once we added the ctatools script we had to +# in the src directory. Once we added the ctools script we had to # add an explicit filter to avoid appending those. dirs = glob.glob('../src/ct*') for dir in dirs: - if len(dir) > 0 and 'ctatools' not in dir: + if len(dir) > 0 and 'ctools' not in dir: path = os.path.abspath(dir) include_dirs.append(path) @@ -99,12 +99,12 @@ for extra_include_dir in extra_include_dirs: # Setup setup(name='@PACKAGE_NAME@', version='@PACKAGE_VERSION@', - description='ctatools Python binding', + description='ctools Python binding', author='Jurgen Knodlseder', author_email='@PACKAGE_BUGREPORT@', url='http://gammalib.sourceforge.net/', - py_modules=['ctatools'], - ext_modules=[Extension('_ctatools', ['ctatools_wrap.cpp'], + py_modules=['ctools'], + ext_modules=[Extension('_ctools', ['ctools_wrap.cpp'], include_dirs=include_dirs, library_dirs=library_dirs, libraries=libraries, diff --git a/scripts/cspull.py b/scripts/cspull.py index 8d846e9..1cc11ad 100755 --- a/scripts/cspull.py +++ b/scripts/cspull.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * import obsutils import sys diff --git a/scripts/cssens.py b/scripts/cssens.py index 711c12f..f5b1888 100755 --- a/scripts/cssens.py +++ b/scripts/cssens.py @@ -33,7 +33,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * import obsutils import sys diff --git a/scripts/cstsdist.py b/scripts/cstsdist.py index 75478d5..578e2bf 100755 --- a/scripts/cstsdist.py +++ b/scripts/cstsdist.py @@ -19,7 +19,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * import obsutils import sys diff --git a/scripts/obsutils.py b/scripts/obsutils.py index ed9404e..df9618f 100755 --- a/scripts/obsutils.py +++ b/scripts/obsutils.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * #from math import * #import os diff --git a/src/Makefile.am b/src/Makefile.am index dd352ee..4be73c3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,19 +7,19 @@ SUBDIRS = ctselect \ ctobssim # Scripts to be distributed -scripts = ctatools-setup \ - ctatools-init.sh \ - ctatools-init.csh +scripts = ctools-setup \ + ctools-init.sh \ + ctools-init.csh -# Build libtool library for CTA tools. This is needed to provide +# Build libtool library for ctools. This is needed to provide # a shared library that can be loaded for python bindings. We do # not have to build this library if no python bindings are used. -lib_LTLIBRARIES = libctatools.la -libctatools_la_SOURCES = -libctatools_la_LIBADD = ctbin/libctbin.la \ - ctselect/libctselect.la \ - ctlike/libctlike.la \ - ctobssim/libctobssim.la +lib_LTLIBRARIES = libctools.la +libctools_la_SOURCES = +libctools_la_LIBADD = ctbin/libctbin.la \ + ctselect/libctselect.la \ + ctlike/libctlike.la \ + ctobssim/libctobssim.la # Distribute scripts EXTRA_DIST = $(scripts) diff --git a/src/ctatools-init.csh b/src/ctatools-init.csh deleted file mode 100755 index 72d8edd..0000000 --- a/src/ctatools-init.csh +++ /dev/null @@ -1,21 +0,0 @@ -# Filename: ctatools-init.csh -# Description: C-shell flavor initialization for ctatools -# runs ctatools-setup to generate a temporary csh script -# tailored specifically to this user and ctatools -# installation, then source that. -# Author/Date: Juergen Knoedlseder, IRAP, July 16, 2011 -# -if(${?CTATOOLS} == 0) then - echo "ctatools-init.csh: ERROR -- set CTATOOLS before sourcing ctatools-init.csh" -else if(-x "$CTATOOLS/bin/ctatools-setup") then - set ctatools_init=`$CTATOOLS/bin/ctatools-setup csh` - if($status == 0 && "x$ctatools_init" != x) then - if(-f "$ctatools_init") then - source $ctatools_init - endif - \rm -f $ctatools_init - endif - unset ctatools_init -else - echo "ctatools-init.csh: ERROR -- cannot execute $CTATOOLS/bin/ctatools-setup" -endif diff --git a/src/ctatools-init.sh b/src/ctatools-init.sh deleted file mode 100755 index 742e935..0000000 --- a/src/ctatools-init.sh +++ /dev/null @@ -1,21 +0,0 @@ -# Filename: ctatools-init.sh -# Description: Bourne-shell flavor initialization for ctatools. -# Runs ctatools-setup to generate a sh script tailored -# specifically to this user and ctatools installation, -# then source that. -# Author/Date: Juergen Knoedlseder, IRAP, July 16, 2011 -# -if [ "x$CTATOOLS" = x ]; then - echo "ctatools-init.sh: ERROR -- set CTATOOLS before sourcing ctatools-init.sh" -elif [ -x "$CTATOOLS/bin/ctatools-setup" ]; then - ctatools_init=`$CTATOOLS/bin/ctatools-setup sh` - if [ $? -eq 0 -a "x$ctatools_init" != x ]; then - if [ -f "$ctatools_init" ]; then - . $ctatools_init - fi - rm -f $ctatools_init - fi - unset ctatools_init -else - echo "ctatools-init.sh: ERROR -- cannot execute $CTATOOLS/bin/ctatools-setup" -fi diff --git a/src/ctools-init.csh b/src/ctools-init.csh new file mode 100755 index 0000000..4d5d06d --- /dev/null +++ b/src/ctools-init.csh @@ -0,0 +1,21 @@ +# Filename: ctools-init.csh +# Description: C-shell flavor initialization for ctools +# runs ctools-setup to generate a temporary csh script +# tailored specifically to this user and ctools +# installation, then source that. +# Author/Date: Juergen Knoedlseder, IRAP, July 16, 2011 +# +if(${?CTOOLS} == 0) then + echo "ctools-init.csh: ERROR -- set CTOOLS before sourcing ctools-init.csh" +else if(-x "$CTOOLS/bin/ctools-setup") then + set ctools_init=`$CTOOLS/bin/ctools-setup csh` + if($status == 0 && "x$ctools_init" != x) then + if(-f "$ctools_init") then + source $ctools_init + endif + \rm -f $ctools_init + endif + unset ctools_init +else + echo "ctools-init.csh: ERROR -- cannot execute $CTOOLS/bin/ctools-setup" +endif diff --git a/src/ctools-init.sh b/src/ctools-init.sh new file mode 100755 index 0000000..285c2e2 --- /dev/null +++ b/src/ctools-init.sh @@ -0,0 +1,21 @@ +# Filename: ctools-init.sh +# Description: Bourne-shell flavor initialization for ctools. +# Runs ctools-setup to generate a sh script tailored +# specifically to this user and ctools installation, +# then source that. +# Author/Date: Juergen Knoedlseder, IRAP, July 16, 2011 +# +if [ "x$CTOOLS" = x ]; then + echo "ctools-init.sh: ERROR -- set CTOOLS before sourcing ctools-init.sh" +elif [ -x "$CTOOLS/bin/ctools-setup" ]; then + ctools_init=`$CTOOLS/bin/ctools-setup sh` + if [ $? -eq 0 -a "x$ctools_init" != x ]; then + if [ -f "$ctools_init" ]; then + . $ctools_init + fi + rm -f $ctools_init + fi + unset ctools_init +else + echo "ctools-init.sh: ERROR -- cannot execute $CTOOLS/bin/ctools-setup" +fi diff --git a/src/ctatools-setup.in b/src/ctools-setup.in index dadcdc9..26ba6ea 100644 --- a/src/ctatools-setup.in +++ b/src/ctools-setup.in @@ -1,9 +1,9 @@ #! /bin/sh -# Filename: ctatools-setup(.in) -# Description: Writes an initialization script for ctatools software +# Filename: ctools-setup(.in) +# Description: Writes an initialization script for ctools software # which is custom fit to the user and the particular # software installation. Note that this script is -# designed to be invoked by ctatools-init.csh/ctatools-init.sh, +# designed to be invoked by ctools-init.csh/ctools-init.sh, # and should not normally be invoked directly by user. # Author/Date: Juergen Knoedlseder, IRAP, July 16, 2011 #------------------------------------------------------------------------------- @@ -11,15 +11,15 @@ # Set fixed parameters # ==================== this_script=`echo $0 | sed 's:.*/::'` -ctatools_info="$this_script:" -ctatools_error="$ctatools_info ERROR --" +ctools_info="$this_script:" +ctools_error="$ctools_info ERROR --" # # Extract argument # ================ flavor=$1 if [ "x$flavor" != xcsh -a "x$flavor" != xsh ]; then - echo "$ctatools_info usage $this_script csh|sh" >&2 + echo "$ctools_info usage $this_script csh|sh" >&2 exit 3 fi @@ -27,16 +27,16 @@ fi # Set parameters # ============== prefix="@prefix@" -ctatools_bin="@prefix@/bin" -ctatools_lib="@prefix@/lib" +ctools_bin="@prefix@/bin" +ctools_lib="@prefix@/lib" uname_system=`uname` python_dir="@pythondir@" pkgconfig_dir="@prefix@/lib/pkgconfig" -man_dir="@prefix@/share/doc/ctatools/man" +man_dir="@prefix@/share/doc/ctools/man" # # Make pfiles available (this is needed for an installation where the -# ctatools reside in a directory different from GammaLib, as the +# ctools reside in a directory different from GammaLib, as the # system does not know in this case where the syspfiles directory is # =================================================================== if [ -d $prefix/syspfiles/. ]; then @@ -45,7 +45,7 @@ if [ -d $prefix/syspfiles/. ]; then if [ ! -w $HOME/pfiles/. ]; then mkdir $HOME/pfiles if [ $? -ne 0 ]; then - echo "$ctatools_error cannot create local pfiles directory $HOME/pfiles" >&2 + echo "$ctools_error cannot create local pfiles directory $HOME/pfiles" >&2 exit 3 fi fi @@ -83,11 +83,11 @@ fi # Set LD_LIBRARY_PATH # =================== if [ "x$LD_LIBRARY_PATH" = x ]; then - LD_LIBRARY_PATH="$ctatools_lib" + LD_LIBRARY_PATH="$ctools_lib" else LD_LIBRARY_PATH=`echo ":$LD_LIBRARY_PATH:" | \ - sed "s%:$ctatools_lib:%:%g" | sed "s%::*$%%"` - LD_LIBRARY_PATH="$ctatools_lib$LD_LIBRARY_PATH" + sed "s%:$ctools_lib:%:%g" | sed "s%::*$%%"` + LD_LIBRARY_PATH="$ctools_lib$LD_LIBRARY_PATH" fi # @@ -96,19 +96,19 @@ fi case $uname_system in Darwin*) if [ "x$DYLD_LIBRARY_PATH" = x ]; then - DYLD_LIBRARY_PATH="$ctatools_lib" + DYLD_LIBRARY_PATH="$ctools_lib" else DYLD_LIBRARY_PATH=`echo ":$DYLD_LIBRARY_PATH:" | \ - sed "s%:$ctatools_lib:%:%g" | sed "s%::*$%%"` - DYLD_LIBRARY_PATH="$ctatools_lib$DYLD_LIBRARY_PATH" + sed "s%:$ctools_lib:%:%g" | sed "s%::*$%%"` + DYLD_LIBRARY_PATH="$ctools_lib$DYLD_LIBRARY_PATH" fi ;; CYGWIN*) if [ "x$PATH" = x ]; then - PATH="$ctatools_lib" + PATH="$ctools_lib" else - PATH=`echo ":$PATH:" | sed "s%:$ctatools_lib:%:%g" | sed "s%::*$%%"` - PATH="$ctatools_lib$PATH" + PATH=`echo ":$PATH:" | sed "s%:$ctools_lib:%:%g" | sed "s%::*$%%"` + PATH="$ctools_lib$PATH" fi ;; esac @@ -139,11 +139,11 @@ fi # Set PATH # ======== if [ "x$PATH" = x ]; then - PATH="$ctatools_bin" + PATH="$ctools_bin" else PATH=`echo ":$PATH:" | \ - sed "s%:$ctatools_bin:%:%g" | sed "s%::*$%%"` - PATH="$ctatools_bin$PATH" + sed "s%:$ctools_bin:%:%g" | sed "s%::*$%%"` + PATH="$ctools_bin$PATH" fi # @@ -167,26 +167,26 @@ varlist="PATH PYTHONPATH PKG_CONFIG_PATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH MANPA # ================================================== # Name of temporary config script HOST_NAME=`hostname` -ctatools_config="$HOME/ctatools-config-$HOST_NAME" +ctools_config="$HOME/ctools-config-$HOST_NAME" # Bourne Shell version, write only for sh flavor initialization if [ $flavor = sh ]; then - rm -f $ctatools_config$$.sh - touch $ctatools_config$$.sh + rm -f $ctools_config$$.sh + touch $ctools_config$$.sh for var in $varlist; do eval "if [ \"x\$$var\" != x ]; then - echo \"\$var=\\\"\$$var\\\"; export \$var\" >> $ctatools_config$$.sh; + echo \"\$var=\\\"\$$var\\\"; export \$var\" >> $ctools_config$$.sh; fi" done - echo "$ctatools_config$$.sh" + echo "$ctools_config$$.sh" # C Shell version, write only for csh flavor initialization elif [ $flavor = csh ]; then - rm -f $ctatools_config$$.csh - touch $ctatools_config$$.csh + rm -f $ctools_config$$.csh + touch $ctools_config$$.csh for var in $varlist; do eval "if [ \"x\$$var\" != x ]; then - echo setenv \$var \\\"\$$var\\\" >> $ctatools_config$$.csh; + echo setenv \$var \\\"\$$var\\\" >> $ctools_config$$.csh; fi" done - echo "$ctatools_config$$.csh" + echo "$ctools_config$$.csh" fi diff --git a/test/README b/test/README index 2123bac..c7493dd 100644 --- a/test/README +++ b/test/README @@ -1,5 +1,5 @@ This folder contains files used for unit testing and files that serve -as example scripts for ctatools. +as example scripts for ctools. test_cscripts.sh Unit test for cscripts. @@ -8,7 +8,7 @@ test_ctools.sh Unit test for ctools. test_python.py - Unit test for ctatools Python interface. + Unit test for ctools Python interface. example_models.py Example Python pipeline for unbinned analysis that is executed diff --git a/test/example_models.py b/test/example_models.py index e36bd7d..bb51d87 100755 --- a/test/example_models.py +++ b/test/example_models.py @@ -19,7 +19,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * from math import * import os diff --git a/test/example_survey.py b/test/example_survey.py index 744928c..54056b6 100755 --- a/test/example_survey.py +++ b/test/example_survey.py @@ -19,7 +19,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * from math import * import os diff --git a/test/test_cscripts.sh.in b/test/test_cscripts.sh.in index 8664aad..2c02885 100755 --- a/test/test_cscripts.sh.in +++ b/test/test_cscripts.sh.in @@ -1,6 +1,6 @@ #! /bin/bash # ========================================================================== -# This script tests all cscripts that are shipped with ctatools +# This script tests all cscripts that are shipped with ctools # # Copyright (C) 2011 Jurgen Knodlseder # diff --git a/test/test_python.py b/test/test_python.py index 92413e6..89d8520 100755 --- a/test/test_python.py +++ b/test/test_python.py @@ -1,7 +1,7 @@ #! /usr/bin/env python # ========================================================================== # This script illustrates how to build an unbinned analysis pipeline using -# the ctatools. +# the ctools. # # Copyright (C) 2011 Jurgen Knodlseder # @@ -19,7 +19,7 @@ # along with this program. If not, see . # # ========================================================================== -from ctatools import * +from ctools import * from gammalib import * from math import * import os @@ -175,12 +175,12 @@ def pipeline_v2(): #==========================# if __name__ == '__main__': """ - Test ctatools Python modules. + Test ctools Python modules. """ # Dump header print "" print "*************************************" - print "* ctatools Python interface testing *" + print "* ctools Python interface testing *" print "************************************" # Set PFILES environment variable