diff --git a/examples/computing_the_Bayes_factor.py b/examples/computing_the_Bayes_factor.py index 69129607339640302f7e1ae201711008520a69f3..7ddead59a4bdcb635cb533a92ef87486ac52cb78 100644 --- a/examples/computing_the_Bayes_factor.py +++ b/examples/computing_the_Bayes_factor.py @@ -19,7 +19,7 @@ theta_prior = {'F0': {'type': 'unif', 'lower': F0*(1-1e-6), 'upper': F0*(1+1e-6) } ntemps = 20 -log10temperature_min = -2 +log10beta_min = -2 nwalkers = 100 nsteps = [500, 500] @@ -27,7 +27,7 @@ mcmc = MCMCSearch(label='computing_the_Bayes_factor', outdir='data', sftfilepattern='data/*basic*sft', theta_prior=theta_prior, tref=tref, tstart=tstart, tend=tend, nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps, - log10temperature_min=log10temperature_min) + log10beta_min=log10beta_min) mcmc.run() mcmc.plot_corner(add_prior=True) mcmc.print_summary() diff --git a/examples/follow_up.py b/examples/follow_up.py index 675c2e0fae6e8cf7e25993b27e5de6a230bc81c9..b9efbaaa58ad69a6b26892423566ca874e0359e3 100644 --- a/examples/follow_up.py +++ b/examples/follow_up.py @@ -19,7 +19,7 @@ theta_prior = {'F0': {'type': 'unif', 'lower': F0*(1-1e-6), 'upper': F0*(1+1e-5) } ntemps = 1 -log10temperature_min = -1 +log10beta_min = -1 nwalkers = 100 run_setup = [(1000, 50), (1000, 25), (1000, 1, False), ((500, 500), 1, True)] @@ -28,7 +28,7 @@ mcmc = pyfstat.MCMCFollowUpSearch( label='follow_up', outdir='data', sftfilepattern='data/*basic*sft', theta_prior=theta_prior, tref=tref, minStartTime=tstart, maxStartTime=tend, nwalkers=nwalkers, - ntemps=ntemps, log10temperature_min=log10temperature_min) + ntemps=ntemps, log10beta_min=log10beta_min) mcmc.run(run_setup, gen_tex_table=True) #mcmc.run(Nsegs0=50) mcmc.plot_corner(add_prior=True) diff --git a/examples/fully_coherent_search_using_MCMC.py b/examples/fully_coherent_search_using_MCMC.py index 353ac617f0978f6169255c615e6cbd38a11bf65d..994c8cfa97aaff66a4cc741c0ccbdcc28369acac 100644 --- a/examples/fully_coherent_search_using_MCMC.py +++ b/examples/fully_coherent_search_using_MCMC.py @@ -47,7 +47,7 @@ theta_prior = {'F0': {'type': 'unif', } ntemps = 1 -log10temperature_min = -1 +log10beta_min = -1 nwalkers = 100 nsteps = [1000, 1000] @@ -55,7 +55,7 @@ mcmc = pyfstat.MCMCSearch( label='fully_coherent_search_using_MCMC', outdir='data', sftfilepattern='data/*'+data_label+'*sft', theta_prior=theta_prior, tref=tref, minStartTime=tstart, maxStartTime=tend, nsteps=nsteps, nwalkers=nwalkers, - ntemps=ntemps, log10temperature_min=log10temperature_min) + ntemps=ntemps, log10beta_min=log10beta_min) mcmc.run(context='paper', subtractions=[30, -1e-10], c=2) mcmc.plot_corner(add_prior=True) mcmc.print_summary() diff --git a/examples/fully_coherent_search_using_MCMC_on_glitching_data.py b/examples/fully_coherent_search_using_MCMC_on_glitching_data.py index 3b9b60a3bbeb0f624027cebea6e9376ca483811e..011cd5d0b4f417f6ed2bcff92c7ed57f5118012c 100644 --- a/examples/fully_coherent_search_using_MCMC_on_glitching_data.py +++ b/examples/fully_coherent_search_using_MCMC_on_glitching_data.py @@ -21,7 +21,7 @@ theta_prior = {'F0': {'type': 'unif', 'lower': F0-1e-4, 'upper': F0+1e-4}, } ntemps = 2 -log10temperature_min = -0.01 +log10beta_min = -0.01 nwalkers = 100 nsteps = [500, 500] @@ -29,7 +29,7 @@ mcmc = MCMCSearch('fully_coherent_search_using_MCMC_on_glitching_data', 'data', sftfilepattern='data/*_glitch*.sft', theta_prior=theta_prior, tref=tref, minStartTime=tstart, maxStartTime=tend, nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps, - log10temperature_min=log10temperature_min) + log10beta_min=log10beta_min) mcmc.run() mcmc.plot_corner(add_prior=True) mcmc.print_summary() diff --git a/examples/glitch_robust_search.py b/examples/glitch_robust_search.py index 731fb83a7fb3df59c1dcf98f4b528c62e1d2253e..5964b6f9f11b9fe6bf39d86c2e3f62d0e9e7e307 100644 --- a/examples/glitch_robust_search.py +++ b/examples/glitch_robust_search.py @@ -47,7 +47,7 @@ theta_prior = {'F0': {'type': 'unif', search = pyfstat.MCMCGlitchSearch( label=label, outdir=outdir, sftfilepattern=sftfilepattern, theta_prior=theta_prior, nglitch=1, tref=tref, nsteps=[500, 500], - ntemps=3, log10temperature_min=-0.5, minStartTime=tstart, + ntemps=3, log10beta_min=-0.5, minStartTime=tstart, maxStartTime=tstart+Tspan) search.run() search.plot_corner(label_offset=0.8, add_prior=True) diff --git a/examples/semi_coherent_glitch_search_using_MCMC.py b/examples/semi_coherent_glitch_search_using_MCMC.py index f55c3429654c6e1ffe23f6ccfaa84d226718fa0e..06caa43aefb397dd574c3685d0cab9709092b36b 100644 --- a/examples/semi_coherent_glitch_search_using_MCMC.py +++ b/examples/semi_coherent_glitch_search_using_MCMC.py @@ -25,7 +25,7 @@ theta_prior = {'F0': {'type': 'norm', 'loc': F0, 'scale': abs(1e-6*F0)}, } ntemps = 4 -log10temperature_min = -1 +log10beta_min = -1 nwalkers = 100 nsteps = [5000, 1000, 1000] @@ -34,7 +34,7 @@ mcmc = pyfstat.MCMCGlitchSearch( sftfilepattern='data/*_glitch*sft', theta_prior=theta_prior, tref=tref, tstart=tstart, tend=tend, nsteps=nsteps, nwalkers=nwalkers, scatter_val=1e-10, nglitch=1, ntemps=ntemps, - log10temperature_min=log10temperature_min) + log10beta_min=log10beta_min) mcmc.run() mcmc.plot_corner(add_prior=True) diff --git a/examples/semi_coherent_search_using_MCMC.py b/examples/semi_coherent_search_using_MCMC.py index 4d08e3d64d4985e1dc5c56ebb9420eb4198d5cfe..ac10782ab9de4df64920d4d061f6f4507b24a1d6 100644 --- a/examples/semi_coherent_search_using_MCMC.py +++ b/examples/semi_coherent_search_using_MCMC.py @@ -19,7 +19,7 @@ theta_prior = {'F0': {'type': 'unif', 'lower': F0*(1-1e-6), 'upper': F0*(1+1e-5) } ntemps = 1 -log10temperature_min = -1 +log10beta_min = -1 nwalkers = 100 nsteps = [500, 500, 500] @@ -27,7 +27,7 @@ mcmc = pyfstat.MCMCSemiCoherentSearch( label='semi_coherent_search_using_MCMC', outdir='data', nsegs=20, sftfilepattern='data/*basic*sft', theta_prior=theta_prior, tref=tref, minStartTime=tstart, maxStartTime=tend, nsteps=nsteps, nwalkers=nwalkers, - ntemps=ntemps, log10temperature_min=log10temperature_min) + ntemps=ntemps, log10beta_min=log10beta_min) mcmc.run() mcmc.plot_corner(add_prior=True) mcmc.print_summary() diff --git a/examples/transient_search_using_MCMC.py b/examples/transient_search_using_MCMC.py index 62419c11086f5cd177250e02cc0c1f39a40a0e73..b70dc3d85c1d17d5ab5906887dfabc4184922f5c 100644 --- a/examples/transient_search_using_MCMC.py +++ b/examples/transient_search_using_MCMC.py @@ -34,7 +34,7 @@ theta_prior = {'F0': {'type': 'unif', } ntemps = 2 -log10temperature_min = -1 +log10beta_min = -1 nwalkers = 100 nsteps = [100, 100] @@ -43,7 +43,7 @@ mcmc = pyfstat.MCMCTransientSearch( sftfilepattern='data/*simulated_transient_signal*sft', theta_prior=theta_prior, tref=tref, minStartTime=minStartTime, maxStartTime=maxStartTime, nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps, - log10temperature_min=log10temperature_min) + log10beta_min=log10beta_min) mcmc.run() mcmc.plot_corner(label_offset=0.7) mcmc.print_summary() diff --git a/examples/twoF_cumulative.py b/examples/twoF_cumulative.py index 22481fc2aef06a7b20f7019f9f78e75e17343c19..cd7f0426b7fc92a8244b17958877c3e8a1672d47 100644 --- a/examples/twoF_cumulative.py +++ b/examples/twoF_cumulative.py @@ -47,7 +47,7 @@ theta_prior = {'F0': {'type': 'unif', } ntemps = 1 -log10temperature_min = -1 +log10beta_min = -1 nwalkers = 100 nsteps = [50, 50] @@ -55,7 +55,7 @@ mcmc = pyfstat.MCMCSearch( label='twoF_cumulative', outdir='data', sftfilepattern='data/*'+data_label+'*sft', theta_prior=theta_prior, tref=tref, minStartTime=tstart, maxStartTime=tend, nsteps=nsteps, nwalkers=nwalkers, - ntemps=ntemps, log10temperature_min=log10temperature_min) + ntemps=ntemps, log10beta_min=log10beta_min) mcmc.run(context='paper', subtractions=[30, -1e-10]) mcmc.plot_corner(add_prior=True) mcmc.print_summary() diff --git a/examples/weak_signal_follow_up.py b/examples/weak_signal_follow_up.py index 4c51c0d286f11f198bf7fd5b82114fc40b141425..f4c87966945922f83aba9d9d721465785c28706c 100644 --- a/examples/weak_signal_follow_up.py +++ b/examples/weak_signal_follow_up.py @@ -48,7 +48,7 @@ theta_prior = {'F0': {'type': 'unif', 'lower': F0-DeltaF0/2., } ntemps = 3 -log10temperature_min = -0.5 +log10beta_min = -0.5 nwalkers = 100 scatter_val = 1e-10 nsteps = [100, 100] @@ -57,7 +57,7 @@ mcmc = pyfstat.MCMCFollowUpSearch( label='weak_signal_follow_up', outdir='data', sftfilepattern='data/*'+data_label+'*sft', theta_prior=theta_prior, tref=tref, minStartTime=tstart, maxStartTime=tend, nwalkers=nwalkers, nsteps=nsteps, - ntemps=ntemps, log10temperature_min=log10temperature_min, + ntemps=ntemps, log10beta_min=log10beta_min, scatter_val=scatter_val) fig, axes = plt.subplots(nrows=2, ncols=2) diff --git a/pyfstat/mcmc_based_searches.py b/pyfstat/mcmc_based_searches.py index 1edffa4623110deae488653bd932dff45c75286e..cc3ebaf0b51fafe4265969cae97efe93b82d1bc2 100644 --- a/pyfstat/mcmc_based_searches.py +++ b/pyfstat/mcmc_based_searches.py @@ -48,9 +48,10 @@ class MCMCSearch(core.BaseSearchClass): nwalkers, ntemps: int, The number of walkers and temperates to use in the parallel tempered PTSampler. - log10temperature_min float < 0 - The log_10(tmin) value, the set of betas passed to PTSampler are - generated from `np.logspace(0, log10temperature_min, ntemps)`. + log10beta_min float < 0 + The log_10(beta) value, if given the set of betas passed to PTSampler + are generated from `np.logspace(0, log10beta_min, ntemps)` (given + in descending order to emcee). theta_initial: dict, array, (None) A dictionary of distribution about which to distribute the initial walkers about @@ -101,7 +102,7 @@ class MCMCSearch(core.BaseSearchClass): def __init__(self, label, outdir, theta_prior, tref, minStartTime, maxStartTime, sftfilepattern=None, detectors=None, nsteps=[100, 100], nwalkers=100, ntemps=1, - log10temperature_min=-5, theta_initial=None, + log10beta_min=-5, theta_initial=None, rhohatmax=1000, binary=False, BSGL=False, SSBprec=None, minCoverFreq=None, maxCoverFreq=None, injectSources=None, assumeSqrtSX=None): @@ -119,8 +120,8 @@ class MCMCSearch(core.BaseSearchClass): self.pickle_path = '{}/{}_saved_data.p'.format(self.outdir, self.label) self._unpack_input_theta() self.ndim = len(self.theta_keys) - if self.log10temperature_min: - self.betas = np.logspace(0, self.log10temperature_min, self.ntemps) + if self.log10beta_min: + self.betas = np.logspace(0, self.log10beta_min, self.ntemps) else: self.betas = None @@ -138,8 +139,8 @@ class MCMCSearch(core.BaseSearchClass): logging.info('nwalkers={}'.format(self.nwalkers)) logging.info('nsteps = {}'.format(self.nsteps)) logging.info('ntemps = {}'.format(self.ntemps)) - logging.info('log10temperature_min = {}'.format( - self.log10temperature_min)) + logging.info('log10beta_min = {}'.format( + self.log10beta_min)) def _initiate_search_object(self): logging.info('Setting up search object') @@ -1163,7 +1164,7 @@ class MCMCSearch(core.BaseSearchClass): d = dict(nsteps=self.nsteps, nwalkers=self.nwalkers, ntemps=self.ntemps, theta_keys=self.theta_keys, theta_prior=self.theta_prior, - log10temperature_min=self.log10temperature_min, + log10beta_min=self.log10beta_min, BSGL=self.BSGL) return d @@ -1571,7 +1572,7 @@ class MCMCGlitchSearch(MCMCSearch): def __init__(self, label, outdir, theta_prior, tref, minStartTime, maxStartTime, sftfilepattern=None, detectors=None, nsteps=[100, 100], nwalkers=100, ntemps=1, - log10temperature_min=-5, theta_initial=None, + log10beta_min=-5, theta_initial=None, rhohatmax=1000, binary=False, BSGL=False, SSBprec=None, minCoverFreq=None, maxCoverFreq=None, injectSources=None, assumeSqrtSX=None, @@ -1586,8 +1587,8 @@ class MCMCGlitchSearch(MCMCSearch): self.pickle_path = '{}/{}_saved_data.p'.format(self.outdir, self.label) self._unpack_input_theta() self.ndim = len(self.theta_keys) - if self.log10temperature_min: - self.betas = np.logspace(0, self.log10temperature_min, self.ntemps) + if self.log10beta_min: + self.betas = np.logspace(0, self.log10beta_min, self.ntemps) else: self.betas = None if args.clean and os.path.isfile(self.pickle_path): @@ -1702,7 +1703,7 @@ class MCMCGlitchSearch(MCMCSearch): d = dict(nsteps=self.nsteps, nwalkers=self.nwalkers, ntemps=self.ntemps, theta_keys=self.theta_keys, theta_prior=self.theta_prior, - log10temperature_min=self.log10temperature_min, + log10beta_min=self.log10beta_min, theta0_idx=self.theta0_idx, BSGL=self.BSGL) return d @@ -1780,7 +1781,7 @@ class MCMCSemiCoherentSearch(MCMCSearch): def __init__(self, label, outdir, theta_prior, tref, minStartTime, maxStartTime, sftfilepattern=None, detectors=None, nsteps=[100, 100], nwalkers=100, ntemps=1, - log10temperature_min=-5, theta_initial=None, + log10beta_min=-5, theta_initial=None, rhohatmax=1000, binary=False, BSGL=False, SSBprec=None, minCoverFreq=None, maxCoverFreq=None, injectSources=None, assumeSqrtSX=None, @@ -1795,8 +1796,8 @@ class MCMCSemiCoherentSearch(MCMCSearch): self.pickle_path = '{}/{}_saved_data.p'.format(self.outdir, self.label) self._unpack_input_theta() self.ndim = len(self.theta_keys) - if self.log10temperature_min: - self.betas = np.logspace(0, self.log10temperature_min, self.ntemps) + if self.log10beta_min: + self.betas = np.logspace(0, self.log10beta_min, self.ntemps) else: self.betas = None if args.clean and os.path.isfile(self.pickle_path): @@ -1816,7 +1817,7 @@ class MCMCSemiCoherentSearch(MCMCSearch): d = dict(nsteps=self.nsteps, nwalkers=self.nwalkers, ntemps=self.ntemps, theta_keys=self.theta_keys, theta_prior=self.theta_prior, - log10temperature_min=self.log10temperature_min, + log10beta_min=self.log10beta_min, BSGL=self.BSGL, nsegs=self.nsegs) return d @@ -1853,7 +1854,7 @@ class MCMCFollowUpSearch(MCMCSemiCoherentSearch): def _get_data_dictionary_to_save(self): d = dict(nwalkers=self.nwalkers, ntemps=self.ntemps, theta_keys=self.theta_keys, theta_prior=self.theta_prior, - log10temperature_min=self.log10temperature_min, + log10beta_min=self.log10beta_min, BSGL=self.BSGL, run_setup=self.run_setup) return d diff --git a/tests.py b/tests.py index 19e56c3c04abf51552bab10a50ae451c55de81cd..c6408bb2ae18c0d5dc97f13e4ca1141a5cd61cc8 100644 --- a/tests.py +++ b/tests.py @@ -227,7 +227,7 @@ class TestMCMCSearch(Test): label=self.label, outdir=outdir, theta_prior=theta, tref=tref, sftfilepattern='{}/*{}*sft'.format(Writer.outdir, Writer.label), minStartTime=minStartTime, maxStartTime=maxStartTime, - nsteps=[100, 100], nwalkers=100, ntemps=2, log10temperature_min=-1) + nsteps=[100, 100], nwalkers=100, ntemps=2, log10beta_min=-1) search.setup_burnin_convergence_testing() search.run(create_plots=False) _, FS = search.get_max_twoF()