Пример #1
0
            # sometimes we can get folds with no signal at all.  Skip these.

            if Num.std(prof)==0.0:
                sys.stderr.write("Skipping TOA %d for subband %d due to lack of signal\n"%(ii+1, jj+1))
                continue

            # Make sure that the template and the data have the same number of bins
            if (not len(template)==fold_pfd.proflen):
                if (not ((len(template)%fold_pfd.proflen)==0 or
                         (fold_pfd.proflen%len(template))==0)):
                    if not ii and not jj:
                        sys.stderr.write("WARNING!: Lengths of template (%d) and data (%d) are incompatible!  Skipping '%s'!\n" % (len(template), fold_pfd.proflen, fold_pfd.filenm))
                    continue
                # Interpolate the data
                if (len(template) > fold_pfd.proflen):
                    prof = psr_utils.linear_interpolate(prof, len(template)/fold_pfd.proflen)
                    if not ii and not jj:
                        sys.stderr.write("Note: Interpolating the data for '%s'\n"%fold_pfd.filenm)
                # Interpolate the template
                elif (1):
                    template = psr_utils.linear_interpolate(template, fold_pfd.proflen/len(template))
                    if not ii and not jj:
                        sys.stderr.write("Note: Interpolating the template for '%s'\n"%fold_pfd.filenm)
                # Downsample the data (Probably not a good idea)
                else:
                    prof = psr_utils.downsample(prof, fold_pfd.proflen/len(template))
                    if not ii and not jj:
                        sys.stderr.write("Note:  Downsampling the data for '%s'\n"%fold_pfd.filenm)

            try:
                # Try using FFTFIT first
Пример #2
0
                continue

            # Make sure that the template and the data have the same number of bins
            if (not len(template) == fold_pfd.proflen):
                if (not ((len(template) % fold_pfd.proflen) == 0 or
                         (fold_pfd.proflen % len(template)) == 0)):
                    if not ii and not jj:
                        sys.stderr.write(
                            "WARNING!: Lengths of template (%d) and data (%d) are incompatible!  Skipping '%s'!\n"
                            %
                            (len(template), fold_pfd.proflen, fold_pfd.filenm))
                    continue
                # Interpolate the data
                if (len(template) > fold_pfd.proflen):
                    prof = psr_utils.linear_interpolate(
                        prof,
                        len(template) / fold_pfd.proflen)
                    if not ii and not jj:
                        sys.stderr.write(
                            "Note: Interpolating the data for '%s'\n" %
                            fold_pfd.filenm)
                # Interpolate the template
                elif (1):
                    template = psr_utils.linear_interpolate(
                        template, fold_pfd.proflen / len(template))
                    if not ii and not jj:
                        sys.stderr.write(
                            "Note: Interpolating the template for '%s'\n" %
                            fold_pfd.filenm)
                # Downsample the data (Probably not a good idea)
                else: