Esempio n. 1
0
                gaussianwidth = float(a)
            except ValueError:
                gaussfitfile = a
        if o in ("-t", "--template"):
            templatefilenm = a
        if o in ("-o", "--output"):
            outfilenm = a
        if o in ("-s", "--sefd"):
            SEFD = float(a)

    print("Creating a summed profile of length %d bins using DM = %f" %
          (numbins, DM))

    # Read the template profile or create an appropriate Gaussian
    if templatefilenm is not None:
        template = psr_utils.read_profile(templatefilenm)
        # Resample the template profile to have the correct number of bins (if required)
        if not len(template) == numbins:
            oldlen = len(template)
            template = sinc_interp.periodic_interp(template, numbins)[::oldlen]
    else:
        if gaussfitfile is not None:
            template = psr_utils.read_gaussfitfile(gaussfitfile, numbins)
        else:
            template = psr_utils.gaussian_profile(numbins, 0.0, gaussianwidth)
    # Normalize it
    template -= min(template)
    template /= max(template)
    # Rotate it so that it becomes a "true" template according to FFTFIT
    shift, eshift, snr, esnr, b, errb, ngood = measure_phase(
        template, template)
Esempio n. 2
0
        # later DM/timing correction. PBD 2011/11/03
        sumsubfreqs_hi = sumsubfreqs + \
                fold_pfd.subdeltafreq/2.0 - fold_pfd.chan_wid/2.0
        subdelays2 = psr_utils.delay_from_DM(fold_pfd.bestdm, sumsubfreqs) - \
                psr_utils.delay_from_DM(fold_pfd.bestdm, sumsubfreqs_hi)

    else:
        fold_pfd.subfreqs = Num.asarray([0.0])
        sumsubfreqs = Num.asarray([0.0])
        sumsubdelays = Num.asarray([0.0])
        subdelays2 = Num.asarray([0.0])
        sumsubdelays_phs = Num.asarray([0.0])

    # Read the template profile
    if templatefilenm is not None:
        template = psr_utils.read_profile(templatefilenm, normalize=1)
    else:
        if (gaussfitfile):
            template = psr_utils.read_gaussfitfile(gaussfitfile, fold_pfd.proflen)
        else:
            template = psr_utils.gaussian_profile(fold_pfd.proflen, 0.0, gaussianwidth)
        template = template / max(template)
    #from Pgplot import *
    #plotxy(template)
    #closeplot()
    # Determine the Telescope used
    if (not fold.topo):
        obs = '@'  # Solarsystem Barycenter
    else:
        try: 
            if t2format:
Esempio n. 3
0
    else:
        if sys.argv[1].endswith(".pfd"):
            print("Input is PFD")
            # Input is pfd file
            pfdfn = sys.argv[1]
            # Check for bestprof
            if not os.path.exists(pfdfn+".bestprof"):
                print("Creating bestprof file")
                # Create bestprof file with show_pfd
                devnull = open(os.devnull, 'w')
                subprocess.call(['show_pfd', '-noxwin', pfdfn], 
                                stdout=devnull)
                devnull.close()
            filenm = pfdfn+".bestprof"
        else:
            filenm = sys.argv[1]
        prof = read_profile(filenm, normalize=0)
        if len(sys.argv)>=3:
            noise_stdev = float(sys.argv[2])
        else:
            try:
                bprof = bestprof(sys.argv[1])
                noise_stdev = bprof.prof_std
            except:
                noise_stdev = 1.0
    fig = plt.figure()
    dataplot = fig.add_subplot(211)
    interactor = GaussianSelector(dataplot, prof, noise_stdev, filenm)
    plt.show()