diff --git a/cscripts/cslightcrv.py b/cscripts/cslightcrv.py index 2cdb9de..756f82a 100755 --- a/cscripts/cslightcrv.py +++ b/cscripts/cslightcrv.py @@ -2,7 +2,7 @@ # ========================================================================== # Generates a lightcurve. # -# Copyright (C) 2014-2018 Michael Mayer +# Copyright (C) 2014-2019 Michael Mayer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -502,7 +502,7 @@ class cslightcrv(ctools.csobservation): # and compute the stacked response functions and setup # an observation container with a single stacked observation. if self._stacked: - new_obs = obsutils.get_stacked_obs(self, obs) + new_obs = obsutils.get_stacked_obs(self, obs, nthreads=1) # ... otherwise if On/Off analysis is requested generate # the On/Off observations and response diff --git a/cscripts/cssens.py b/cscripts/cssens.py index 9d31875..4271e8e 100755 --- a/cscripts/cssens.py +++ b/cscripts/cssens.py @@ -83,7 +83,7 @@ class cssens(ctools.csobservation): 'dec' : self._dec, 'log_clients' : self._log_clients, 'models' : self._models, - 'nthreads' : self._nthreads} + 'nthreads' : self._nthreads} # Return pickled dictionary return state diff --git a/cscripts/obsutils.py b/cscripts/obsutils.py index fad1bce..1d110cc 100755 --- a/cscripts/obsutils.py +++ b/cscripts/obsutils.py @@ -1,7 +1,7 @@ # ========================================================================== # Utility functions for observation handling # -# Copyright (C) 2011-2018 Juergen Knoedlseder +# Copyright (C) 2011-2019 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -670,7 +670,7 @@ def get_stacked_response(obs, cntcube, edisp=False, addbounds=False, # ================================= # # Get stacked observation container # # ================================= # -def get_stacked_obs(cls, obs): +def get_stacked_obs(cls, obs, nthreads=0): """ Bin an observation and return an observation container with a single binned observation @@ -681,6 +681,8 @@ def get_stacked_obs(cls, obs): cscript class obs : `~gammalib.GObservations` Observation container + nthreads : str, optional + Number of parallel processes for On/Off spectra computation (0=all available CPUs) Returns ------- @@ -705,6 +707,7 @@ def get_stacked_obs(cls, obs): cntcube['emax'] = cls['emax'].real() cntcube['coordsys'] = cls['coordsys'].string() cntcube['proj'] = cls['proj'].string() + cntcube['nthreads'] = nthreads cntcube.run() # Store counts cube so that we can use it to build the background