Esempio n. 1
0
    def _compute_data(self, cand):
        """Create a FreqVsPhase object for the candidate.

            Input:
                cand: A ratings2.0 Candidate object.

            Output:
                fvph: The corresponding FreqVsPhase object.
        """
        pfd = cand.pfd
        if pfd.fold_pow == 1.0:
            bestp = pfd.bary_p1
            bestpd = pfd.bary_p2
            bestpdd = pfd.bary_p3
        else:
            bestp = pfd.topo_p1
            bestpd = pfd.topo_p2
            bestpdd = pfd.topo_p3
        pfd.adjust_period(bestp, bestpd, bestpdd)
        data = pfd.profs.sum(axis=0).squeeze()
        freqs = psr_utils.doppler(pfd.subfreqs, pfd.avgvoverc)
        fvph = dataproducts.FreqVsPhase(data, bestp, bestpd, bestpdd, \
                                        pfd.currdm, freqs, pfd.binspersec, \
                                        0.0, copy.deepcopy(pfd.subdelays_bins))

        return fvph
Esempio n. 2
0
    def _compute_data(self, cand):
        """Create a FreqVsPhase object for the candidate.

            Input:
                cand: A ratings2.0 Candidate object.

            Output:
                fvph: The corresponding FreqVsPhase object.
        """
        pfd = cand.get_from_cache('pfd')
        if pfd.fold_pow == 1.0:
            bestp = pfd.bary_p1
            bestpd = pfd.bary_p2
            bestpdd = pfd.bary_p3
        else:
            bestp = pfd.topo_p1
            bestpd = pfd.topo_p2
            bestpdd = pfd.topo_p3
        pfd.adjust_period(bestp, bestpd, bestpdd)
        data = pfd.profs.sum(axis=0).squeeze()
        freqs = psr_utils.doppler(pfd.subfreqs, pfd.avgvoverc)
        fvph = dataproducts.FreqVsPhase(data, bestp, bestpd, bestpdd, \
                                        pfd.currdm, freqs, pfd.binspersec, \
                                        0.0, copy.deepcopy(pfd.subdelays_bins))
                                        
        return fvph
Esempio n. 3
0
 def dedisperse(self, DM=None, interp=0, doppler=1):
     """
     dedisperse(DM=self.bestdm, interp=0, doppler=1):
         Rotate (internally) the profiles so that they are de-dispersed
             at a dispersion measure of DM.  Use FFT-based interpolation if
             'interp' is non-zero (NOTE: It is off by default!).
             Doppler shift subband frequencies if doppler is non-zero.
             (NOTE: It is *ON* by default. This default behaviour is
                     different with respect to PRESTO's prepfold.py)
     """
     if DM is None:
         DM = self.bestdm
     # Note:  Since TEMPO Doppler corrects observing frequencies, for
     #        TOAs, at least, we need to de-disperse using topocentric
     #        observing frequencies.
     if doppler:
         freqs = psr_utils.doppler(self.subfreqs, self.avgvoverc)
     else:
         freqs = self.subfreqs
     self.subdelays = psr_utils.delay_from_DM(DM, freqs)
     self.hifreqdelay = self.subdelays[-1]
     self.subdelays = self.subdelays - self.hifreqdelay
     delaybins = self.subdelays * self.binspersec - self.subdelays_bins
     if interp:
         new_subdelays_bins = delaybins
         for ii in range(self.npart):
             for jj in range(self.nsub):
                 tmp_prof = self.profs[ii, jj, :]
                 self.profs[ii, jj] = psr_utils.fft_rotate(
                     tmp_prof, delaybins[jj])
         # Note: Since the rotation process slightly changes the values of the
         # profs, we need to re-calculate the average profile value
         self.avgprof = (self.profs / self.proflen).sum()
     else:
         new_subdelays_bins = Num.floor(delaybins + 0.5)
         #print "DEBUG: in myprepfold.py -- DM, new_subdelays_bins:", DM, new_subdelays_bins
         for ii in range(self.nsub):
             rotbins = int(new_subdelays_bins[ii]) % self.proflen
             if rotbins:  # i.e. if not zero
                 subdata = self.profs[:, ii, :]
                 self.profs[:, ii] = Num.concatenate(
                     (subdata[:, rotbins:], subdata[:, :rotbins]), 1)
     self.subdelays_bins += new_subdelays_bins
     self.sumprof = self.profs.sum(0).sum(0)
     if Num.fabs((self.sumprof / self.proflen).sum() - self.avgprof) > 1.0:
         print "self.avgprof is not the correct value!"
     self.currdm = DM
Esempio n. 4
0
 def dedisperse(self, DM=None, interp=0, doppler=1):
     """
     dedisperse(DM=self.bestdm, interp=0, doppler=1):
         Rotate (internally) the profiles so that they are de-dispersed
             at a dispersion measure of DM.  Use FFT-based interpolation if
             'interp' is non-zero (NOTE: It is off by default!).
             Doppler shift subband frequencies if doppler is non-zero.
             (NOTE: It is *ON* by default. This default behaviour is
                     different with respect to PRESTO's prepfold.py)
     """
     if DM is None:
         DM = self.bestdm
     # Note:  Since TEMPO Doppler corrects observing frequencies, for
     #        TOAs, at least, we need to de-disperse using topocentric
     #        observing frequencies.
     if doppler:
         freqs = psr_utils.doppler(self.subfreqs, self.avgvoverc)
     else:
         freqs = self.subfreqs
     self.subdelays = psr_utils.delay_from_DM(DM, freqs)
     self.hifreqdelay = self.subdelays[-1]
     self.subdelays = self.subdelays-self.hifreqdelay
     delaybins = self.subdelays*self.binspersec - self.subdelays_bins
     if interp:
         new_subdelays_bins = delaybins
         for ii in range(self.npart):
             for jj in range(self.nsub):
                 tmp_prof = self.profs[ii,jj,:]
                 self.profs[ii,jj] = psr_utils.fft_rotate(tmp_prof, delaybins[jj])
         # Note: Since the rotation process slightly changes the values of the
         # profs, we need to re-calculate the average profile value
         self.avgprof = (self.profs/self.proflen).sum()
     else:
         new_subdelays_bins = Num.floor(delaybins+0.5)
         #print "DEBUG: in myprepfold.py -- DM, new_subdelays_bins:", DM, new_subdelays_bins
         for ii in range(self.nsub):
             rotbins = int(new_subdelays_bins[ii])%self.proflen
             if rotbins:  # i.e. if not zero
                 subdata = self.profs[:,ii,:]
                 self.profs[:,ii] = Num.concatenate((subdata[:,rotbins:],
                                                     subdata[:,:rotbins]), 1)
     self.subdelays_bins += new_subdelays_bins
     self.sumprof = self.profs.sum(0).sum(0)
     if Num.fabs((self.sumprof/self.proflen).sum() - self.avgprof) > 1.0:
         print "self.avgprof is not the correct value!"
     self.currdm = DM