Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 3
0
 def module(self):
     m = ModuleList(self.alp, self.source, pin=self.pin, EGeV=self.EGeV)
     m.add_propagation("ICMGaussTurb",
                       0,
                       nsim=self.nsim,
                       B0=self.B0,
                       n0=39.,
                       n2=4.05,
                       r_abell=500.,
                       r_core=80.,
                       r_core2=280.,
                       beta=1.2,
                       beta2=0.58,
                       eta=0.5,
                       kL=self.kL,
                       kH=self.kH,
                       q=self.q,
                       seed=self.seed)
     m.add_propagation("EBL", 1, model='dominguez')
     m.add_propagation("GMF", 2, model='jansson12', model_sum='ASS')
     return m
Exemplo n.º 4
0
try:
    print(f"making directory {outpath}")
    os.mkdir(outpath)
except FileExistsError:
    print(f"{outpath} already exists")
print(log_prob_space.shape)
EGeV_morebins = np.power(10., log_prob_space - 3.)
p_gamma_av = np.zeros((nsim, nbins))
'''Loop over parameters'''
# param_list = [input_num]
for i in param_list:  # i: index of parameter set g/m+
    # t_0 = time.process_time()
    g = grid[i, 0]
    m = grid[i, 1]
    alp = ALP(m, g)
    m = ModuleList(alp, ngc1275, pin=pin, EGeV=EGeV_morebins)
    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=
Exemplo n.º 5
0
    pin = np.diag((0.,0.,1.))

    # cosmology
    cosmo = FlatLambdaCDM(H0 = 70., Om0 = 0.3)

    # loop over the sntable and ALP masses
    c = OrderedDict() # columns for new table

    c['name'] = tsn['name'].data
    c['time'] = []

    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.