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
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
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