Ejemplo n.º 1
0
def test_burgess_tully_one_array():
    x = np.linspace(0, 1, 10)
    y = x**1.6 + 10
    energy_ratio = np.ones((1, ) + x.shape)
    c = 1
    for scaling_type in range(1, 7):
        ups = burgess_tully_descale(x, y, energy_ratio, c, scaling_type)
        assert ups.shape == energy_ratio.shape
Ejemplo n.º 2
0
def test_burgess_tully_different_scaling_types():
    x = np.tile(np.linspace(0, 1, 10), (6, 1))
    y = x**1.6 + 10
    energy_ratio = np.ones(x.shape[:1] + (10, ))
    c = 1 * np.ones(x.shape[:1])
    scaling_type = np.arange(1, 7)
    ups = burgess_tully_descale(x, y, energy_ratio, c, scaling_type)
    assert ups.shape == energy_ratio.shape
Ejemplo n.º 3
0
def test_burgess_tully_staggered_array():
    x = np.array([np.linspace(0, 1, 5), np.linspace(0, 1, 9)], dtype=object)
    y = x**1.6 + 10
    energy_ratio = np.ones(x.shape[:1] + (10, ))
    c = 1 * np.ones(x.shape)
    for scaling_type in range(1, 7):
        st = scaling_type * np.ones(c.shape)
        ups = burgess_tully_descale(x, y, energy_ratio, c, st)
        assert ups.shape == energy_ratio.shape
Ejemplo n.º 4
0
def test_burgess_tully_2d_array():
    x = np.tile(np.linspace(0, 1, 10), (2, 1))
    y = x**1.6 + 10
    energy_ratio = np.ones(x.shape[:1] + (10, ))
    c = 1 * np.ones(x.shape[:1])
    for scaling_type in range(1, 7):
        st = scaling_type * np.ones(c.shape)
        ups = burgess_tully_descale(x, y, energy_ratio, c, st)
        assert ups.shape == energy_ratio.shape
Ejemplo n.º 5
0
Archivo: ion.py Proyecto: vlslv/fiasco
 def proton_collision_excitation_rate(self) -> u.cm**3 / u.s:
     """
     Collisional excitation rate coefficient for protons.
     """
     # Create scaled temperature--these are not stored in the file
     bt_t = [np.linspace(0, 1, ups.shape[0]) for ups in self._psplups['bt_rate']]
     # Get excitation rates directly from scaled data
     kBTE = np.outer(const.k_B * self.temperature, 1.0 / self._psplups['delta_energy'])
     ex_rate = burgess_tully_descale(bt_t,
                                     self._psplups['bt_rate'],
                                     kBTE.T,
                                     self._psplups['bt_c'],
                                     self._psplups['bt_type'])
     return u.Quantity(np.where(ex_rate > 0., ex_rate, 0.), u.cm**3/u.s).T
Ejemplo n.º 6
0
Archivo: ion.py Proyecto: vlslv/fiasco
    def effective_collision_strength(self) -> u.dimensionless_unscaled:
        r"""
        Maxwellian-averaged collision strength, typically denoted by :math:`\Upsilon`.

        See Also
        --------
        fiasco.util.burgess_tully_descale : Descale and interpolate :math:`\Upsilon`.
        """
        kBTE = np.outer(const.k_B * self.temperature, 1.0 / self._scups['delta_energy'])
        upsilon = burgess_tully_descale(self._scups['bt_t'],
                                        self._scups['bt_upsilon'],
                                        kBTE.T,
                                        self._scups['bt_c'],
                                        self._scups['bt_type'])
        upsilon = u.Quantity(np.where(upsilon > 0., upsilon, 0.))
        return upsilon.T
Ejemplo n.º 7
0
Archivo: ion.py Proyecto: vlslv/fiasco
    def excitation_autoionization_rate(self) -> u.cm**3 / u.s:
        """
        Calculate ionization rate due to excitation autoionization.
        """
        c = (const.h**2)/((2. * np.pi * const.m_e)**(1.5) * np.sqrt(const.k_B))
        kBTE = np.outer(const.k_B*self.temperature, 1.0/self._easplups['delta_energy'])
        # NOTE: Transpose here to make final dimensions compatible with multiplication with
        # temperature when computing rate
        kBTE = kBTE.T
        xs = [np.linspace(0, 1, ups.shape[0]) for ups in self._easplups['bt_upsilon']]
        upsilon = burgess_tully_descale(xs,
                                        self._easplups['bt_upsilon'].value,
                                        kBTE,
                                        self._easplups['bt_c'].value,
                                        self._easplups['bt_type'])
        # NOTE: The 1/omega multiplicity factor is already included in the scaled upsilon
        # values provided by CHIANTI
        rate = c * upsilon * np.exp(-1 / kBTE) / np.sqrt(self.temperature)

        return rate.sum(axis=0)