diff --git a/configure.ac b/configure.ac index ee4482d..8851bd1 100644 --- a/configure.ac +++ b/configure.ac @@ -32,8 +32,8 @@ AC_INIT([ctools], [1.5.0.dev1], [jurgen.knodlseder@irap.omp.eu], [ctools]) AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp]) AC_CONFIG_MACRO_DIR([m4]) #AM_INIT_AUTOMAKE([gnu no-dependencies foreign]) -AM_INIT_AUTOMAKE([gnu -Wno-portability foreign]) -#AM_INIT_AUTOMAKE([gnu -Wno-portability foreign serial-tests]) +#AM_INIT_AUTOMAKE([gnu -Wno-portability foreign]) +AM_INIT_AUTOMAKE([gnu -Wno-portability foreign serial-tests]) AC_CONFIG_HEADER([config.h]) diff --git a/cscripts/cscaldb.py b/cscripts/cscaldb.py index 3427869..f765773 100755 --- a/cscripts/cscaldb.py +++ b/cscripts/cscaldb.py @@ -53,13 +53,8 @@ class cscaldb(ctools.cscript): TypeError An invalid number of command line arguments was provided. """ - # Set name - self._name = 'cscaldb' - self._version = ctools.__version__ - - # Initialise application by calling the appropriate class - # constructor. - self._init_cscript(argv) + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Return return diff --git a/cscripts/csfindobs.py b/cscripts/csfindobs.py index 3addbe4..9e84088 100755 --- a/cscripts/csfindobs.py +++ b/cscripts/csfindobs.py @@ -38,9 +38,10 @@ class csfindobs(ctools.cscript): """ Constructor """ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) + # Set name - self._name = 'csfindobs' - self._version = ctools.__version__ self._datapath = os.getenv('VHEFITS','') self._prodname = '' self._select_radec = True @@ -49,9 +50,6 @@ class csfindobs(ctools.cscript): self._dec = 0.0 self._obs_index = '' self._runs = [] - - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) # Return return diff --git a/cscripts/csiactcopy.py b/cscripts/csiactcopy.py index c1f0bf9..8d2b5b1 100755 --- a/cscripts/csiactcopy.py +++ b/cscripts/csiactcopy.py @@ -42,9 +42,10 @@ class csiactcopy(ctools.cscript): """ Constructor """ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) + # Set name - self._name = 'csiactcopy' - self._version = ctools.__version__ self._datapath = os.getenv('VHEFITS','') self._remote_master = gammalib.GFilename() self._remote_base = '' @@ -53,10 +54,6 @@ class csiactcopy(ctools.cscript): self._runlist = gammalib.GFilename() self._runs = [] - # Initialise application by calling the appropriate class - # constructor. - self._init_cscript(argv) - # Return return diff --git a/cscripts/csiactdata.py b/cscripts/csiactdata.py index bfc8aae..d2211eb 100755 --- a/cscripts/csiactdata.py +++ b/cscripts/csiactdata.py @@ -43,18 +43,15 @@ class csiactdata(ctools.cscript): """ Constructor. """ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) + # Set name - self._name = 'csiactdata' - self._version = ctools.__version__ self._datapath = os.getenv('VHEFITS','') self._prodnames = [] self._master_indx = '' self._master_file = '' - # Initialise application by calling the appropriate class - # constructor. - self._init_cscript(argv) - # Return return diff --git a/cscripts/csiactobs.py b/cscripts/csiactobs.py index a6e58d4..1ac36be 100755 --- a/cscripts/csiactobs.py +++ b/cscripts/csiactobs.py @@ -45,9 +45,8 @@ class csiactobs(ctools.cscript): """ Constructor """ - # Set name and version - self._name = 'csiactobs' - self._version = ctools.__version__ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Initialise some members self._obs = gammalib.GObservations() @@ -82,9 +81,6 @@ class csiactobs(ctools.cscript): self._xml.append(gammalib.GXmlElement('observation_list ' 'title="observation list"')) - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) - # Append an observation list to XML instance self._xml.append(gammalib.GXmlElement('observation_list title="observation list"')) self._xml_obslist = self._xml.element('observation_list', 0) diff --git a/cscripts/csmodelinfo.py b/cscripts/csmodelinfo.py index 573cc7f..ac250fd 100755 --- a/cscripts/csmodelinfo.py +++ b/cscripts/csmodelinfo.py @@ -42,16 +42,12 @@ class csmodelinfo(ctools.cscript): """ Constructor """ - # Set name - self._name = 'csmodelinfo' - self._version = ctools.__version__ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Initialise class members self._models = gammalib.GModels() - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) - # Return return diff --git a/cscripts/csmodelmerge.py b/cscripts/csmodelmerge.py index 98ab11a..661ae16 100755 --- a/cscripts/csmodelmerge.py +++ b/cscripts/csmodelmerge.py @@ -41,18 +41,13 @@ class csmodelmerge(ctools.cscript): """ Constructor. """ - # Set name - self._name = 'csmodelmerge' - self._version = ctools.__version__ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Initialise class members self._files = None self._models = gammalib.GModels() - # Initialise application by calling the appropriate class - # constructor. - self._init_cscript(argv) - # Return return diff --git a/cscripts/csmodelsois.py b/cscripts/csmodelsois.py index cac3f46..46d518f 100755 --- a/cscripts/csmodelsois.py +++ b/cscripts/csmodelsois.py @@ -50,17 +50,13 @@ class csmodelsois(ctools.cscript): TypeError An invalid number of command line arguments was provided. """ - # Set name and version - self._name = 'csmodelsois' - self._version = ctools.__version__ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Initialize parameters self._cubegen = ctools.ctmapcube() self._models = gammalib.GModels() self._cubemodels = gammalib.GModels() - - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) # Return return diff --git a/cscripts/csobsdef.py b/cscripts/csobsdef.py index a451c45..279ffd3 100755 --- a/cscripts/csobsdef.py +++ b/cscripts/csobsdef.py @@ -84,18 +84,14 @@ class csobsdef(ctools.cscript): List of IRAF command line parameter strings of the form ``parameter=3``. """ - # Set name and version - self._name = 'csobsdef' - self._version = ctools.__version__ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Initialise class members self._obs = gammalib.GObservations() self._pntdef = gammalib.GCsv() self._tmin = 0.0 - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) - # Return return diff --git a/cscripts/csroot2caldb.py b/cscripts/csroot2caldb.py index 02f2897..477f4ad 100755 --- a/cscripts/csroot2caldb.py +++ b/cscripts/csroot2caldb.py @@ -48,12 +48,8 @@ class csroot2caldb(ctools.cscript): """ Constructor """ - # Set name - self._name = 'csroot2caldb' - self._version = ctools.__version__ - - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Return return diff --git a/cscripts/cssrcdetect.py b/cscripts/cssrcdetect.py index f26a37e..af072a6 100755 --- a/cscripts/cssrcdetect.py +++ b/cscripts/cssrcdetect.py @@ -38,9 +38,8 @@ class cssrcdetect(ctools.cscript): """ Constructor """ - # Set name - self._name = 'cssrcdetect' - self._version = ctools.__version__ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Set protected members self._models = gammalib.GModels() @@ -52,9 +51,6 @@ class cssrcdetect(ctools.cscript): else: self._map = gammalib.GSkyMap() - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) - # Return return diff --git a/cscripts/cstsmapmerge.py b/cscripts/cstsmapmerge.py index ff9dc78..d6cd58f 100755 --- a/cscripts/cstsmapmerge.py +++ b/cscripts/cstsmapmerge.py @@ -38,9 +38,8 @@ class cstsmapmerge(ctools.cscript): """ Constructor. """ - # Set name - self._name = 'cstsmapmerge' - self._version = ctools.__version__ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Initialise class members self._files = None @@ -53,10 +52,6 @@ class cstsmapmerge(ctools.cscript): self._overwrite = True self._delete = False - # Initialise application by calling the appropriate class - # constructor. - self._init_cscript(argv) - # Return return diff --git a/cscripts/csviscube.py b/cscripts/csviscube.py index ba50d24..5e08194 100755 --- a/cscripts/csviscube.py +++ b/cscripts/csviscube.py @@ -48,16 +48,12 @@ class csviscube(ctools.cscript): TypeError An invalid number of command line arguments was provided. """ - # Set name - self._name = 'csviscube' - self._version = ctools.__version__ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Initialise members self._cube = gammalib.GSkyMap() - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) - # Return return @@ -499,7 +495,7 @@ class csviscube(ctools.cscript): # Set default name is user name is empty if not name: - user_name = self._name + user_name = self._name() else: user_name = name diff --git a/cscripts/csworkflow.py b/cscripts/csworkflow.py index 6ff6710..55d00db 100755 --- a/cscripts/csworkflow.py +++ b/cscripts/csworkflow.py @@ -51,17 +51,13 @@ class csworkflow(ctools.cscript): TypeError An invalid number of command line arguments was provided. """ - # Set name and version - self._name = 'csworkflow' - self._version = ctools.__version__ + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Set members self._workflow = gammalib.GXml() self._actors = [] - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) - # Return return diff --git a/pyext/ctool.i b/pyext/ctool.i index a7cfc9b..377ba81 100644 --- a/pyext/ctool.i +++ b/pyext/ctool.i @@ -242,11 +242,11 @@ def _set_input_obs(self, argv): cscript._set_input_obs = _set_input_obs # Initialise application by calling the appropriate class constructor -def _init_cscript(self, argv): +def _init_cscript(self, name, version, argv): if len(argv) == 0: - cscript.__init__(self, self._name, self._version) + cscript.__init__(self, name, version) elif len(argv) == 1: - cscript.__init__(self, self._name, self._version, *argv) + cscript.__init__(self, name, version, *argv) else: raise TypeError('Invalid number of arguments given.') # Set logger properties diff --git a/test/test_cscript.py b/test/test_cscript.py index f4e58da..77b6f0f 100755 --- a/test/test_cscript.py +++ b/test/test_cscript.py @@ -35,15 +35,8 @@ class cscript_test(ctools.cscript): """ Constructor """ - # Set name - self._name = 'cscript_test' - self._version = ctools.__version__ - - # Initialise observation container from constructor arguments - self._obs, argv = self._set_input_obs(argv) - - # Initialise application by calling the appropriate class constructor - self._init_cscript(argv) + # Initialise application by calling the base class constructor + self._init_cscript(self.__class__.__name__, ctools.__version__, argv) # Return return @@ -153,7 +146,7 @@ class ctobservation_test(ctools.csobservation): Constructor """ # Initialise application by calling the appropriate class constructor - self._init_csobservation('ctobservation_test', ctools.__version__, argv) + self._init_csobservation(self.__class__.__name__, ctools.__version__, argv) # Return return @@ -211,7 +204,7 @@ class ctlikelihood_test(ctools.cslikelihood): Constructor """ # Initialise application by calling the appropriate class constructor - self._init_cslikelihood('ctlikelihood_test', ctools.__version__, argv) + self._init_cslikelihood(self.__class__.__name__, ctools.__version__, argv) # Return return