def GxETrain(x,mu,sigma, A, tau):
    #This model convolves a pulsetrain of length 20 with a broadening function defined over several P's (lf*P)
    #It extracts one of the last convolved profiles, subtracts the climbed baseline and then adds noise to it
    bins, profile = psr.makeprofile(nbins = P, ncomps = 1, amps = A, means = mu, sigmas = sigma)
    binstau = np.linspace(1,P,P)  #Tested: having a longer exp here makes no difference
    scat = psr.psrscatter(psr.broadfunc(binstau,tau),psr.pulsetrain(3, bins, profile))   
    climb, observed_nonoise, rec, flux = psr.extractpulse(scat, 2, P)
    return observed_nonoise
コード例 #2
0
def GxETrain(x,mu,sigma, A, tau):
    #This model convolves a pulsetrain with a broadening function
    #It extracts one of the last convolved profiles, subtracts the climbed baseline and then adds noise to it
    bins, profile = psr.makeprofile(nbins = P, ncomps = 1, amps = A, means = mu, sigmas = sigma)
    binstau = np.linspace(1,P,P)
    scat = psr.psrscatter(psr.broadfunc(binstau,tau),psr.pulsetrain(3, bins, profile))   
#    plt.figure()
#    plt.plot(scat,'r')    
    climb, observed_nonoise, rec, flux = psr.extractpulse(scat, 2, P)
    return observed_nonoise
コード例 #3
0
def GxESingleFold(x,mu,sigma,A,tau,trainlength):
    #This model takes a single Guassian pulse with mean mu and sigma
    #Convolves it with a broadening function
    #It extracts one of the last convolved profiles subtracts the climbed baseline and then adds noise to it 
    observed_postfold = np.zeros(P)      
    bins, profile = psr.makeprofile(nbins = P, ncomps = 1, amps = A, means = mu, sigmas = sigma)
    binstau = np.linspace(1,trainlength*P,trainlength*P)
    scat = psr.psrscatterpostfold(psr.broadfunc(binstau,tau),psr.pulsetrain(1, bins, profile))
    climb, observed_nonoise, rec, flux = psr.extractpulse(scat, 0, trainlength*P)
    for i in range(trainlength*P):    
        observed_postfold[np.mod(i,P)] += observed_nonoise[i]         
        GxESingleFold = observed_postfold[x]-np.min(observed_postfold[0:P])
    return GxESingleFold     
コード例 #4
0
P = int(pulseperiod/binstimeres)


m = float(P/4)                      #Let the mean of the pulse be at a 1/4 overall bins
w50 = float((dutycycle/100)*P)      #FWHM
s = w50/(2*np.sqrt(2*np.log(2)))    #sigma calculated through the dutycycle
a = 1                               #amplitude. at some point this will be replaced by the intrinsic spectrum. 

trainlength = 20

## Intrinsic profile




bins, profile = psr.makeprofile(nbins = P, ncomps = 1, amps = a, means = m, sigmas = s)
xaxlong =  np.linspace(1,20*P,20*P)
#xaxlong =  np.linspace(1,100*P,100*P)

spectralindex = 1.6  #Input spectral index as a postivie number, for nu^-alpha
profile_intr = psr.profilespec(nurange,spectralindex,profile)
profile_intr_norm = profile_intr/np.sum(profile_intr[0])   #Normalised such that the max intrinsic flux = 1.0. That is the intrinsice pulse at the lowest frequency has flux = 1

###############################################################################
## ISOTROPIC
###############################################################################

## In the case of importing data/broadening functions these parameters will only play a roll in plotting the alpha = 4.0 spectrum to compare
## In the case where I simulate the data to fit here, these paramteres will dicatate the shape of the broadening function

Dval, Dsval = float(DD),float(Dss)