示例#1
0
    def Pag(self, EMeV, g11, m_neV, bfield='jansson12'):
        """
        Compute the photon-ALP conversion probability

        Parameters
        ----------
        EMeV: array-like 
            n-dim array with energies in MeV

        g11: float
            ALP coupling in 10^-11 GeV-1 

        m_neV: float
            ALP mass in neV

        {options}

        bfield: str
            identifier for Milky Way magnetic field. default: 'jansson12'

        Returns
        -------
        Array with averaged ALP flux in units of MeV-1 s-1
        """

        # calculate conversion probability
        m = ModuleList(ALP(m=m_neV, g=g11),
                       self._src,
                       pin=np.diag([0., 0., 1.]),
                       EGeV=EMeV / 1000.)
        m.add_propagation("GMF", 0, model=bfield)
        px, py, pa = m.run()
        return np.squeeze(px + py)
示例#2
0
    def propagation(self, EGeV, m=1., g=1., B0=10., seed=None, nsim=1):
        '''Runs the propagation in magnetic fields, copied from me-manu, NGC1257 example notebook.
        Returns: Probabilities of finding photon (transversal1, 2) and ALP.
        Currently not used. Rather use read_probs() to use pre-computed probabilities saving time and thus
        being able to run on standard BIRD-computation slots.
        '''

        alp = ALP(m, g)
        ngc1275 = Source(z=0.017559, ra='03h19m48.1s', dec='+41d30m42s')
        pin = np.diag((1., 1., 0.)) * 0.5
        lambda_max = 35.
        lambda_min = 0.7
        kL = 2. * np.pi / lambda_max
        kH = 2. * np.pi / lambda_min
        m = ModuleList(alp, ngc1275, pin=pin, EGeV=EGeV)
        print('m:'), m.alp.m
        print('g:'), m.alp.g
        print('B:'), B0
        m.add_propagation(
            "ICMGaussTurb",
            0,  # position of module counted from the source. 
            nsim=nsim,  # number of random B-field realizations
            B0=B0,  # rms of B field
            n0=39.,  # normalization of electron density
            n2=
            4.05,  # second normalization of electron density, see Churazov et al. 2003, Eq. 4
            r_abell=500.,  # extension of the cluster
            r_core=
            80.,  # electron density parameter, see Churazov et al. 2003, Eq. 4
            r_core2=
            280.,  # electron density parameter, see Churazov et al. 2003, Eq. 4
            beta=
            1.2,  # electron density parameter, see Churazov et al. 2003, Eq. 4
            beta2=
            0.58,  # electron density parameter, see Churazov et al. 2003, Eq. 4
            eta=0.5,  # scaling of B-field with electron denstiy
            kL=
            kL,  # maximum turbulence scale in kpc^-1, taken from A2199 cool-core cluster, see Vacca et al. 2012 
            kH=
            kH,  # minimum turbulence scale, taken from A2199 cool-core cluster, see Vacca et al. 2012
            q=-2.80,  # turbulence spectral index, taken from A2199 cool-core cluster, see Vacca et al. 2012
            seed=
            seed  # random seed for reproducability, set to None for random seed.
        )
        m.add_propagation(
            "EBL", 1, model='dominguez'
        )  # EBL attenuation comes second, after beam has left cluster
        m.add_propagation(
            "GMF", 2, model='jansson12',
            model_sum='ASS')  # finally, the beam enters the Milky Way Field
        px, py, pa = m.run()
        self.px = px
        self.py = py
        self.pa = pa
        self.p = px + py
示例#3
0
     eta=0.5,  # scaling of B-field with electron denstiy
     kL=
     kL,  # maximum turbulence scale in kpc^-1, taken from A2199 cool-core cluster, see Vacca et al. 2012 
     kH=
     kH,  # minimum turbulence scale, taken from A2199 cool-core cluster, see Vacca et al. 2012
     q=-2.80,  # turbulence spectral index, taken from A2199 cool-core cluster, see Vacca et al. 2012
     seed=
     seed  # random seed for reproducability, set to None for random seed.
 )
 m.add_propagation(
     "EBL", 1, model='dominguez'
 )  # EBL attenuation comes second, after beam has left cluster
 m.add_propagation(
     "GMF", 2, model='jansson12',
     model_sum='ASS')  # finally, the beam enters the Milky Way Field
 p_gamma_x, p_gamma_y, p_a = m.run()
 p_gamma_tot = p_gamma_x + p_gamma_y
 p_orig = p_gamma_tot.copy()
 # np.savetxt(f'/nfs/astrop/n1/kuhlmann/NGC_1275/ts_limit/grid_survival_prob/new_probs/part_{part}.dat', p_orig)
 del p_a
 del p_gamma_x
 del p_gamma_y
 del p_gamma_tot
 p_orig = p_orig.reshape((nsim, EGeV.shape[0], ppb))
 p_orig = np.average(p_orig, axis=-1)
 # print(p_orig.shape)
 # print(p_gamma_tot.shape)
 # for _sim in range(nsim):
 #     for _bin in range(nbins):
 #         # print(p_gamma_tot[_sim, _bin*ppb:(_bin+1)*ppb])
 #         p_gamma_av[_sim, _bin] = np.average(p_gamma_tot[_sim, _bin*ppb:(_bin+1)*ppb], axis=-1)
示例#4
0
    for t in tsn:
        src = Source(z = float(t['z']),
                    ra = float(t['ra']),
                    dec = float(t['dec']))
        mod = ModuleList(ALP(m=1.,g=args.gref), src, pin = pin, EGeV = EMeV / 1e3)
        mod.add_propagation("GMF",0, model = 'jansson12', model_sum = 'ASS')
        c['time'].append(ts)

        for i,m in enumerate(mneV):
            if not '{0:.3f}'.format(m) in c.keys():
                c['{0:.3f}'.format(m)] = []

            mod.alp.m = m

            px,py,pa = mod.run(multiprocess=2)

            # calculate photon flux in photons / MeV / s / cm^2:
            d = cosmo.luminosity_distance(t['z'])
            flux = f * (px[0] + py[0]) / 4. / np.pi / d.to('cm') ** 2.

            # integrate flux over energy to obtain light curve in photons / s / cm^2
            flux_int = simps(flux * EMeV, np.log(EMeV), axis = 1)
            c['{0:.3f}'.format(m)].append(flux_int)

        del mod

    result = Table(c)
    result.write('ALPSNSignal_Mprog{0:.0f}.fits'.format(asn.Mprog),
                overwrite = True)