PyFstat
2.3.0

Contents:

  • PyFstat
  • PyFstat module documentation
  • Examples
    • Grid searches for isolated CW
    • MCMC searches for isolated CW signals
    • Comparison between MCMC and Grid searches
    • Multi-stage MCMC follow up
    • Binary-modulated CW searches
    • Glitch robust CW searches
    • Transient CW searches
      • Long transient search examples: Make data
      • Short transient search examples: Make data
      • Short transient grid search
      • Long transient MCMC search
      • Short transient MCMC search
    • Other examples
PyFstat
  • Examples
  • Transient CW searches
  • Short transient grid search
  • View page source

Note

Go to the end to download the full example code.

Short transient grid search

An example grid-based search for a short transient signal. By default, the standard persistent-CW 2F-statistic and the transient max2F statistic are compared.

You can turn on either BSGL = True or BtSG = True (not both!) to test alternative statistics.

This is also ready to use on a GPU, if you have one available and pycuda installed. Just change to tCWFstatMapVersion = “pycuda”.

17 import os
18
19 import numpy as np
20 import PyFstat_example_make_data_for_short_transient_search as data
21
22 import pyfstat
23
24 tCWFstatMapVersion = "lal"
25
26 if __name__ == "__main__":
27     label = "PyFstatExampleShortTransientGridSearch"
28     logger = pyfstat.set_up_logger(label=label, outdir=data.outdir)
29     if not os.path.isdir(data.outdir) or not np.any(
30         [f.endswith(".sft") for f in os.listdir(data.outdir)]
31     ):
32         raise RuntimeError(
33             "Please first run PyFstat_example_make_data_for_short_transient_search.py !"
34         )
35
36     maxStartTime = data.tstart + data.duration
37
38     m = 0.001
39     dF0 = np.sqrt(12 * m) / (np.pi * data.duration)
40     DeltaF0 = 100 * dF0
41     F0s = [data.F0 - DeltaF0 / 2.0, data.F0 + DeltaF0 / 2.0, dF0]
42     F1s = [data.F1]
43     F2s = [data.F2]
44     Alphas = [data.Alpha]
45     Deltas = [data.Delta]
46
47     BSGL = False
48     BtSG = False
49
50     logger.info("Standard CW search:")
51     search1 = pyfstat.GridSearch(
52         label=label + f"CW{'BSGL' if BSGL else ''}",
53         outdir=data.outdir,
54         sftfilepattern=os.path.join(data.outdir, f"*{data.label}*sft"),
55         F0s=F0s,
56         F1s=F1s,
57         F2s=F2s,
58         Alphas=Alphas,
59         Deltas=Deltas,
60         tref=data.tref,
61         BSGL=BSGL,
62     )
63     search1.run()
64     search1.print_max_twoF()
65     search1.plot_1D(
66         xkey="F0", xlabel="freq [Hz]", ylabel=search1.tex_labels[search1.detstat]
67     )
68
69     logger.info("with t0,tau bands:")
70     label = f"tCW{'_BSGL' if BSGL else ''}{'_BtSG' if BtSG else ''}_FstatMap_{tCWFstatMapVersion}"
71     search2 = pyfstat.TransientGridSearch(
72         label=label,
73         outdir=data.outdir,
74         sftfilepattern=os.path.join(data.outdir, f"*{data.label}*sft"),
75         F0s=F0s,
76         F1s=F1s,
77         F2s=F2s,
78         Alphas=Alphas,
79         Deltas=Deltas,
80         tref=data.tref,
81         transientWindowType="rect",
82         t0Band=data.duration - 2 * data.Tsft,
83         tauBand=data.duration,
84         outputTransientFstatMap=True,
85         tCWFstatMapVersion=tCWFstatMapVersion,
86         BSGL=BSGL,
87         BtSG=BtSG,
88     )
89     search2.run()
90     search2.print_max_twoF()
91     search2.plot_1D(
92         xkey="F0", xlabel="freq [Hz]", ylabel=search2.tex_labels[search2.detstat]
93     )

Download Jupyter notebook: PyFstat_example_short_transient_grid_search.ipynb

Download Python source code: PyFstat_example_short_transient_grid_search.py

Download zipped: PyFstat_example_short_transient_grid_search.zip

Gallery generated by Sphinx-Gallery

Previous Next

© Copyright 2020, Gregory Ashton, David Keitel, Reinhard Prix, Rodrigo Tenorio.

Built with Sphinx using a theme provided by Read the Docs.