diff --git a/cscripts/cspull.py b/cscripts/cspull.py index 6968693..67a81ac 100755 --- a/cscripts/cspull.py +++ b/cscripts/cspull.py @@ -256,8 +256,8 @@ class cspull(ctools.csobservation): onsrc=onsrc, onrad=onrad, addbounds=True, seed=seed, binsz=binsz, npix=npix, proj=proj, coord=coordsys, - edisp=edisp, log=False, debug=self._logDebug(), - chatter=self['chatter'].integer()) + edisp=edisp, nthreads=1, log=False, + debug=self._logDebug(), chatter=self['chatter'].integer()) # Determine number of events in simulation nevents = 0.0 diff --git a/cscripts/cssens.py b/cscripts/cssens.py index e1d642a..2f24df0 100755 --- a/cscripts/cssens.py +++ b/cscripts/cssens.py @@ -418,7 +418,8 @@ class cssens(ctools.csobservation): binsz=binsz, npix=npix, log=self._log_clients, debug=self['debug'].boolean(), - edisp=self['edisp'].boolean()) + edisp=self['edisp'].boolean(), + nthreads=1) # Determine number of events in simulation by summing the events # over all observations in the observation container diff --git a/cscripts/cstsdist.py b/cscripts/cstsdist.py index e43bedf..b357eaf 100755 --- a/cscripts/cstsdist.py +++ b/cscripts/cstsdist.py @@ -196,9 +196,10 @@ class cstsdist(ctools.csobservation): # only for event lists else: sim = obsutils.sim(self.obs(), - seed = seed, - log = self._log_clients, - debug = self['debug'].boolean()) + seed = seed, + log = self._log_clients, + debug = self['debug'].boolean(), + nthreads =1) # Return simulated observation return sim diff --git a/cscripts/obsutils.py b/cscripts/obsutils.py index eb92f2c..adff62e 100755 --- a/cscripts/obsutils.py +++ b/cscripts/obsutils.py @@ -28,7 +28,7 @@ import cscripts # ===================== # def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, emin=None, emax=None, nbins=0, onsrc=None, onrad=0.2, addbounds=False, - binsz=0.05, npix=200, proj='TAN', coord='GAL'): + binsz=0.05, npix=200, proj='TAN', coord='GAL',nthreads=0): """ Simulate events for all observations in the container @@ -74,6 +74,8 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, Projection for binned simulation coord : str, optional Coordinate system for binned simulation + nthreads : str, optional + Number of parallel processes for On/Off spectra computation (0=all available CPUs) Returns ------- @@ -133,6 +135,7 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, phagen['stack'] = False phagen['inexclusion'] = 'NONE' phagen['bkgmethod'] = 'REFLECTED' + phagen['nthreads'] = nthreads # Optionally open the log file if log: @@ -780,6 +783,8 @@ def get_onoff_obs(cls, obs, nthreads=0): cscript class obs : `~gammalib.GObservations` Observation container + nthreads : str, optional + Number of parallel processes for On/Off spectra computation (0=all available CPUs) Returns -------