Cumulative coherent 2F

Compute the cumulative coherent F-statistic of a signal candidate.

  9 import os
 10
 11 import numpy as np
 12
 13 import pyfstat
 14 from pyfstat.helper_functions import get_predict_fstat_parameters_from_dict
 15
 16 label = "PyFstat_example_twoF_cumulative"
 17 outdir = os.path.join("PyFstat_example_data", label)
 18
 19 # Properties of the GW data
 20 gw_data = {
 21     "sqrtSX": 1e-23,
 22     "tstart": 1000000000,
 23     "duration": 100 * 86400,
 24     "detectors": "H1,L1",
 25     "Band": 4,
 26     "Tsft": 1800,
 27 }
 28
 29 # Properties of the signal
 30 depth = 100
 31 phase_parameters = {
 32     "F0": 30.0,
 33     "F1": -1e-10,
 34     "F2": 0,
 35     "Alpha": np.radians(83.6292),
 36     "Delta": np.radians(22.0144),
 37     "tref": gw_data["tstart"],
 38     "asini": 10,
 39     "period": 10 * 3600 * 24,
 40     "tp": gw_data["tstart"] + gw_data["duration"] / 2.0,
 41     "ecc": 0,
 42     "argp": 0,
 43 }
 44 amplitude_parameters = {
 45     "h0": gw_data["sqrtSX"] / depth,
 46     "cosi": 1,
 47     "phi": np.pi,
 48     "psi": np.pi / 8,
 49 }
 50
 51 PFS_input = get_predict_fstat_parameters_from_dict(
 52     {**phase_parameters, **amplitude_parameters}
 53 )
 54
 55 # Let me grab tref here, since it won't really be needed in phase_parameters
 56 tref = phase_parameters.pop("tref")
 57 data = pyfstat.BinaryModulatedWriter(
 58     label=label,
 59     outdir=outdir,
 60     tref=tref,
 61     **gw_data,
 62     **phase_parameters,
 63     **amplitude_parameters,
 64 )
 65 data.make_data()
 66
 67 # The predicted twoF, given by lalapps_predictFstat can be accessed by
 68 twoF = data.predict_fstat()
 69 print("Predicted twoF value: {}\n".format(twoF))
 70
 71 # Create a search object for each of the possible SFT combinations
 72 # (H1 only, L1 only, H1 + L1).
 73 ifo_constraints = ["L1", "H1", None]
 74 compute_fstat_per_ifo = [
 75     pyfstat.ComputeFstat(
 76         sftfilepattern=os.path.join(
 77             data.outdir,
 78             (f"{ifo_constraint[0]}*.sft" if ifo_constraint is not None else "*.sft"),
 79         ),
 80         tref=data.tref,
 81         binary=phase_parameters.get("asini", 0),
 82         minCoverFreq=-0.5,
 83         maxCoverFreq=-0.5,
 84     )
 85     for ifo_constraint in ifo_constraints
 86 ]
 87
 88 for ind, compute_f_stat in enumerate(compute_fstat_per_ifo):
 89     compute_f_stat.plot_twoF_cumulative(
 90         label=label + (f"_{ifo_constraints[ind]}" if ind < 2 else "_H1L1"),
 91         outdir=outdir,
 92         savefig=True,
 93         CFS_input=phase_parameters,
 94         PFS_input=PFS_input,
 95         custom_ax_kwargs={
 96             "title": "How does 2F accumulate over time?",
 97             "label": "Cumulative 2F"
 98             + (f" {ifo_constraints[ind]}" if ind < 2 else " H1 + L1"),
 99         },
100     )

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery