Skip to content
Snippets Groups Projects
Select Git revision
  • 404b7fb2e4fd1539bdeb18b30101b085d401ccbb
  • master default
2 results

test_fsig.py

Blame
  • Forked from finesse / pykat
    Source project has a limited visibility.
    • Daniel Brown's avatar
      4d173029
      adding in fsig command (not parsing yet). See example test_fsig.py in bin... · 4d173029
      Daniel Brown authored
      adding in fsig command (not parsing yet). See example test_fsig.py in bin folder. Also made component variable an optional argument for xaxis and x2axis which will break previous scripts. Did this as when setting the parameter to tune, the Param object contains whatever component owns that parameter so no need to pass it twice. Also stops someone passing a parameter not for the component stated.
      4d173029
      History
      adding in fsig command (not parsing yet). See example test_fsig.py in bin...
      Daniel Brown authored
      adding in fsig command (not parsing yet). See example test_fsig.py in bin folder. Also made component variable an optional argument for xaxis and x2axis which will break previous scripts. Did this as when setting the parameter to tune, the Param object contains whatever component owns that parameter so no need to pass it twice. Also stops someone passing a parameter not for the component stated.
    fully_coherent_search_using_MCMC.py 1.80 KiB
    import pyfstat
    import numpy as np
    
    # Properties of the GW data
    sqrtSX = 1e-23
    tstart = 1000000000
    duration = 100*86400
    tend = tstart + duration
    
    # Properties of the signal
    F0 = 30.0
    F1 = -1e-10
    F2 = 0
    Alpha = np.radians(83.6292)
    Delta = np.radians(22.0144)
    tref = .5*(tstart+tend)
    
    depth = 10
    h0 = sqrtSX / depth
    label = 'fully_coherent_search_using_MCMC'
    outdir = 'data'
    
    data = pyfstat.Writer(
        label=label, outdir=outdir, tref=tref,
        tstart=tstart, F0=F0, F1=F1, F2=F2, duration=duration, Alpha=Alpha,
        Delta=Delta, h0=h0, sqrtSX=sqrtSX)
    data.make_data()
    
    # The predicted twoF, given by lalapps_predictFstat can be accessed by
    twoF = data.predict_fstat()
    print 'Predicted twoF value: {}\n'.format(twoF)
    
    DeltaF0 = 1e-7
    DeltaF1 = 1e-13
    VF0 = (np.pi * duration * DeltaF0)**2 / 3.0
    VF1 = (np.pi * duration**2 * DeltaF1)**2 * 4/45.
    print '\nV={:1.2e}, VF0={:1.2e}, VF1={:1.2e}\n'.format(VF0*VF1, VF0, VF1)
    
    theta_prior = {'F0': {'type': 'unif',
                          'lower': F0-DeltaF0/2.,
                          'upper': F0+DeltaF0/2.},
                   'F1': {'type': 'unif',
                          'lower': F1-DeltaF1/2.,
                          'upper': F1+DeltaF1/2.},
                   'F2': F2,
                   'Alpha': Alpha,
                   'Delta': Delta
                   }
    
    ntemps = 2
    log10beta_min = -0.5
    nwalkers = 100
    nsteps = [300, 300]
    
    mcmc = pyfstat.MCMCSearch(
        label=label, outdir=outdir,
        sftfilepattern='{}/*{}*sft'.format(outdir, label), theta_prior=theta_prior,
        tref=tref, minStartTime=tstart, maxStartTime=tend, nsteps=nsteps,
        nwalkers=nwalkers, ntemps=ntemps, log10beta_min=log10beta_min)
    mcmc.transform_dictionary = dict(
        F0=dict(subtractor=F0, symbol='$f-f^\mathrm{s}$'),
        F1=dict(subtractor=F1, symbol='$\dot{f}-\dot{f}^\mathrm{s}$'))
    mcmc.run()
    mcmc.plot_corner(add_prior=True)
    mcmc.print_summary()