コード例 #1
0
observed = []
observednonoise = []
observedflux = []
scatt = []
#
#        plt.subplot(2,2,j+1)
##        plt.subplot(2,1,j+1)
#        plt.subplots_adjust(hspace=.2)
#
for i in range(0, len(taubins)):
    scat = psr.psrscatter(
        bins, psr.broadfunc(bins, taubins[i]), psr.pulsetrain(trainlength, bins, profile_intr_norm[i]), taubins[i]
    )
    scatt.append(scat)
    climb, observed_nonoise, flux = psr.extractpulse(scat, 2, P)
    peak = np.max(observed_nonoise)
    noise = np.random.normal(0, peak / snr, P)
    observedadd = observed_nonoise + noise
    observed.append(observedadd)
    observedflux.append(flux)
    observednonoise.append(observed_nonoise)
#        #    plt.plot(nurange,observedflux,linewidth=2.0,label=r'$\sigma_{x,y} = %d$ mas. $\tau_{max} = %.1f$' % (k1, tauval[0]))
##        plt.plot(1000*nurange,observedflux,linewidth=2.0,label=r'$D_s/D = %.1f$, $\tau_{max} = %.1f$' % (Dsval/Dval,tauval[0]))
#        plt.plot(1000*nurange,observedflux,linewidth=2.0,label=r'$D_s/D = %.1f$' % (Dsval/Dval))
#        plt.title('D = %.0f kpc' %Dval)
#        plt.legend(loc = 'best',fontsize=14)
##        plt.xlabel(r'$\nu$ (MHz)',fontsize=16)
#        plt.ylabel('normalized flux',fontsize=16)
#        plt.xticks(fontsize=14)
#        plt.yticks(fontsize=14)
コード例 #2
0
##Create observed pulses by scattering a pulsetrain with an exponential broadening function
  
        observed = []
        observednonoise = []
        observedflux = []
        scatt = []

        #   plt.subplot(2,2,j+1) 
        plt.subplot(2,1,j+1) 
        plt.subplots_adjust(hspace=.2)
    #            
        for i in range(0,len(taubins)):
            scat = psr.psrscatter(bins, psr.broadfunc(bins,taubins[i]),psr.pulsetrain(trainlength, bins, profile_intr_norm[i]),taubins[i])
            scatt.append(scat)
            climb, observed_nonoise, flux = psr.extractpulse(scat, 2, P)
            peak = np.max(observed_nonoise)
            noise = np.random.normal(0,peak/snr,P)
            observedadd = observed_nonoise + noise
            observed.append(observedadd)
            observedflux.append(flux)
            observednonoise.append(observed_nonoise)
    #            plt.plot(nurange,observedflux,linewidth=2.0,label=r'$\sigma_{x,y} = %d$ mas. $\tau_{max} = %.1f$' % (k1, tauval[0]))
    #            plt.plot(1000*nurange,observedflux,linewidth=2.0,label=r'$D_s/D = %.1f$, $\tau_{max} = %.1f$' % (Dsval/Dval,tauval[0]))    
        plt.plot(1000*nurange,observedflux,linewidth=2.0,label=r'$D_s/D = %.1f$' % (Dsval/Dval))
        plt.title('D = %.0f kpc' %Dval, fontsize=20)
        plt.legend(loc = 'best',fontsize=16)
#        plt.xlabel(r'$\nu$ (MHz)',fontsize=16)
        plt.ylabel('normalized flux',fontsize=20)
        plt.xticks(fontsize=18)
        plt.yticks(fontsize=18)