From 632aa09fbfbadb5b3e4fc3575e5366e6cbacdb65 Mon Sep 17 00:00:00 2001 From: sadeh Date: Tue, 18 May 2021 15:04:30 +0200 Subject: [PATCH] add optional seed parameter for generating events --- cscripts/cssens.par | 1 + cscripts/cssens.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cscripts/cssens.par b/cscripts/cssens.par index 6966fe4..df4f500 100755 --- a/cscripts/cssens.par +++ b/cscripts/cssens.par @@ -44,6 +44,7 @@ statistic, s, h, DEFAULT,DEFAULT|CSTAT|WSTAT|CHI2,, "Optimization s min_src_events, i, h, -1,,, "minimal number of source counts" non_source_uncert_frac, r, h, -1,,, "fraction of no-source counts serving as minimal threshold for source counts" non_source_uncert_rad, r, h, 0.33,,, "radius for circular region in which to integrate no-source counts for threshold" +seed, i, h, 0,,, "optional seed parameter for generating events" # # Standard parameters diff --git a/cscripts/cssens.py b/cscripts/cssens.py index 618f6ea..a09fd20 100755 --- a/cscripts/cssens.py +++ b/cscripts/cssens.py @@ -376,6 +376,9 @@ class cssens(ctools.csobservation): # set edisp off for the first iterations self['edisp'] = False + # optional seed parameter for generating events + seed = self['seed'].integer() + # Set flux ratio precision required for convergence to 5% ratio_precision = 0.05 @@ -428,7 +431,7 @@ class cssens(ctools.csobservation): # Simulate events for the models. "sim" holds an observation # container with observations containing the simulated events. - sim = obsutils.sim(self.obs(), nbins=enumbins, seed=iterations, + sim = obsutils.sim(self.obs(), nbins=enumbins, seed=(iterations + seed), binsz=binsz, npix=npix, log=self._log_clients, debug=self['debug'].boolean(), @@ -718,6 +721,9 @@ class cssens(ctools.csobservation): # on the background, which is taken as 1% of the non-source counts) non_source_uncert_frac = self['non_source_uncert_frac'].real() + # optional seed parameter for generating events + seed = self['seed'].integer() + # end here if no cuts have been spesified if min_src_events <= 0 and non_source_uncert_frac <= 0: return True @@ -754,7 +760,7 @@ class cssens(ctools.csobservation): n_sim_evts = [] for n_sim in range(n_sims): - seed = n_sim + seed = n_sim + seed sim_now = obsutils.sim( obs_now, -- libgit2 0.21.4