Ejemplo n.º 1
0
 def delta_energy(self) -> u.erg:
     energy = u.Quantity(
         np.where(self._elvlc['E_obs'].value == -1,
                  self._elvlc['E_th'].value, self._elvlc['E_obs'].value),
         self._elvlc['E_obs'].unit)
     indices = np.vstack([
         vectorize_where(self._elvlc['level'], self.lower_level),
         vectorize_where(self._elvlc['level'], self.upper_level)
     ])
     return np.diff(energy[indices], axis=0).flatten() * const.h * const.c
Ejemplo n.º 2
0
Archivo: ion.py Proyecto: eblur/fiasco
    def contribution_function(self, density: u.cm**(-3), **kwargs):
        """
        Contribution function :math:`G(n,T)` for all transitions

        The contribution function for ion :math:`k` of element :math:`X` for a
        particular transition :math:`ij` is given by,

        .. math::

           G_{ij} = \\frac{n_H}{n_e}\mathrm{Ab}(X)f_{X,k}N_jA_{ij}\Delta E_{ij}\\frac{1}{n_e},

        and has units erg :math:`\mathrm{cm}^{3}` :math:`\mathrm{s}^{-1}`. Note that the
        contribution function is often defined in differing ways by different authors. The
        contribution function is defined as above in [1]_.

        The corresponding wavelengths can be retrieved with,

        .. code-block:: python

           ion.transitions.wavelength[~ion.transitions.is_twophoton]

        Parameters
        ----------
        density : `~astropy.units.Quantity`
            Electron number density

        References
        ----------
        .. [1] Young, P. et al., 2016, J. Phys. B: At. Mol. Opt. Phys., `49, 7 <http://iopscience.iop.org/article/10.1088/0953-4075/49/7/074009/meta>`_
        """
        populations = self.level_populations(density, **kwargs)
        p2e = proton_electron_ratio(self.temperature, **self._dset_names)
        term = np.outer(p2e * self.ioneq,
                        1. / density.value) * self.abundance / density.unit
        # Exclude two-photon transitions
        upper_level = self.transitions.upper_level[~self.transitions.
                                                   is_twophoton]
        # CHIANTI records theoretical transitions with negative wavelengths
        wavelength = np.fabs(
            self.transitions.wavelength[~self.transitions.is_twophoton])
        A = self.transitions.A[~self.transitions.is_twophoton]
        energy = ((const.h * const.c) / wavelength).to(u.erg)
        i_upper = vectorize_where(self._elvlc['level'], upper_level)
        g = term[:, :, np.newaxis] * populations[:, :, i_upper] * (A * energy)
        return g
Ejemplo n.º 3
0
    def contribution_function(self, density: u.cm**(-3),
                              **kwargs) -> u.cm**3 * u.erg / u.s:
        r"""
        Contribution function :math:`G(n,T)` for all transitions.

        The contribution function for ion :math:`k` of element :math:`X` for a
        particular transition :math:`ij` is given by,

        .. math::

           G_{ij} = \frac{n_H}{n_e}\mathrm{Ab}(X)f_{X,k}N_jA_{ij}\Delta E_{ij}\frac{1}{n_e},

        Note that the contribution function is often defined in differing ways by different authors.
        The contribution function is defined as above in [young]_.

        The corresponding wavelengths can be retrieved with,

        .. code-block:: python

           ion.transitions.wavelength[~ion.transitions.is_twophoton]

        Parameters
        ----------
        density : `~astropy.units.Quantity`
            Electron number density

        References
        ----------
        .. [young] Young, P. et al., 2016, J. Phys. B: At. Mol. Opt. Phys., `49, 7 <http://iopscience.iop.org/article/10.1088/0953-4075/49/7/074009/meta>`_
        """
        populations = self.level_populations(density, **kwargs)
        term = np.outer(self.ioneq, 1. / density) * self.abundance * 0.83
        # Exclude two-photon transitions
        upper_level = self.transitions.upper_level[~self.transitions.
                                                   is_twophoton]
        wavelength = self.transitions.wavelength[~self.transitions.
                                                 is_twophoton]
        A = self.transitions.A[~self.transitions.is_twophoton]
        energy = const.h * const.c / wavelength
        i_upper = vectorize_where(self._elvlc['level'], upper_level)
        g = term[:, :, np.newaxis] * populations[:, :, i_upper] * (A * energy)
        return g