示例#1
0
def add_gwb(psr,dist=1,ngw=1000,seed=None,flow=1e-8,fhigh=1e-5,gwAmp=1e-20,alpha=-0.66,logspacing=True):
    """Add a stochastic background from inspiraling binaries, using the tempo2
    code that underlies the GWbkgrd plugin.

    Here 'dist' is the pulsar distance [in kpc]; 'ngw' is the number of binaries,
    'seed' (a negative integer) reseeds the GWbkgrd pseudorandom-number-generator,
    'flow' and 'fhigh' [Hz] determine the background band, 'gwAmp' and 'alpha'
    determine its amplitude and exponent, and setting 'logspacing' to False
    will use linear spacing for the individual sources.

    It is also possible to create a background object with

    gwb = GWB(ngw,seed,flow,fhigh,gwAmp,alpha,logspacing)

    then call the method gwb.add_gwb(pulsar[i],dist) repeatedly to get a
    consistent background for multiple pulsars.

    Returns the GWB object
    """
    

    gwb = GWB(ngw,seed,flow,fhigh,gwAmp,alpha,logspacing)
    gwb.add_gwb(psr,dist)

    return gwb
示例#2
0
def add_dipole_gwb(psr,dist=1,ngw=1000,seed=None,flow=1e-8,fhigh=1e-5,gwAmp=1e-20, alpha=-0.66, \
        logspacing=True, dipoleamps=None, dipoledir=None, dipolemag=None):
        
    """Add a stochastic background from inspiraling binaries distributed
    according to a pure dipole distribution, using the tempo2
    code that underlies the GWdipolebkgrd plugin.

    The basic use is identical to that of 'add_gwb':
    Here 'dist' is the pulsar distance [in kpc]; 'ngw' is the number of binaries,
    'seed' (a negative integer) reseeds the GWbkgrd pseudorandom-number-generator,
    'flow' and 'fhigh' [Hz] determine the background band, 'gwAmp' and 'alpha'
    determine its amplitude and exponent, and setting 'logspacing' to False
    will use linear spacing for the individual sources.

    Additionally, the dipole component can be specified by using one of two
    methods:
    1) Specify the dipole direction as three dipole amplitudes, in the vector
    dipoleamps
    2) Specify the direction of the dipole as a magnitude dipolemag, and a vector
    dipoledir=[dipolephi, dipoletheta]

    It is also possible to create a background object with
    
    gwb = GWB(ngw,seed,flow,fhigh,gwAmp,alpha,logspacing)

    then call the method gwb.add_gwb(pulsar[i],dist) repeatedly to get a
    consistent background for multiple pulsars.
    
    Returns the GWB object
    """

    gwb = GWB(ngw,seed,flow,fhigh,gwAmp,alpha,logspacing,dipoleamps,dipoledir,dipolemag)
    gwb.add_gwb(psr,dist)
    
    return gwb
示例#3
0
    psr[ii].stoas[:] += (white_noise / day) * np.random.randn(psr[ii].nobs)


##############################################################################################################################
# Now adding back red noise and DM-variation noise (libstempo has the ST format DM amplitude)
##############################################################################################################################

for ii in range(len(psr)):
    LT.add_rednoise(psr[ii],Ared_ML[ii],gam_red_ML[ii],components=args.nmodes)
    LT.add_dm(psr[ii],Adm_ML[ii],gam_dm_ML[ii],args.nmodes)   

###############################################################
# Do we want to add in a GWB signal?
###############################################################

gwb = GWB(ngw=10000,flow=1e-11,fhigh=1e-5,gwAmp=args.gwamp,alpha=args.gwalpha)

psrDist = np.ones(len(psr))  # positions all pulsars at 1kpc as default

for ii in range(len(psr)):
    gwb.add_gwb(psr[ii],psrDist[ii])

###############################################################
# Finally, let's save all the resulting .par and .tim files
###############################################################

sim_dir = 'Sim1000305'  # ...only an example.
# id of the set of simulations (digit 1), the noise realization (digit 2 to 5),
# the injected GWB (digit 6 and 7). For example, Sim1000305 refers to the first
# set of simulation (code 1), the noise realisation 3 (code 0003) and the injection
# 5 (code 05), i.e. log10(GWBamp) = -14.8 .