diff --git a/examples/semi_coherent_search_using_MCMC.py b/examples/semi_coherent_search_using_MCMC.py index 1049a77da96807af5eec32ac528aac1c9c7e2073..cd8d95acb64775b25a4140760bd3dceb07b3119d 100644 --- a/examples/semi_coherent_search_using_MCMC.py +++ b/examples/semi_coherent_search_using_MCMC.py @@ -17,7 +17,7 @@ tref = .5*(tstart+tend) depth = 10 h0 = sqrtSX / depth -label = 'semi_coherent_search_using_MCMC' +label = 'semicoherent_search_using_MCMC' outdir = 'data' data = pyfstat.Writer( @@ -53,7 +53,7 @@ nwalkers = 100 nsteps = [300, 300] mcmc = pyfstat.MCMCSemiCoherentSearch( - label=label, outdir=outdir, nsegs=3, + label=label, outdir=outdir, nsegs=10, sftfilepattern='{}/*{}*sft'.format(outdir, label), theta_prior=theta_prior, tref=tref, minStartTime=tstart, maxStartTime=tend, nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps, diff --git a/pyfstat/mcmc_based_searches.py b/pyfstat/mcmc_based_searches.py index f56677e78ded241aa043d0e152f7d4b70f148258..3ba569c53e596bdb26b35592aaf5d9603d1e99fa 100644 --- a/pyfstat/mcmc_based_searches.py +++ b/pyfstat/mcmc_based_searches.py @@ -416,14 +416,30 @@ class MCMCSearch(core.BaseSearchClass): tau0S = 7.3e-5 tau0LD = 4.2e-7 else: - tau0S = 5.0e-5 tau0LD = 6.2e-8 + tau0T = 1.5e-8 + tau0S = 5.0e-5 + tau0C = 5.6e-6 Nsfts = (self.maxStartTime - self.minStartTime) / 1800. - numb_evals = np.sum(self.nsteps)*self.nwalkers*self.ntemps - a = tau0S * numb_evals - b = tau0LD * Nsfts * numb_evals + if hasattr(self, 'run_setup'): + ts = [] + for row in self.run_setup: + nsteps = row[0] + nsegs = row[1] + numb_evals = np.sum(nsteps)*self.nwalkers*self.ntemps + t = (tau0S + tau0LD*Nsfts) * numb_evals + if nsegs > 1: + t += (tau0C + tau0T*Nsfts)*nsegs*numb_evals + ts.append(t) + time = np.sum(ts) + else: + numb_evals = np.sum(self.nsteps)*self.nwalkers*self.ntemps + time = (tau0S + tau0LD*Nsfts) * numb_evals + if getattr(self, 'nsegs', 1) > 1: + time += (tau0C + tau0T*Nsfts)*self.nsegs*numb_evals + logging.info('Estimated run-time = {} s = {:1.0f}:{:1.0f} m'.format( - a+b, *divmod(a+b, 60))) + time, *divmod(time, 60))) def run(self, proposal_scale_factor=2, create_plots=True, window=50, **kwargs): @@ -2053,6 +2069,7 @@ class MCMCFollowUpSearch(MCMCSemiCoherentSearch): run_setup, NstarMax=NstarMax, Nsegs0=Nsegs0, log_table=log_table, gen_tex_table=gen_tex_table) self.run_setup = run_setup + self._estimate_run_time() self.old_data_is_okay_to_use = self._check_old_data_is_okay_to_use() if self.old_data_is_okay_to_use is True: