コード例 #1
0
ファイル: survey.py プロジェクト: kmjc/PsrPopPy2
    def scint(self, psr, snr):
        """ Add scintillation effects and modify the pulsar's S/N"""

        # calculate the scintillation strength (commonly "u")
        # first, calculate scint BW, assume Kolmogorov, C=1.16
        if hasattr(psr, 't_scatter'):
            tscat = go.scale_bhat(psr.t_scatter, self.freq, psr.scindex)
        else:
            tscat = go.scatter_bhat(psr.dm, psr.scindex, self.freq)
        # convert to seconds
        tscat /= 1000.

        scint_bandwidth = 1.16 / 2.0 / math.pi / tscat  # BW in Hz
        scint_bandwidth /= 1.0E6  # convert to MHz (self.freq is in MHz)

        scint_strength = math.sqrt(self.freq / scint_bandwidth)

        if scint_strength < 1.0:
            # weak scintillation
            # modulation index
            u_term = math.pow(scint_strength, 1.666666)
            mod_indx = math.sqrt(u_term)

        else:
            # strong scintillation

            # m^2 = m_riss^2 + m_diss^2 + m_riss * m_diss
            # e.g. Lorimer and Kramer ~eq 4.44
            m_riss = math.pow(scint_strength, -0.33333)

            # lorimer & kramer eq 4.44
            kappa = 0.15  # taking this as avrg for now

            # calculate scintillation timescale
            scint_ts, scint_bw = go.ne2001_scint_time_bw(
                psr.dtrue, psr.gl, psr.gb, self.freq)

            # calc n_t and n_f
            if scint_ts is None:
                n_t = 1.
            else:
                n_t = self._calc_n_t(kappa, scint_ts)

            if scint_bw is None:
                n_f = 1.
            else:
                n_f = self._calc_n_f(kappa, scint_bw)

            # finally calc m_diss
            m_diss = 1. / math.sqrt(n_t * n_f)

            m_tot_sq = m_diss * m_diss + m_riss * m_riss + m_riss * m_diss

            # modulation index for strong scintillation
            mod_indx = math.sqrt(m_tot_sq)

        return self._modulate_flux_scint(snr, mod_indx)
コード例 #2
0
    def scint(self, psr, snr):
        """ Add scintillation effects and modify the pulsar's S/N"""

        # calculate the scintillation strength (commonly "u")
        # first, calculate scint BW, assume Kolmogorov, C=1.16
        if hasattr(psr, "t_scatter"):
            tscat = go.scale_bhat(psr.t_scatter, self.freq, psr.scindex)
        else:
            tscat = go.scatter_bhat(psr.dm, psr.scindex, self.freq)
        # convert to seconds
        tscat /= 1000.0

        scint_bandwidth = 1.16 / 2.0 / math.pi / tscat  # BW in Hz
        scint_bandwidth /= 1.0e6  # convert to MHz (self.freq is in MHz)

        scint_strength = math.sqrt(self.freq / scint_bandwidth)

        if scint_strength < 1.0:
            # weak scintillation
            # modulation index
            u_term = math.pow(scint_strength, 1.666666)
            mod_indx = math.sqrt(u_term)

        else:
            # strong scintillation

            # m^2 = m_riss^2 + m_diss^2 + m_riss * m_diss
            # e.g. Lorimer and Kramer ~eq 4.44
            m_riss = math.pow(scint_strength, -0.33333)

            # lorimer & kramer eq 4.44
            kappa = 0.15  # taking this as avrg for now

            # calculate scintillation timescale
            scint_ts, scint_bw = go.ne2001_scint_time_bw(psr.dtrue, psr.gl, psr.gb, self.freq)

            # calc n_t and n_f
            if scint_ts is None:
                n_t = 1.0
            else:
                n_t = self._calc_n_t(kappa, scint_ts)

            if scint_bw is None:
                n_f = 1.0
            else:
                n_f = self._calc_n_f(kappa, scint_bw)

            # finally calc m_diss
            m_diss = 1.0 / math.sqrt(n_t * n_f)

            m_tot_sq = m_diss * m_diss + m_riss * m_riss + m_riss * m_diss

            # modulation index for strong scintillation
            mod_indx = math.sqrt(m_tot_sq)

        return self._modulate_flux_scint(snr, mod_indx)