diff --git a/pyfstat/mcmc_based_searches.py b/pyfstat/mcmc_based_searches.py index 4c0b7c4941953918466241ee760e2811c2bb0338..3b7a6d42254f9f389bbd3b5fb013f87c99e4bf71 100644 --- a/pyfstat/mcmc_based_searches.py +++ b/pyfstat/mcmc_based_searches.py @@ -1934,24 +1934,23 @@ class MCMCFollowUpSearch(MCMCSemiCoherentSearch): if args.no_template_counting: V_vals.append([1, 1, 1]) else: - V, Vsky, Vpe = get_V_estimate( + V = get_V_estimate( rs[1], self.tref, self.minStartTime, self.maxStartTime, DeltaOmega, DeltaFs, fiducial_freq, self.search.detector_names, self.earth_ephem, self.sun_ephem) - V_vals.append([V, Vsky, Vpe]) + V_vals.append(V) if log_table: logging.info('Using run-setup as follows:') - logging.info('Stage | nburn | nprod | nsegs | Tcoh d | resetp0 |' - ' V = Vsky x Vpe') + logging.info( + 'Stage | nburn | nprod | nsegs | Tcoh d | resetp0 | V') for i, rs in enumerate(run_setup): Tcoh = (self.maxStartTime - self.minStartTime) / rs[1] / 86400 if V_vals[i] is None: vtext = 'N/A' else: - vtext = '{:1.0e} = {:1.0e} x {:1.0e}'.format( - V_vals[i][0], V_vals[i][1], V_vals[i][2]) + vtext = '{:1.0e}'.format(V_vals[i]) logging.info('{} | {} | {} | {} | {} | {} | {}'.format( str(i).ljust(5), str(rs[0][0]).ljust(5), str(rs[0][1]).ljust(5), str(rs[1]).ljust(5), @@ -1960,54 +1959,28 @@ class MCMCFollowUpSearch(MCMCSemiCoherentSearch): if gen_tex_table: filename = '{}/{}_run_setup.tex'.format(self.outdir, self.label) - if DeltaOmega > 0: - with open(filename, 'w+') as f: - f.write(r'\begin{tabular}{c|cccccc}' + '\n') - f.write(r'Stage & $\Nseg$ & $\Tcoh^{\rm days}$ &' - r'$\Nsteps$ & $\V$ & $\Vsky$ & $\Vpe$ \\ \hline' - '\n') - for i, rs in enumerate(run_setup): - Tcoh = float( - self.maxStartTime - self.minStartTime)/rs[1]/86400 - line = r'{} & {} & {} & {} & {} & {} & {} \\' + '\n' - if V_vals[i][0] is None: - V = Vsky = Vpe = 'N/A' - else: - V, Vsky, Vpe = V_vals[i] - if rs[0][-1] == 0: - nsteps = rs[0][0] - else: - nsteps = '{},{}'.format(*rs[0]) - line = line.format(i, rs[1], '{:1.1f}'.format(Tcoh), - nsteps, - helper_functions.texify_float(V), - helper_functions.texify_float(Vsky), - helper_functions.texify_float(Vpe)) - f.write(line) - f.write(r'\end{tabular}' + '\n') - else: - with open(filename, 'w+') as f: - f.write(r'\begin{tabular}{c|cccc}' + '\n') - f.write(r'Stage & $\Nseg$ & $\Tcoh^{\rm days}$ &' - r'$\Nsteps$ & $\Vpe$ \\ \hline' - '\n') - for i, rs in enumerate(run_setup): - Tcoh = float( - self.maxStartTime - self.minStartTime)/rs[1]/86400 - line = r'{} & {} & {} & {} & {} \\' + '\n' - if V_vals[i] is None: - V = Vsky = Vpe = 'N/A' - else: - V, Vsky, Vpe = V_vals[i] - if rs[0][-1] == 0: - nsteps = rs[0][0] - else: - nsteps = '{},{}'.format(*rs[0]) - line = line.format(i, rs[1], '{:1.1f}'.format(Tcoh), - nsteps, - helper_functions.texify_float(Vpe)) - f.write(line) - f.write(r'\end{tabular}' + '\n') + with open(filename, 'w+') as f: + f.write(r'\begin{tabular}{c|cccc}' + '\n') + f.write(r'Stage & $\Nseg$ & $\Tcoh^{\rm days}$ &' + r'$\Nsteps$ & $\V$ \\ \hline' + '\n') + for i, rs in enumerate(run_setup): + Tcoh = float( + self.maxStartTime - self.minStartTime)/rs[1]/86400 + line = r'{} & {} & {} & {} & {} \\' + '\n' + if V_vals[i] is None: + V = 'N/A' + else: + V = V_vals[i] + if rs[0][-1] == 0: + nsteps = rs[0][0] + else: + nsteps = '{},{}'.format(*rs[0]) + line = line.format(i, rs[1], '{:1.1f}'.format(Tcoh), + nsteps, + helper_functions.texify_float(V)) + f.write(line) + f.write(r'\end{tabular}' + '\n') if args.setup_only: logging.info("Exit as requested by setup_only flag") diff --git a/pyfstat/optimal_setup_functions.py b/pyfstat/optimal_setup_functions.py index 1c98f0d29e35c8405dbfbbe9a66a70379acd2b0e..0108246a8ba1a4e9667911a2532c8f7178b0beaf 100644 --- a/pyfstat/optimal_setup_functions.py +++ b/pyfstat/optimal_setup_functions.py @@ -61,11 +61,11 @@ def get_nsegs_ip1( Vip1 = get_V_estimate( nsegs_ip1, tref, minStartTime, maxStartTime, DeltaOmega, DeltaFs, fiducial_freq, detector_names, earth_ephem, sun_ephem) - if Vip1[0] is None: + if Vip1 is None: return 1e6 else: log10Vip1 = np.log10(Vip1) - return np.abs(log10Vi[0] + log10R - log10Vip1[0]) + return np.abs(log10Vi + log10R - log10Vip1) res = scipy.optimize.minimize(f, .5*nsegs_i, method='Powell', tol=0.1, options={'maxiter': 10}) nsegs_ip1 = int(res.x) @@ -82,7 +82,7 @@ def get_nsegs_ip1( def get_V_estimate( nsegs, tref, minStartTime, maxStartTime, DeltaOmega, DeltaFs, fiducial_freq, detector_names, earth_ephem, sun_ephem): - """ Returns V, Vsky, Vpe estimated from the super-sky metric + """ Returns V estimated from the super-sky metric Parameters ---------- @@ -141,4 +141,4 @@ def get_V_estimate( Vsky = 1 if Vpe == 0: Vpe = 1 - return (Vsky * Vpe, Vsky, Vpe) + return Vsky * Vpe