diff --git a/bin/minifollowups/pycbc_page_coincinfo b/bin/minifollowups/pycbc_page_coincinfo index b2dc9e363b7..d95e980d798 100644 --- a/bin/minifollowups/pycbc_page_coincinfo +++ b/bin/minifollowups/pycbc_page_coincinfo @@ -248,6 +248,14 @@ for ifo in files.keys(): headers.append("s1z") headers.append("s2z") headers.append("Duration") +# display eccentricity and relative anomaly if they exist +try: + data[-1].append('%5.2f' % bank['eccentricity'][tid]) + data[-1].append('%5.2f' % bank['rel_anomaly'][tid]) + headers.append("eccentricity") + headers.append("rel_anomaly") +except: + pass html += str(pycbc.results.static_table( data, diff --git a/bin/minifollowups/pycbc_page_snglinfo b/bin/minifollowups/pycbc_page_snglinfo index 2ce04edbcc1..f7dad109f88 100644 --- a/bin/minifollowups/pycbc_page_snglinfo +++ b/bin/minifollowups/pycbc_page_snglinfo @@ -203,6 +203,14 @@ headers.append("Mc") headers.append("s1z") headers.append("s2z") headers.append("Duration") +# display eccentricity and relative anomaly if they exist +try: + data[0].append('%5.2f' % sngl_file.eccentricity[0]) + data[0].append('%5.2f' % sngl_file.rel_anomaly[0]) + headers.append("eccentricity") + headers.append("rel_anomaly") +except AttributeError: + pass if args.significance_file and not args.n_loudest: with hdf.HFile(args.significance_file, 'r') as sig_f: diff --git a/bin/minifollowups/pycbc_sngl_minifollowup b/bin/minifollowups/pycbc_sngl_minifollowup index ea65cfb97c7..eaec5646f87 100644 --- a/bin/minifollowups/pycbc_sngl_minifollowup +++ b/bin/minifollowups/pycbc_sngl_minifollowup @@ -281,6 +281,12 @@ for rank, num_event in enumerate(order): curr_params['f_lower'] = trigs.f_lower[num_event] curr_params[args.instrument + '_end_time'] = time curr_params['mean_time'] = time + # optional eccentric parameters, only present when using SEOBNRv4/5E + try: + curr_params['eccentricity'] = trigs.eccentricity[num_event] + curr_params['rel_anomaly'] = trigs.rel_anomaly[num_event] + except AttributeError: + pass # don't require precessing template info if not present try: curr_params['spin1x'] = trigs.spin1x[num_event] diff --git a/bin/plotting/pycbc_plot_waveform b/bin/plotting/pycbc_plot_waveform index ff6aed5d507..0d5be90001b 100644 --- a/bin/plotting/pycbc_plot_waveform +++ b/bin/plotting/pycbc_plot_waveform @@ -76,6 +76,11 @@ parser.add_argument("--u-val", type=float, default=0, "h(t) = h_+ * u_val + h_x. Only needed in the case of " "waveforms where h_+ and h_x are not related by a " "simple phase shift.") +# Optional arguments for eccentricity +parser.add_argument("--eccentricity", type=float, default=0, + help="Eccentricity of the orbit. ") +parser.add_argument("--rel-anomaly", type=float, default=0, + help="Relativistic anomaly. ") # Other optional arguments parser.add_argument("--taper-template", choices=["start","end","startend"], help="For time-domain approximants, taper the start and/or" @@ -105,7 +110,9 @@ tmp_params = io.WaveformArray.from_kwargs( spin2y=opt.spin2y, spin2z=opt.spin2z, inclination=opt.inclination, - coa_phase=opt.coa_phase) + coa_phase=opt.coa_phase, + eccentricity=opt.eccentricity, + rel_anomaly=opt.rel_anomaly) # Deal with parameter-dependent approximant string approximant = waveform.bank.parse_approximant_arg(opt.approximant, diff --git a/bin/pycbc_single_template b/bin/pycbc_single_template index 5aaff2787f4..52479435168 100755 --- a/bin/pycbc_single_template +++ b/bin/pycbc_single_template @@ -154,6 +154,11 @@ parser.add_argument("--u-val", type=float, default=None, help="The ratio between hplus and hcross to use in the " "template, according to h(t) = hplus * u_val + hcross. " "If not given only hplus is used.") +# Optional arguments for eccentric templates +parser.add_argument("--eccentricity", type=float, default=0, + help="The orbital eccentricity. Default = 0") +parser.add_argument("--rel-anomaly", type=float, default=0, + help="The relativistic anomaly. Default = 0") parser.add_argument("--window", type=float, help="Time to save on each side of the given trigger time") parser.add_argument("--order", type=int, @@ -228,7 +233,9 @@ if not opt.use_params_of_closest_injection: spin1z=opt.spin1z, spin2x=opt.spin2x, spin2y=opt.spin2y, - spin2z=opt.spin2z) + spin2z=opt.spin2z, + eccentricity=opt.eccentricity, + rel_anomaly=opt.rel_anomaly) with ctx: fft.from_cli(opt) diff --git a/pycbc/io/hdf.py b/pycbc/io/hdf.py index 15911d545c9..a48085c170f 100644 --- a/pycbc/io/hdf.py +++ b/pycbc/io/hdf.py @@ -842,6 +842,16 @@ def inclination(self): self.checkbank('inclination') return self.bank['inclination'][:][self.template_id] + @property + def eccentricity(self): + self.checkbank('eccentricity') + return self.bank['eccentricity'][:][self.template_id] + + @property + def rel_anomaly(self): + self.checkbank('rel_anomaly') + return self.bank['rel_anomaly'][:][self.template_id] + @property def f_lower(self): self.checkbank('f_lower') diff --git a/pycbc/workflow/minifollowups.py b/pycbc/workflow/minifollowups.py index b216ad70098..2f4f695a3e4 100644 --- a/pycbc/workflow/minifollowups.py +++ b/pycbc/workflow/minifollowups.py @@ -518,6 +518,10 @@ def make_single_template_files(workflow, segs, ifo, data_read_name, except: node.add_opt('--u-val', "%.6f" % params['u_vals_%s' % ifo]) + # If this is a eccentricity search + if 'eccentricity' in params: + node.add_opt('--eccentricity', "%.6f" % params['eccentricity']) + node.add_opt('--rel-anomaly', "%.6f" % params['rel_anomaly']) if params[ifo + '_end_time'] > 0 and not use_mean_time: trig_time = params[ifo + '_end_time'] @@ -687,6 +691,9 @@ def make_plot_waveform_plot(workflow, params, out_dir, ifos, exclude=None, node.add_opt('--spin2y',"%.6f" % params['spin2y']) node.add_opt('--inclination',"%.6f" % params['inclination']) node.add_opt('--u-val', "%.6f" % params['u_vals']) + if 'eccentricity' in params: + node.add_opt('--eccentricity', "%.6f" % params['eccentricity']) + node.add_opt('--rel-anomaly', "%.6f" % params['rel_anomaly']) node.new_output_file_opt(workflow.analysis_time, '.png', '--output-file') workflow += node