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
      • MCMC search on data presenting a glitch
      • Glitch examples: Make data
      • Glitch robust grid search
      • Glitch robust MCMC search
    • Transient CW searches
    • Other examples
PyFstat
  • Examples
  • Glitch robust CW searches
  • Glitch robust grid search
  • View page source

Note

Go to the end to download the full example code.

Glitch robust grid search

Grid search employing a signal hypothesis allowing for a glitch to be present in the data. The setup corresponds to a targeted search, and the simulated signal contains a single glitch.

 10 import os
 11 import time
 12
 13 import numpy as np
 14 from PyFstat_example_make_data_for_search_on_1_glitch import (
 15     F0,
 16     F1,
 17     F2,
 18     Alpha,
 19     Delta,
 20     delta_F0,
 21     dtglitch,
 22     duration,
 23     outdir,
 24     tref,
 25     tstart,
 26 )
 27
 28 import pyfstat
 29
 30 label = "PyFstatExampleGlitchRobustDirectedGridSearchOn1Glitch"
 31 logger = pyfstat.set_up_logger(label=label, outdir=outdir)
 32
 33 Nstar = 1000
 34 F0_width = np.sqrt(Nstar) * np.sqrt(12) / (np.pi * duration)
 35 F1_width = np.sqrt(Nstar) * np.sqrt(180) / (np.pi * duration**2)
 36 N = 20
 37 F0s = [F0 - F0_width / 2.0, F0 + F0_width / 2.0, F0_width / N]
 38 F1s = [F1 - F1_width / 2.0, F1 + F1_width / 2.0, F1_width / N]
 39 F2s = [F2]
 40 Alphas = [Alpha]
 41 Deltas = [Delta]
 42
 43 max_delta_F0 = 1e-5
 44 tglitchs = [tstart + 0.1 * duration, tstart + 0.9 * duration, 0.8 * float(duration) / N]
 45 delta_F0s = [0, max_delta_F0, max_delta_F0 / N]
 46 delta_F1s = [0]
 47
 48
 49 t1 = time.time()
 50 search = pyfstat.GridGlitchSearch(
 51     label,
 52     outdir,
 53     os.path.join(outdir, "*1glitch*sft"),
 54     F0s=F0s,
 55     F1s=F1s,
 56     F2s=F2s,
 57     Alphas=Alphas,
 58     Deltas=Deltas,
 59     tref=tref,
 60     minStartTime=tstart,
 61     maxStartTime=tstart + duration,
 62     tglitchs=tglitchs,
 63     delta_F0s=delta_F0s,
 64     delta_F1s=delta_F1s,
 65 )
 66 search.run()
 67 dT = time.time() - t1
 68
 69 F0_vals = np.unique(search.data["F0"]) - F0
 70 F1_vals = np.unique(search.data["F1"]) - F1
 71 delta_F0s_vals = np.unique(search.data["delta_F0"]) - delta_F0
 72 tglitch_vals = np.unique(search.data["tglitch"])
 73 tglitch_vals_days = (tglitch_vals - tstart) / 86400.0 - dtglitch / 86400.0
 74
 75 logger.info("Making gridcorner plot...")
 76 twoF = search.data["twoF"].reshape(
 77     (len(F0_vals), len(F1_vals), len(delta_F0s_vals), len(tglitch_vals))
 78 )
 79 xyz = [F0_vals * 1e6, F1_vals * 1e12, delta_F0s_vals * 1e6, tglitch_vals_days]
 80 labels = [
 81     "$f - f_\\mathrm{s}$\n[$\\mu$Hz]",
 82     "$\\dot{f} - \\dot{f}_\\mathrm{s}$\n[$p$Hz/s]",
 83     "$\\delta f-\\delta f_\\mathrm{s}$\n[$\\mu$Hz]",
 84     "$t^\\mathrm{g} - t^\\mathrm{g}_\\mathrm{s}$\n[d]",
 85     "$t^\\mathrm{g} - t^\\mathrm{g}_\\mathrm{s}$\n[d]",
 86     "$\\widehat{2\\mathcal{F}}$",
 87 ]
 88 fig, axes = pyfstat.gridcorner(
 89     twoF,
 90     xyz,
 91     projection="log_mean",
 92     labels=labels,
 93     showDvals=False,
 94     lines=[0, 0, 0, 0],
 95     label_offset=0.25,
 96     max_n_ticks=4,
 97 )
 98 fig.savefig("{}/{}_projection_matrix.png".format(outdir, label), bbox_inches="tight")
 99
100
101 logger.info(f"Prior widths = {F0_width}, {F1_width}")
102 logger.info(f"Actual run time = {dT} s")
103 logger.info(f"Actual number of grid points = {search.data.shape[0]}")

Download Jupyter notebook: PyFstat_example_glitch_robust_directed_grid_search_on_1_glitch.ipynb

Download Python source code: PyFstat_example_glitch_robust_directed_grid_search_on_1_glitch.py

Download zipped: PyFstat_example_glitch_robust_directed_grid_search_on_1_glitch.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.