From 6e0b510a03f4e76b1b532e1c8f5779fc1998f9e9 Mon Sep 17 00:00:00 2001 From: Gregory Ashton <gregory.ashton@ligo.org> Date: Fri, 29 Sep 2017 12:10:59 +0200 Subject: [PATCH] Renames log10temperature_min to log10beta_min The variable name was misleading and hence renamed --- examples/computing_the_Bayes_factor.py | 4 +- examples/follow_up.py | 4 +- examples/fully_coherent_search_using_MCMC.py | 4 +- ...ent_search_using_MCMC_on_glitching_data.py | 4 +- examples/glitch_robust_search.py | 2 +- .../semi_coherent_glitch_search_using_MCMC.py | 4 +- examples/semi_coherent_search_using_MCMC.py | 4 +- examples/transient_search_using_MCMC.py | 4 +- examples/twoF_cumulative.py | 4 +- examples/weak_signal_follow_up.py | 4 +- pyfstat/mcmc_based_searches.py | 37 ++++++++++--------- tests.py | 2 +- 12 files changed, 39 insertions(+), 38 deletions(-) diff --git a/examples/computing_the_Bayes_factor.py b/examples/computing_the_Bayes_factor.py index 6912960..7ddead5 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 675c2e0..b9efbaa 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 353ac61..994c8cf 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 3b9b60a..011cd5d 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 731fb83..5964b6f 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 f55c342..06caa43 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 4d08e3d..ac10782 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 62419c1..b70dc3d 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 22481fc..cd7f042 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 4c51c0d..f4c8796 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 1edffa4..cc3ebaf 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 19e56c3..c6408bb 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() -- GitLab