pyequib


Namepyequib JSON
Version 0.4.3 PyPI version JSON
download
home_pagehttps://equib.github.io/pyEQUIB/
Summarypyequib: Python Package for Plasma Diagnostics and Abundance Analysis
upload_time2023-12-22 19:22:54
maintainer
docs_urlNone
authorAshkbiz Danehkar
requires_python
licensehttp://www.gnu.org/licenses/gpl.html
keywords pyequib equib equilibrium emissivities plasma diagnostics abundance analysis astronomy physics astrophysics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            ======================
pyEQUIB Python Package
======================

.. image:: https://img.shields.io/pypi/v/pyequib.svg?style=flat
    :target: https://pypi.python.org/pypi/pyequib/
    :alt: PyPI Version
    
.. image:: https://app.travis-ci.com/equib/pyEQUIB.svg?branch=master
    :target: https://app.travis-ci.com/github/equib/pyEQUIB
    :alt: Build Status
    
.. image:: https://ci.appveyor.com/api/projects/status/b3gw6vgf8s0vu8nv?svg=true
    :target: https://ci.appveyor.com/project/danehkar/pyequib
    :alt: Build Status
    
.. image:: https://coveralls.io/repos/github/equib/pyEQUIB/badge.svg?branch=master
    :target: https://coveralls.io/github/equib/pyEQUIB?branch=master
    :alt: Coverage Status
    
.. image:: https://img.shields.io/badge/license-GPL-blue.svg
    :target: https://github.com/equib/pyEQUIB/blob/master/LICENSE
    :alt: GitHub license
    
.. image:: https://img.shields.io/conda/vn/conda-forge/pyequib.svg
    :target: https://anaconda.org/conda-forge/pyequib
    :alt: Anaconda Cloud
    
.. image:: https://readthedocs.org/projects/pyequib/badge/?version=latest
    :target: https://pyequib.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status
    
.. image:: https://img.shields.io/badge/python-2.7%2C%203.8-blue.svg
    :alt: Support Python versions 2.7 and 3.8
    
.. image:: https://img.shields.io/badge/DOI-10.5281/zenodo.4287575-blue.svg
    :target: https://doi.org/10.5281/zenodo.4287575
    :alt: Zenodo
    
.. image:: http://joss.theoj.org/papers/10.21105/joss.02798/status.svg
    :target: https://doi.org/10.21105/joss.02798
    :alt: JOSS

.. image:: https://mybinder.org/badge_logo.svg
 :target: https://mybinder.org/v2/gh/equib/pyEQUIB/HEAD?labpath=Notebooks.ipynb
 
Description
===========

The **pyEQUIB** library is a collection of `Python <https://www.python.org/>`_ programs developed to perform plasma diagnostics and abundance analysis using emission line fluxes measured in ionzed nebulae. It uses the `AtomNeb Python Package <https://github.com/atomneb/AtomNeb-py>`_ to read collision strengths and transition probabilities for collisionally excited lines (CEL), and recombination coefficients for recombination lines (RL). This Python package can be used to determine interstellar extinctions, electron temperatures, electron densities, and ionic abundances from the measured fluxes of emission lines. It mainly contains the follwing API functions written purely in Python: 

* **API functions for collisionally excited lines (CEL)** have been developed based on the algorithm of the FORTRAN program `EQUIB <https://github.com/equib/EQUIB>`_ originally written in FORTRAN by `Howarth & Adams (1981) <https://ui.adsabs.harvard.edu/abs/1981ucl..rept.....H/abstract>`_, extended and customized by other people (`R. Clegg, D. Ruffle, X.-W. Liu, C. Pritchet, B. Ercolano, & R. Wesson <https://ui.adsabs.harvard.edu/abs/2016ascl.soft03005H/abstract>`_). The program EQUIB calculates atomic level populations and line emissivities in statistical equilibrium in multi-level atoms for different physical conditions of the stratification layers where the chemical elements are ionized. Using the Python implementation of the program EQUIB, electron temperatures, electron densities, and ionic abundances are determined from the measured fluxes of collisionally excited lines.

* **API functions for recombination lines (RL)** have been developed based on the algorithm of the recombination scripts by X. W. Liu and Y. Zhang from `output_mod.f90 <https://github.com/mocassin/MOCASSIN-2.0/blob/master/source/output_mod.f90>`_ included in the FORTRAN program `MOCASSIN <https://github.com/mocassin/MOCASSIN-2.0>`_. These API functiosn are used to determine ionic abundances from recombination lines for some heavy element ions.
 
* **API functions for reddening and extinctions** have been developed according to the methods of the reddening law functions from `STSDAS IRAF Package <https://github.com/equib/iraf-redcorr>`_, which are used to obtain interstellar extinctions and deredden measured fluxes based on different reddening laws.


Installation
============

Dependent Python Packages
-------------------------

 This package requires the following packages:

    - `NumPy <https://numpy.org/>`_
    - `SciPy <https://scipy.org/scipylib/>`_
    - `AtomNeb <https://github.com/atomneb/AtomNeb-py/>`_
    
* To get this package with the AtomNeb FITS files, you can simply use ``git`` command as follows:

.. code-block::

        git clone --recursive https://github.com/equib/pyEQUIB

To install the last version, all you should need to do is

.. code-block::

    $ python setup.py install

To install the stable version, you can use the preferred installer program (pip):

.. code-block::

    $ pip install pyequib

or you can install it from the cross-platform package manager *conda*:

.. code-block::

    $ conda install -c conda-forge pyequib

How to Use
==========

The Documentation of the Python functions provides in detail in the *API Documentation* (`equib.github.io/pyEQUIB/doc <https://equib.github.io/pyEQUIB/doc>`_). 

See *Jupyter Notebooks*: `Notebooks.ipynb <https://github.com/equib/pyEQUIB/blob/master/Notebooks.ipynb>`_

Run *Jupyter Notebooks* on `Binder <https://mybinder.org/v2/gh/equib/pyEQUIB/HEAD?labpath=Notebooks.ipynb>`_:

.. image:: https://mybinder.org/badge_logo.svg
 :target: https://mybinder.org/v2/gh/equib/pyEQUIB/HEAD?labpath=Notebooks.ipynb
 
There are three main object units:

* **Collision Unit** has the API functions for plasma diagnostics and abundance analysis of collisionally excited lines. Here are some examples of using *Collision* Unit:

    - *Temperature*:

      .. code-block:: Python
    
        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_dir = os.path.join('atomic-data', 'chianti70')
        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')
        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')
        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')
        
        atom = 's'
        ion = 'ii'
        s_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)
        s_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)
        s_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)
        
        upper_levels='1,2,1,3/'
        lower_levels='1,5/'
        density = np.float64(2550)
        line_flux_ratio=np.float64(10.753)
        temperature = pyequib.calc_temperature(line_flux_ratio=line_flux_ratio, density=density, 
                               upper_levels=upper_levels, lower_levels=lower_levels, 
                               elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)
        print("Electron Temperature:", temperature)

      which gives::
    
        Electron Temperature:       7920.2865

    - *Density*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_dir = os.path.join('atomic-data', 'chianti70')
        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')
        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')
        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')
        
        atom = 's'
        ion = 'ii'
        s_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)
        s_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)
        s_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)
        
        upper_levels='1,2/'
        lower_levels='1,3/'
        temperature=np.float64(7000.0)#
        line_flux_ratio=np.float64(1.506)#
        density = pyequib.calc_density(line_flux_ratio=line_flux_ratio, temperature=temperature, 
                                       upper_levels=upper_levels, lower_levels=lower_levels, 
                                       elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)
        print("Electron Density:", density)

      which gives::
      
        Electron Density:       2312.6395

    - *Ionic Abundance*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_dir = os.path.join('atomic-data', 'chianti70')
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')
        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')
        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'h'
        ion = 'ii' # H I Rec
        hi_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        atom = 'o'
        ion = 'iii' # [O III]
        o_iii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5) # read Energy Levels (Ej)
        o_iii_omij = atomneb.read_omij(atom_omij_file, atom, ion) # read Collision Strengths (Omegaij)
        o_iii_aij = atomneb.read_aij(atom_aij_file, atom, ion) # read Transition Probabilities (Aij)

        levels5007='3,4/'
        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        iobs5007=np.float64(1200.0)
        abb5007 = pyequib.calc_abundance(temperature=temperature, density=density, 
                                         line_flux=iobs5007, atomic_levels=levels5007,
                                         elj_data=o_iii_elj, omij_data=o_iii_omij, aij_data=o_iii_aij, 
                                         h_i_aeff_data=hi_rc_data['aeff'][0])
        print('N(O^2+)/N(H+):', abb5007)

      which gives::
      
        N(O^2+)/N(H+):   0.00041256231 
        
    - *Emissivity*:
    
      .. code-block:: Python
    
        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_dir = os.path.join('atomic-data', 'chianti70')
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')
        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')
        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'h'
        ion = 'ii' # H I Rec
        hi_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        atom = 'o'
        ion = 'iii' # [O III]
        o_iii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5) # read Energy Levels (Ej)
        o_iii_omij = atomneb.read_omij(atom_omij_file, atom, ion) # read Collision Strengths (Omegaij)
        o_iii_aij = atomneb.read_aij(atom_aij_file, atom, ion) # read Transition Probabilities (Aij)
        
        levels5007='3,4/'
        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        iobs5007=np.float64(1200.0)
        emis = pyequib.calc_emissivity(temperature=temperature, density=density, atomic_levels=levels5007, 
                                       elj_data=o_iii_elj, omij_data=o_iii_omij, aij_data=o_iii_aij)
        print('Emissivity(O III 5007):', emis)

      which gives::
      
        Emissivity(O III 5007):   3.6041012e-21
        

    - *Atomic Level Population*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_dir = os.path.join('atomic-data', 'chianti70')
        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')
        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')
        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')
        
        atom = 's'
        ion = 'ii'
        s_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)
        s_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)
        s_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)
        
        density = np.float64(1000)
        temperature=np.float64(10000.0)#
        nlj = pyequib.calc_populations(temperature=temperature, density=density, 
                                       elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)
        print('Populations:', nlj)

      which prints::
      
        Populations: 0.96992832 0.0070036315 0.023062261 2.6593671e-06 3.1277019e-06

    - *Critical Density*:
    
      .. code-block:: Python
    
        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_dir = os.path.join('atomic-data', 'chianti70')
        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')
        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')
        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')
        
        atom = 's'
        ion = 'ii'
        s_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)
        s_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)
        s_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)
        
        temperature=np.float64(10000.0)
        n_crit = pyequib.calc_crit_density(temperature=temperature, 
                                           elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)
        print('Critical Densities:', n_crit)

      which gives::
      
        Critical Densities: 0.0000000 5007.8396 1732.8414 1072685.0 2220758.1

    - *All Ionic Level Information*:
    
      .. code-block:: Python
    
        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_dir = os.path.join('atomic-data', 'chianti70')
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')
        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')
        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'h'
        ion = 'ii' # H I Rec
        hi_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        atom = 'o'
        ion = 'iii' # [O III]
        o_iii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5) # read Energy Levels (Ej)
        o_iii_omij = atomneb.read_omij(atom_omij_file, atom, ion) # read Collision Strengths (Omegaij)
        o_iii_aij = atomneb.read_aij(atom_aij_file, atom, ion) # read Transition Probabilities (Aij)
        
        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        pyequib.print_ionic(temperature=temperature, density=density,
                    elj_data=o_iii_elj, omij_data=o_iii_omij, aij_data=o_iii_aij,
                    h_i_aeff_data=hi_rc_data['aeff'][0])

      which gives::
      
        Temperature =   10000.0 K
        Density =    1000.0 cm-3
        
        Level    Populations   Critical Densities 
        Level 1:   3.063E-01   0.000E+00
        Level 2:   4.896E-01   4.908E+02
        Level 3:   2.041E-01   3.419E+03
        Level 4:   4.427E-05   6.853E+05
        Level 5:   2.985E-09   2.547E+07
          
         2.597E-05  
             88.34um 
             (2-->1) 
         2.859E-22  
        
         0.000E+00   9.632E-05  
             32.66um      51.81um 
             (3-->1)     (3-->2) 
         0.000E+00   7.536E-22  
        
         2.322E-06   6.791E-03   2.046E-02  
           4932.60A    4960.29A    5008.24A 
            (4-->1)     (4-->2)     (4-->3) 
         4.140E-25   1.204E-21   3.593E-21  
        
         0.000E+00   2.255E-01   6.998E-04   1.685E+00  
           2315.58A    2321.67A    2332.12A    4364.45A 
            (5-->1)     (5-->2)     (5-->3)     (5-->4) 
         0.000E+00   5.759E-24   1.779E-26   2.289E-23  
        
        H-beta emissivity: 1.237E-25 N(H+) Ne  [erg/s]


* **Recombination Unit** has the API functions for plasma diagnostics and abundance analysis of recombination lines. Here are some examples of using *Recombination* Unit:

    - *He+ Ionic Abundance*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_he_i_file = os.path.join(base_dir,data_rc_dir, 'rc_he_ii_PFSD12.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'h'
        ion = 'ii' # H I
        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        atom = 'he'
        ion = 'ii' # He I
        he_i_rc_data = atomneb.read_aeff_he_i_pfsd12(atom_rc_he_i_file, atom, ion)
        
        h_i_aeff_data = h_i_rc_data['aeff'][0]
        he_i_aeff_data = he_i_rc_data['aeff'][0]
        
        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        he_i_4471_flux= 2.104
        linenum=10# 4471.50
        abund_he_i = pyequib.calc_abund_he_i_rl(temperature=temperature, density=density,
                                        linenum=linenum, line_flux=he_i_4471_flux,
                                        he_i_aeff_data=he_i_aeff_data, h_i_aeff_data=h_i_aeff_data)
        print('N(He^+)/N(H^+):', abund_he_i)

      which gives::
      
        N(He^+)/N(H^+):     0.040848393

    - *He++ Ionic Abundance*:

      .. code-block:: Python
      
        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'h'
        ion = 'ii' # H I
        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        atom = 'he'
        ion = 'iii' # He II
        he_ii_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        h_i_aeff_data = h_i_rc_data['aeff'][0]
        he_ii_aeff_data = he_ii_rc_data['aeff'][0]
        
        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        he_ii_4686_flux = 135.833
        abund_he_ii = pyequib.calc_abund_he_ii_rl(temperature=temperature, density=density,
                                          line_flux=he_ii_4686_flux,
                                          he_ii_aeff_data=he_ii_aeff_data, h_i_aeff_data=h_i_aeff_data)
        print('N(He^2+)/N(H^+):', abund_he_ii)

      which gives::
      
        N(He^2+)/N(H^+):      0.11228817

    - *C++ Ionic Abundance*:
    
      .. code-block:: Python
    
        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'c'
        ion = 'iii' # C II
        c_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)
        
        atom = 'h'
        ion = 'ii' # H I
        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)

        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        wavelength=6151.43
        c_ii_6151_flux = 0.028
        abund_c_ii = pyequib.calc_abund_c_ii_rl(temperature=temperature, density=density,
                                        wavelength=wavelength, line_flux=c_ii_6151_flux,
                                        c_ii_rc_data=c_ii_rc_data, h_i_aeff_data=h_i_aeff_data)
        print('N(C^2+)/N(H+):', abund_c_ii)

      which gives::
      
        N(C^2+)/N(H+):   0.00063404650 
      
    - *C3+ Ionic Abundance*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'c'
        ion = 'iv' # C III
        c_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)
        
        atom = 'h'
        ion = 'ii' # H I
        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        wavelength=4647.42
        c_iii_4647_flux = 0.107
        abund_c_iii = pyequib.calc_abund_c_iii_rl(temperature=temperature, density=density,
                                          wavelength=wavelength,
                                          line_flux=c_iii_4647_flux, c_iii_rc_data=c_iii_rc_data,
                                          h_i_aeff_data=h_i_aeff_data)
        print('N(C^3+)/N(H+):', abund_c_iii)

      which gives::
      
        N(C^3+)/N(H+):   0.00017502840

    - *N++ Ionic Abundance*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'n'
        ion = 'iii' # N II
        n_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)
        n_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)
        
        atom = 'h'
        ion = 'ii' # H I
        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        wavelength=4442.02
        n_ii_4442_flux = 0.017
        abund_n_ii = pyequib.calc_abund_n_ii_rl(temperature=temperature, density=density,
                                        wavelength=wavelength, line_flux=n_ii_4442_flux,
                                        n_ii_rc_br=n_ii_rc_data_br, n_ii_rc_data=n_ii_rc_data,
                                        h_i_aeff_data=h_i_aeff_data)
        print('N(N^2+)/N(H+):', abund_n_ii)

      which gives::
      
        N(N^2+)/N(H+):   0.00069297541

    - *N3+ Ionic Abundance*:
    
      .. code-block:: Python
    
        import pyequib
        import atomneb
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'n'
        ion = 'iv' # N III
        n_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)
           
        atom = 'h'
        ion = 'ii' # H I
        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        wavelength=4640.64
        n_iii_4641_flux = 0.245
        abund_n_iii = pyequib.calc_abund_n_iii_rl(temperature=temperature, density=density,
                                          wavelength=wavelength, line_flux=n_iii_4641_flux,
                                          n_iii_rc_data=n_iii_rc_data, h_i_aeff_data=h_i_aeff_data)
        print('N(N^3+)/N(H+):', abund_n_iii)

      which gives::
      
        N(N^3+)/N(H+):   6.3366175e-05

    - *O++ Ionic Abundance*:
    
      .. code-block:: Python
      
        import pyequib
        import atomneb
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'o'
        ion = 'iii' # O II
        o_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)
        o_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)
                   
        atom = 'h'
        ion = 'ii' # H I
        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        wavelength=4613.68
        o_ii_4614_flux = 0.009
        abund_o_ii = pyequib.calc_abund_o_ii_rl(temperature=temperature, density=density,
                                        wavelength=wavelength, line_flux=o_ii_4614_flux,
                                        o_ii_rc_br=o_ii_rc_data_br,
                                        o_ii_rc_data=o_ii_rc_data,
                                        h_i_aeff_data=h_i_aeff_data)              
        print('N(O^2+)/N(H+):', abund_o_ii)
        
      which gives::
      
        N(O^2+)/N(H+):    0.0018886330

    - *Ne++ Ionic Abundance*:
    
      .. code-block:: Python
      
        import pyequib
        import atomneb
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
        
        atom = 'ne'
        ion = 'iii' # Ne II
        ne_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)
                   
        atom = 'h'
        ion = 'ii' # H I
        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)
        
        wavelength=3777.14
        ne_ii_3777_flux = 0.056
        abund_ne_ii = pyequib.calc_abund_ne_ii_rl(temperature=temperature, density=density,
                                          wavelength=wavelength, line_flux=ne_ii_3777_flux,
                                          ne_ii_rc_data=ne_ii_rc_data, h_i_aeff_data=h_i_aeff_data)
        print('N(Ne^2+)/N(H+):', abund_ne_ii)

      which gives::
      
        N(Ne^2+)/N(H+):   0.00043376850


    - *He I Emissivity*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_he_i_file = os.path.join(base_dir,data_rc_dir, 'rc_he_ii_PFSD12.fits')
        
        atom = 'he'
        ion = 'ii' # He I
        he_i_rc_data = atomneb.read_aeff_he_i_pfsd12(atom_rc_he_i_file, atom, ion)
        
        he_i_aeff_data = he_i_rc_data['aeff'][0]
        
        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        linenum=10# 4471.50
        emiss_he_i = pyequib.calc_emiss_he_i_rl(temperature=temperature, density=density,
                                        linenum=linenum, he_i_aeff_data=he_i_aeff_data)
        print('He I Emissivity:', emiss_he_i)

      which gives::
      
        He I Emissivity:   6.3822830e-26

    - *He II Emissivity*:
    
      .. code-block:: Python
    
        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')
         
        atom = 'he'
        ion = 'iii' # He II
        he_ii_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)

        he_ii_aeff_data = he_ii_rc_data['aeff'][0]

        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        emiss_he_ii = pyequib.calc_emiss_he_ii_rl(temperature=temperature, density=density,
                                          he_ii_aeff_data=he_ii_aeff_data)
        print('He II Emissivity:', emiss_he_ii)

      which gives::
      
        He II Emissivity:   1.4989134e-24

    - *C II Emissivity*:
    
      .. code-block:: Python
    
        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')
        
        atom = 'c'
        ion = 'iii' # C II
        c_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)
        
        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        wavelength=6151.43
        emiss_c_ii = pyequib.calc_emiss_c_ii_rl(temperature=temperature, density=density,
                                        wavelength=wavelength, c_ii_rc_data=c_ii_rc_data)
        print('C II Emissivity:', emiss_c_ii)

      which gives::
      
        C II Emissivity:   5.4719511e-26
      
    - *C III Emissivity*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import numpy as np
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')
        
        atom = 'c'
        ion = 'iv' # C III
        c_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)
        
        temperature=np.float64(10000.0)
        density=np.float64(5000.0)
        wavelength=4647.42
        emiss_c_iii = pyequib.calc_emiss_c_iii_rl(temperature=temperature, density=density,
                                          wavelength=wavelength,
                                          c_iii_rc_data=c_iii_rc_data)
        print('C III Emissivity:', emiss_c_iii)

      which gives::
      
        C III Emissivity:   7.5749632e-25

    - *N II Emissivity*:
    
      .. code-block:: Python
    
        import pyequib
        import atomneb
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')
        
        atom = 'n'
        ion = 'iii' # N II
        n_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)
        n_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)
        
        wavelength=4442.02
        emiss_n_ii = pyequib.calc_emiss_n_ii_rl(temperature=temperature, density=density,
                                        wavelength=wavelength,
                                        n_ii_rc_br=n_ii_rc_data_br, n_ii_rc_data=n_ii_rc_data)
        print('N II Emissivity:', emiss_n_ii)

      which gives::
      
        N II Emissivity:   3.0397397e-26

    - *N III Emissivity*:
    
      .. code-block:: Python
    
        import pyequib
        import atomneb
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')
        
        atom = 'n'
        ion = 'iv' # N III
        n_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)
        
        wavelength=4640.64
        emiss_n_iii = pyequib.calc_emiss_n_iii_rl(temperature=temperature, density=density,
                                          wavelength=wavelength, n_iii_rc_data=n_iii_rc_data)
        print('N III Emissivity:', emiss_n_iii)

      which gives::
      
        N III Emissivity:   4.7908644e-24

    - *O II Emissivity*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')
        
        atom = 'o'
        ion = 'iii' # O II
        o_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)
        o_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)
        
        wavelength=4613.68
        emiss_o_ii = pyequib.calc_emiss_o_ii_rl(temperature=temperature, density=density,
                                        wavelength=wavelength,
                                        o_ii_rc_br=o_ii_rc_data_br, o_ii_rc_data=o_ii_rc_data)
        print('O II Emissivity:', emiss_o_ii)
        
      which gives::
      
        O II Emissivity:   5.9047319e-27

    - *Ne II Emissivity*:
    
      .. code-block:: Python

        import pyequib
        import atomneb
        import os
        base_dir = 'externals/atomneb'
        data_rc_dir = os.path.join('atomic-data-rc')
        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')
        
        atom = 'ne'
        ion = 'iii' # Ne II
        ne_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)
        
        wavelength=3777.14
        emiss_ne_ii = pyequib.calc_emiss_ne_ii_rl(temperature=temperature, density=density,
                                          wavelength=wavelength, ne_ii_rc_data=ne_ii_rc_data)
        print('Ne II Emissivity:', emiss_ne_ii)

      which gives::
      
        Ne II Emissivity:   1.5996881e-25
        
* **Reddening Unit** has the API functions for estimating logarithmic extinctions at H-beta and dereddening observed fluxes based on reddening laws and extinctions. Here are some examples of using *Reddening* Unit:

    - *Reddening Law Function*:
    
      .. code-block:: Python

        import pyequib
        wavelength=6563.0
        r_v=3.1
        fl=pyequib.redlaw(wavelength, rv=r_v, ext_law='GAL')
        print('fl(6563):', fl)

      which gives::
      
        fl(6563):     -0.32013816

    - *Galactic Reddening Law Function based on Seaton (1979), Howarth (1983), & CCM (1983)*:
    
      .. code-block:: Python
      
        import pyequib
        wavelength=6563.0
        r_v=3.1
        fl=pyequib.redlaw_gal(wavelength, rv=r_v)
        print('fl(6563):', fl)

      which gives::
      
        fl(6563):     -0.32013816

    - *Galactic Reddening Law Function based on Savage & Mathis (1979)*:
    
      .. code-block:: Python

        import pyequib
        wavelength=6563.0
        fl=pyequib.redlaw_gal2(wavelength)
        print('fl(6563):', fl)

      which gives::
      
        fl(6563):     -0.30925984

    - *Reddening Law Function based on Cardelli, Clayton & Mathis (1989)*:
    
      .. code-block:: Python
    
        import pyequib
        wavelength=6563.0
        r_v=3.1
        fl=pyequib.redlaw_ccm(wavelength, rv=r_v)
        print('fl(6563):', fl)

      which gives::
      
        fl(6563):     -0.29756615

    - *Galactic Reddening Law Function based on Whitford (1958), Seaton (1977), & Kaler(1976)*:
    
      .. code-block:: Python
    
        import pyequib
        wavelength=6563.0
        fl=pyequib.redlaw_jbk(wavelength)
        print('fl(6563):', fl)

      which gives::
      
        fl(6563):     -0.33113684

    - *Reddening Law Function based on Fitzpatrick & Massa (1990), Fitzpatrick (1999), Misselt (1999)*:
    
      .. code-block:: Python
    
        import pyequib
        wavelength=6563.0
        r_v=3.1
        fmlaw='AVGLMC'
        fl=pyequib.redlaw_fm(wavelength, fmlaw=fmlaw, rv=r_v)
        print('fl(6563):', fl)

      which gives::
      
        fl(6563):     -0.35053032

    - *Reddening Law Function for the Small Magellanic Cloud*:
    
      .. code-block:: Python
    
        import pyequib
        wavelength=6563.0
        fl=pyequib.redlaw_smc(wavelength)
        print('fl(6563):', fl)

      which gives::
      
        fl(6563):     -0.22659261

    - *Reddening Law Function for the Large Magellanic Cloud*:
    
      .. code-block:: Python
    
        import pyequib
        wavelength=6563.0
        fl=pyequib.redlaw_lmc(wavelength)
        print('fl(6563):', fl)

      which gives::
      
        fl(6563):     -0.30871187

    - *Dereddening Relative Flux*:
    
      .. code-block:: Python

        import pyequib
        wavelength=6563.0
        m_ext=1.0
        flux=1.0
        ext_law='GAL'
        r_v=3.1
        flux_deredden=pyequib.deredden_relflux(wavelength, flux, m_ext, ext_law=ext_law, rv=r_v)
        print('dereddened flux(6563)', flux_deredden)

      which gives::
      
        dereddened flux(6563)       0.47847785

    - *Dereddening Absolute Flux*:
    
      .. code-block:: Python

        import pyequib
        wavelength=6563.0
        m_ext=1.0
        flux=1.0
        ext_law='GAL'
        r_v=3.1
        flux_deredden=pyequib.deredden_flux(wavelength, flux, m_ext, ext_law=ext_law, rv=r_v)
        print('dereddened flux(6563)', flux_deredden)

      which gives::
      
        dereddened flux(6563)      4.7847785

Documentation
=============

For more information on how to use the API functions from the pyEQUIB libray, please read the `API Documentation  <https://equib.github.io/pyEQUIB/doc>`_ published on `equib.github.io/pyEQUIB <https://equib.github.io/pyEQUIB>`_.


References
==========
* Danehkar, A. (2020). pyEQUIB Python Package, an addendum to proEQUIB: IDL Library for Plasma Diagnostics and Abundance Analysis. *J. Open Source Softw.*, **5**, 2798. doi:`10.21105/joss.02798 <https://doi.org/10.21105/joss.02798>`_ ads:`2020JOSS....5.2798D <https://ui.adsabs.harvard.edu/abs/2020JOSS....5.2798D/abstract>`_.

* Danehkar, A. (2018). proEQUIB: IDL Library for Plasma Diagnostics and Abundance Analysis. *J. Open Source Softw.*, **3**, 899. doi:`10.21105/joss.00899 <https://doi.org/10.21105/joss.00899>`_ ads:`2018JOSS....3..899D <https://ui.adsabs.harvard.edu/abs/2018JOSS....3..899D/abstract>`_.

* Danehkar, A. (2018). Bi-Abundance Ionisation Structure of the Wolf-Rayet Planetary Nebula PB 8, *PASA*, **35**, e005.  doi:`10.1017/pasa.2018.1 <https://doi.org/10.1017/pasa.2018.1>`_ ads:`2018PASA...35....5D <https://ui.adsabs.harvard.edu/abs/2018PASA...35....5D/abstract>`_.

* Danehkar, A. (2021). Physical and Chemical Properties of Wolf-Rayet Planetary Nebulae, *ApJS*, **257**, 58.  doi:`10.3847/1538-4365/ac2310 <https://doi.org/10.3847/1538-4365/ac2310>`_ ads:`2021ApJS..257...58D <https://ui.adsabs.harvard.edu/abs/2021ApJS..257...58D/abstract>`_.


Citation
========

Using the **pyEQUIB** Python package in a scholarly publication? Please cite thess papers:

.. code-block:: bibtex

   @article{Danehkar2020,
     author = {{Danehkar}, Ashkbiz},
     title = {pyEQUIB Python Package, an addendum to proEQUIB: IDL Library 
              for Plasma Diagnostics and Abundance Analysis},
     journal = {Journal of Open Source Software},
     volume = {5},
     number = {55},
     pages = {2798},
     year = {2020},
     doi = {10.21105/joss.02798}
   }

and if you use the `proEQUIB <https://github.com/equib/proEQUIB>`_ IDL library:

.. code-block:: bibtex

   @article{Danehkar2018,
     author = {{Danehkar}, Ashkbiz},
     title = {proEQUIB: IDL Library for Plasma Diagnostics and Abundance Analysis},
     journal = {Journal of Open Source Software},
     volume = {3},
     number = {32},
     pages = {899},
     year = {2018},
     doi = {10.21105/joss.00899}
   }

Learn More
==========

==================  =============================================
**Documentation**   https://pyequib.readthedocs.io/
**Repository**      https://github.com/equib/pyEQUIB
**Issues & Ideas**  https://github.com/equib/pyEQUIB/issues
**Conda-Forge**     https://anaconda.org/conda-forge/pyequib
**PyPI**            https://pypi.org/project/pyequib/
**DOI**             `10.21105/joss.02798 <https://doi.org/10.21105/joss.02798>`_
**Archive**         `10.5281/zenodo.4287575 <https://doi.org/10.5281/zenodo.4287575>`_
==================  =============================================

            

Raw data

            {
    "_id": null,
    "home_page": "https://equib.github.io/pyEQUIB/",
    "name": "pyequib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pyEQUIB,EQUIB,equilibrium,emissivities,plasma diagnostics,abundance analysis,astronomy,physics,astrophysics",
    "author": "Ashkbiz Danehkar",
    "author_email": "ashkbiz.danehkar@students.mq.edu.au",
    "download_url": "https://files.pythonhosted.org/packages/a4/4a/fd261e3ea0d70b9efcd8c9c522edfcc415cc649d15048a63737390496ac5/pyequib-0.4.3.tar.gz",
    "platform": "any",
    "description": "======================\npyEQUIB Python Package\n======================\n\n.. image:: https://img.shields.io/pypi/v/pyequib.svg?style=flat\n    :target: https://pypi.python.org/pypi/pyequib/\n    :alt: PyPI Version\n    \n.. image:: https://app.travis-ci.com/equib/pyEQUIB.svg?branch=master\n    :target: https://app.travis-ci.com/github/equib/pyEQUIB\n    :alt: Build Status\n    \n.. image:: https://ci.appveyor.com/api/projects/status/b3gw6vgf8s0vu8nv?svg=true\n    :target: https://ci.appveyor.com/project/danehkar/pyequib\n    :alt: Build Status\n    \n.. image:: https://coveralls.io/repos/github/equib/pyEQUIB/badge.svg?branch=master\n    :target: https://coveralls.io/github/equib/pyEQUIB?branch=master\n    :alt: Coverage Status\n    \n.. image:: https://img.shields.io/badge/license-GPL-blue.svg\n    :target: https://github.com/equib/pyEQUIB/blob/master/LICENSE\n    :alt: GitHub license\n    \n.. image:: https://img.shields.io/conda/vn/conda-forge/pyequib.svg\n    :target: https://anaconda.org/conda-forge/pyequib\n    :alt: Anaconda Cloud\n    \n.. image:: https://readthedocs.org/projects/pyequib/badge/?version=latest\n    :target: https://pyequib.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n    \n.. image:: https://img.shields.io/badge/python-2.7%2C%203.8-blue.svg\n    :alt: Support Python versions 2.7 and 3.8\n    \n.. image:: https://img.shields.io/badge/DOI-10.5281/zenodo.4287575-blue.svg\n    :target: https://doi.org/10.5281/zenodo.4287575\n    :alt: Zenodo\n    \n.. image:: http://joss.theoj.org/papers/10.21105/joss.02798/status.svg\n    :target: https://doi.org/10.21105/joss.02798\n    :alt: JOSS\n\n.. image:: https://mybinder.org/badge_logo.svg\n :target: https://mybinder.org/v2/gh/equib/pyEQUIB/HEAD?labpath=Notebooks.ipynb\n \nDescription\n===========\n\nThe **pyEQUIB** library is a collection of `Python <https://www.python.org/>`_ programs developed to perform plasma diagnostics and abundance analysis using emission line fluxes measured in ionzed nebulae. It uses the `AtomNeb Python Package <https://github.com/atomneb/AtomNeb-py>`_ to read collision strengths and transition probabilities for collisionally excited lines (CEL), and recombination coefficients for recombination lines (RL). This Python package can be used to determine interstellar extinctions, electron temperatures, electron densities, and ionic abundances from the measured fluxes of emission lines. It mainly contains the follwing API functions written purely in Python: \n\n* **API functions for collisionally excited lines (CEL)** have been developed based on the algorithm of the FORTRAN program `EQUIB <https://github.com/equib/EQUIB>`_ originally written in FORTRAN by `Howarth & Adams (1981) <https://ui.adsabs.harvard.edu/abs/1981ucl..rept.....H/abstract>`_, extended and customized by other people (`R. Clegg, D. Ruffle, X.-W. Liu, C. Pritchet, B. Ercolano, & R. Wesson <https://ui.adsabs.harvard.edu/abs/2016ascl.soft03005H/abstract>`_). The program EQUIB calculates atomic level populations and line emissivities in statistical equilibrium in multi-level atoms for different physical conditions of the stratification layers where the chemical elements are ionized. Using the Python implementation of the program EQUIB, electron temperatures, electron densities, and ionic abundances are determined from the measured fluxes of collisionally excited lines.\n\n* **API functions for recombination lines (RL)** have been developed based on the algorithm of the recombination scripts by X. W. Liu and Y. Zhang from `output_mod.f90 <https://github.com/mocassin/MOCASSIN-2.0/blob/master/source/output_mod.f90>`_ included in the FORTRAN program `MOCASSIN <https://github.com/mocassin/MOCASSIN-2.0>`_. These API functiosn are used to determine ionic abundances from recombination lines for some heavy element ions.\n \n* **API functions for reddening and extinctions** have been developed according to the methods of the reddening law functions from `STSDAS IRAF Package <https://github.com/equib/iraf-redcorr>`_, which are used to obtain interstellar extinctions and deredden measured fluxes based on different reddening laws.\n\n\nInstallation\n============\n\nDependent Python Packages\n-------------------------\n\n This package requires the following packages:\n\n    - `NumPy <https://numpy.org/>`_\n    - `SciPy <https://scipy.org/scipylib/>`_\n    - `AtomNeb <https://github.com/atomneb/AtomNeb-py/>`_\n    \n* To get this package with the AtomNeb FITS files, you can simply use ``git`` command as follows:\n\n.. code-block::\n\n        git clone --recursive https://github.com/equib/pyEQUIB\n\nTo install the last version, all you should need to do is\n\n.. code-block::\n\n    $ python setup.py install\n\nTo install the stable version, you can use the preferred installer program (pip):\n\n.. code-block::\n\n    $ pip install pyequib\n\nor you can install it from the cross-platform package manager *conda*:\n\n.. code-block::\n\n    $ conda install -c conda-forge pyequib\n\nHow to Use\n==========\n\nThe Documentation of the Python functions provides in detail in the *API Documentation* (`equib.github.io/pyEQUIB/doc <https://equib.github.io/pyEQUIB/doc>`_). \n\nSee *Jupyter Notebooks*: `Notebooks.ipynb <https://github.com/equib/pyEQUIB/blob/master/Notebooks.ipynb>`_\n\nRun *Jupyter Notebooks* on `Binder <https://mybinder.org/v2/gh/equib/pyEQUIB/HEAD?labpath=Notebooks.ipynb>`_:\n\n.. image:: https://mybinder.org/badge_logo.svg\n :target: https://mybinder.org/v2/gh/equib/pyEQUIB/HEAD?labpath=Notebooks.ipynb\n \nThere are three main object units:\n\n* **Collision Unit** has the API functions for plasma diagnostics and abundance analysis of collisionally excited lines. Here are some examples of using *Collision* Unit:\n\n    - *Temperature*:\n\n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_dir = os.path.join('atomic-data', 'chianti70')\n        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\n        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\n        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n        \n        atom = 's'\n        ion = 'ii'\n        s_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)\n        s_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)\n        s_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)\n        \n        upper_levels='1,2,1,3/'\n        lower_levels='1,5/'\n        density = np.float64(2550)\n        line_flux_ratio=np.float64(10.753)\n        temperature = pyequib.calc_temperature(line_flux_ratio=line_flux_ratio, density=density, \n                               upper_levels=upper_levels, lower_levels=lower_levels, \n                               elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)\n        print(\"Electron Temperature:\", temperature)\n\n      which gives::\n    \n        Electron Temperature:       7920.2865\n\n    - *Density*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_dir = os.path.join('atomic-data', 'chianti70')\n        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\n        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\n        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n        \n        atom = 's'\n        ion = 'ii'\n        s_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)\n        s_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)\n        s_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)\n        \n        upper_levels='1,2/'\n        lower_levels='1,3/'\n        temperature=np.float64(7000.0)#\n        line_flux_ratio=np.float64(1.506)#\n        density = pyequib.calc_density(line_flux_ratio=line_flux_ratio, temperature=temperature, \n                                       upper_levels=upper_levels, lower_levels=lower_levels, \n                                       elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)\n        print(\"Electron Density:\", density)\n\n      which gives::\n      \n        Electron Density:       2312.6395\n\n    - *Ionic Abundance*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_dir = os.path.join('atomic-data', 'chianti70')\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\n        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\n        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'h'\n        ion = 'ii' # H I Rec\n        hi_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        atom = 'o'\n        ion = 'iii' # [O III]\n        o_iii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5) # read Energy Levels (Ej)\n        o_iii_omij = atomneb.read_omij(atom_omij_file, atom, ion) # read Collision Strengths (Omegaij)\n        o_iii_aij = atomneb.read_aij(atom_aij_file, atom, ion) # read Transition Probabilities (Aij)\n\n        levels5007='3,4/'\n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        iobs5007=np.float64(1200.0)\n        abb5007 = pyequib.calc_abundance(temperature=temperature, density=density, \n                                         line_flux=iobs5007, atomic_levels=levels5007,\n                                         elj_data=o_iii_elj, omij_data=o_iii_omij, aij_data=o_iii_aij, \n                                         h_i_aeff_data=hi_rc_data['aeff'][0])\n        print('N(O^2+)/N(H+):', abb5007)\n\n      which gives::\n      \n        N(O^2+)/N(H+):   0.00041256231 \n        \n    - *Emissivity*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_dir = os.path.join('atomic-data', 'chianti70')\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\n        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\n        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'h'\n        ion = 'ii' # H I Rec\n        hi_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        atom = 'o'\n        ion = 'iii' # [O III]\n        o_iii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5) # read Energy Levels (Ej)\n        o_iii_omij = atomneb.read_omij(atom_omij_file, atom, ion) # read Collision Strengths (Omegaij)\n        o_iii_aij = atomneb.read_aij(atom_aij_file, atom, ion) # read Transition Probabilities (Aij)\n        \n        levels5007='3,4/'\n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        iobs5007=np.float64(1200.0)\n        emis = pyequib.calc_emissivity(temperature=temperature, density=density, atomic_levels=levels5007, \n                                       elj_data=o_iii_elj, omij_data=o_iii_omij, aij_data=o_iii_aij)\n        print('Emissivity(O III 5007):', emis)\n\n      which gives::\n      \n        Emissivity(O III 5007):   3.6041012e-21\n        \n\n    - *Atomic Level Population*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_dir = os.path.join('atomic-data', 'chianti70')\n        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\n        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\n        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n        \n        atom = 's'\n        ion = 'ii'\n        s_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)\n        s_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)\n        s_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)\n        \n        density = np.float64(1000)\n        temperature=np.float64(10000.0)#\n        nlj = pyequib.calc_populations(temperature=temperature, density=density, \n                                       elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)\n        print('Populations:', nlj)\n\n      which prints::\n      \n        Populations: 0.96992832 0.0070036315 0.023062261 2.6593671e-06 3.1277019e-06\n\n    - *Critical Density*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_dir = os.path.join('atomic-data', 'chianti70')\n        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\n        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\n        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n        \n        atom = 's'\n        ion = 'ii'\n        s_ii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5)\n        s_ii_omij = atomneb.read_omij(atom_omij_file, atom, ion)\n        s_ii_aij = atomneb.read_aij(atom_aij_file, atom, ion)\n        \n        temperature=np.float64(10000.0)\n        n_crit = pyequib.calc_crit_density(temperature=temperature, \n                                           elj_data=s_ii_elj, omij_data=s_ii_omij, aij_data=s_ii_aij)\n        print('Critical Densities:', n_crit)\n\n      which gives::\n      \n        Critical Densities: 0.0000000 5007.8396 1732.8414 1072685.0 2220758.1\n\n    - *All Ionic Level Information*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_dir = os.path.join('atomic-data', 'chianti70')\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_elj_file = os.path.join(base_dir,data_dir, 'AtomElj.fits')\n        atom_omij_file = os.path.join(base_dir,data_dir, 'AtomOmij.fits')\n        atom_aij_file = os.path.join(base_dir,data_dir, 'AtomAij.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'h'\n        ion = 'ii' # H I Rec\n        hi_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        atom = 'o'\n        ion = 'iii' # [O III]\n        o_iii_elj = atomneb.read_elj(atom_elj_file, atom, ion, level_num=5) # read Energy Levels (Ej)\n        o_iii_omij = atomneb.read_omij(atom_omij_file, atom, ion) # read Collision Strengths (Omegaij)\n        o_iii_aij = atomneb.read_aij(atom_aij_file, atom, ion) # read Transition Probabilities (Aij)\n        \n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        pyequib.print_ionic(temperature=temperature, density=density,\n                    elj_data=o_iii_elj, omij_data=o_iii_omij, aij_data=o_iii_aij,\n                    h_i_aeff_data=hi_rc_data['aeff'][0])\n\n      which gives::\n      \n        Temperature =   10000.0 K\n        Density =    1000.0 cm-3\n        \n        Level    Populations   Critical Densities \n        Level 1:   3.063E-01   0.000E+00\n        Level 2:   4.896E-01   4.908E+02\n        Level 3:   2.041E-01   3.419E+03\n        Level 4:   4.427E-05   6.853E+05\n        Level 5:   2.985E-09   2.547E+07\n          \n         2.597E-05  \n             88.34um \n             (2-->1) \n         2.859E-22  \n        \n         0.000E+00   9.632E-05  \n             32.66um      51.81um \n             (3-->1)     (3-->2) \n         0.000E+00   7.536E-22  \n        \n         2.322E-06   6.791E-03   2.046E-02  \n           4932.60A    4960.29A    5008.24A \n            (4-->1)     (4-->2)     (4-->3) \n         4.140E-25   1.204E-21   3.593E-21  \n        \n         0.000E+00   2.255E-01   6.998E-04   1.685E+00  \n           2315.58A    2321.67A    2332.12A    4364.45A \n            (5-->1)     (5-->2)     (5-->3)     (5-->4) \n         0.000E+00   5.759E-24   1.779E-26   2.289E-23  \n        \n        H-beta emissivity: 1.237E-25 N(H+) Ne  [erg/s]\n\n\n* **Recombination Unit** has the API functions for plasma diagnostics and abundance analysis of recombination lines. Here are some examples of using *Recombination* Unit:\n\n    - *He+ Ionic Abundance*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_he_i_file = os.path.join(base_dir,data_rc_dir, 'rc_he_ii_PFSD12.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'h'\n        ion = 'ii' # H I\n        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        atom = 'he'\n        ion = 'ii' # He I\n        he_i_rc_data = atomneb.read_aeff_he_i_pfsd12(atom_rc_he_i_file, atom, ion)\n        \n        h_i_aeff_data = h_i_rc_data['aeff'][0]\n        he_i_aeff_data = he_i_rc_data['aeff'][0]\n        \n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        he_i_4471_flux= 2.104\n        linenum=10# 4471.50\n        abund_he_i = pyequib.calc_abund_he_i_rl(temperature=temperature, density=density,\n                                        linenum=linenum, line_flux=he_i_4471_flux,\n                                        he_i_aeff_data=he_i_aeff_data, h_i_aeff_data=h_i_aeff_data)\n        print('N(He^+)/N(H^+):', abund_he_i)\n\n      which gives::\n      \n        N(He^+)/N(H^+):     0.040848393\n\n    - *He++ Ionic Abundance*:\n\n      .. code-block:: Python\n      \n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'h'\n        ion = 'ii' # H I\n        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        atom = 'he'\n        ion = 'iii' # He II\n        he_ii_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        h_i_aeff_data = h_i_rc_data['aeff'][0]\n        he_ii_aeff_data = he_ii_rc_data['aeff'][0]\n        \n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        he_ii_4686_flux = 135.833\n        abund_he_ii = pyequib.calc_abund_he_ii_rl(temperature=temperature, density=density,\n                                          line_flux=he_ii_4686_flux,\n                                          he_ii_aeff_data=he_ii_aeff_data, h_i_aeff_data=h_i_aeff_data)\n        print('N(He^2+)/N(H^+):', abund_he_ii)\n\n      which gives::\n      \n        N(He^2+)/N(H^+):      0.11228817\n\n    - *C++ Ionic Abundance*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'c'\n        ion = 'iii' # C II\n        c_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n        \n        atom = 'h'\n        ion = 'ii' # H I\n        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        wavelength=6151.43\n        c_ii_6151_flux = 0.028\n        abund_c_ii = pyequib.calc_abund_c_ii_rl(temperature=temperature, density=density,\n                                        wavelength=wavelength, line_flux=c_ii_6151_flux,\n                                        c_ii_rc_data=c_ii_rc_data, h_i_aeff_data=h_i_aeff_data)\n        print('N(C^2+)/N(H+):', abund_c_ii)\n\n      which gives::\n      \n        N(C^2+)/N(H+):   0.00063404650 \n      \n    - *C3+ Ionic Abundance*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'c'\n        ion = 'iv' # C III\n        c_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)\n        \n        atom = 'h'\n        ion = 'ii' # H I\n        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        wavelength=4647.42\n        c_iii_4647_flux = 0.107\n        abund_c_iii = pyequib.calc_abund_c_iii_rl(temperature=temperature, density=density,\n                                          wavelength=wavelength,\n                                          line_flux=c_iii_4647_flux, c_iii_rc_data=c_iii_rc_data,\n                                          h_i_aeff_data=h_i_aeff_data)\n        print('N(C^3+)/N(H+):', abund_c_iii)\n\n      which gives::\n      \n        N(C^3+)/N(H+):   0.00017502840\n\n    - *N++ Ionic Abundance*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'n'\n        ion = 'iii' # N II\n        n_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n        n_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)\n        \n        atom = 'h'\n        ion = 'ii' # H I\n        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        wavelength=4442.02\n        n_ii_4442_flux = 0.017\n        abund_n_ii = pyequib.calc_abund_n_ii_rl(temperature=temperature, density=density,\n                                        wavelength=wavelength, line_flux=n_ii_4442_flux,\n                                        n_ii_rc_br=n_ii_rc_data_br, n_ii_rc_data=n_ii_rc_data,\n                                        h_i_aeff_data=h_i_aeff_data)\n        print('N(N^2+)/N(H+):', abund_n_ii)\n\n      which gives::\n      \n        N(N^2+)/N(H+):   0.00069297541\n\n    - *N3+ Ionic Abundance*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'n'\n        ion = 'iv' # N III\n        n_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)\n           \n        atom = 'h'\n        ion = 'ii' # H I\n        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        wavelength=4640.64\n        n_iii_4641_flux = 0.245\n        abund_n_iii = pyequib.calc_abund_n_iii_rl(temperature=temperature, density=density,\n                                          wavelength=wavelength, line_flux=n_iii_4641_flux,\n                                          n_iii_rc_data=n_iii_rc_data, h_i_aeff_data=h_i_aeff_data)\n        print('N(N^3+)/N(H+):', abund_n_iii)\n\n      which gives::\n      \n        N(N^3+)/N(H+):   6.3366175e-05\n\n    - *O++ Ionic Abundance*:\n    \n      .. code-block:: Python\n      \n        import pyequib\n        import atomneb\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'o'\n        ion = 'iii' # O II\n        o_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n        o_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)\n                   \n        atom = 'h'\n        ion = 'ii' # H I\n        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        wavelength=4613.68\n        o_ii_4614_flux = 0.009\n        abund_o_ii = pyequib.calc_abund_o_ii_rl(temperature=temperature, density=density,\n                                        wavelength=wavelength, line_flux=o_ii_4614_flux,\n                                        o_ii_rc_br=o_ii_rc_data_br,\n                                        o_ii_rc_data=o_ii_rc_data,\n                                        h_i_aeff_data=h_i_aeff_data)              \n        print('N(O^2+)/N(H+):', abund_o_ii)\n        \n      which gives::\n      \n        N(O^2+)/N(H+):    0.0018886330\n\n    - *Ne++ Ionic Abundance*:\n    \n      .. code-block:: Python\n      \n        import pyequib\n        import atomneb\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n        \n        atom = 'ne'\n        ion = 'iii' # Ne II\n        ne_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n                   \n        atom = 'h'\n        ion = 'ii' # H I\n        h_i_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n        \n        wavelength=3777.14\n        ne_ii_3777_flux = 0.056\n        abund_ne_ii = pyequib.calc_abund_ne_ii_rl(temperature=temperature, density=density,\n                                          wavelength=wavelength, line_flux=ne_ii_3777_flux,\n                                          ne_ii_rc_data=ne_ii_rc_data, h_i_aeff_data=h_i_aeff_data)\n        print('N(Ne^2+)/N(H+):', abund_ne_ii)\n\n      which gives::\n      \n        N(Ne^2+)/N(H+):   0.00043376850\n\n\n    - *He I Emissivity*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_he_i_file = os.path.join(base_dir,data_rc_dir, 'rc_he_ii_PFSD12.fits')\n        \n        atom = 'he'\n        ion = 'ii' # He I\n        he_i_rc_data = atomneb.read_aeff_he_i_pfsd12(atom_rc_he_i_file, atom, ion)\n        \n        he_i_aeff_data = he_i_rc_data['aeff'][0]\n        \n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        linenum=10# 4471.50\n        emiss_he_i = pyequib.calc_emiss_he_i_rl(temperature=temperature, density=density,\n                                        linenum=linenum, he_i_aeff_data=he_i_aeff_data)\n        print('He I Emissivity:', emiss_he_i)\n\n      which gives::\n      \n        He I Emissivity:   6.3822830e-26\n\n    - *He II Emissivity*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_sh95_file = os.path.join(base_dir,data_rc_dir, 'rc_SH95.fits')\n         \n        atom = 'he'\n        ion = 'iii' # He II\n        he_ii_rc_data = atomneb.read_aeff_sh95(atom_rc_sh95_file, atom, ion)\n\n        he_ii_aeff_data = he_ii_rc_data['aeff'][0]\n\n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        emiss_he_ii = pyequib.calc_emiss_he_ii_rl(temperature=temperature, density=density,\n                                          he_ii_aeff_data=he_ii_aeff_data)\n        print('He II Emissivity:', emiss_he_ii)\n\n      which gives::\n      \n        He II Emissivity:   1.4989134e-24\n\n    - *C II Emissivity*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n        \n        atom = 'c'\n        ion = 'iii' # C II\n        c_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n        \n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        wavelength=6151.43\n        emiss_c_ii = pyequib.calc_emiss_c_ii_rl(temperature=temperature, density=density,\n                                        wavelength=wavelength, c_ii_rc_data=c_ii_rc_data)\n        print('C II Emissivity:', emiss_c_ii)\n\n      which gives::\n      \n        C II Emissivity:   5.4719511e-26\n      \n    - *C III Emissivity*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import numpy as np\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')\n        \n        atom = 'c'\n        ion = 'iv' # C III\n        c_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)\n        \n        temperature=np.float64(10000.0)\n        density=np.float64(5000.0)\n        wavelength=4647.42\n        emiss_c_iii = pyequib.calc_emiss_c_iii_rl(temperature=temperature, density=density,\n                                          wavelength=wavelength,\n                                          c_iii_rc_data=c_iii_rc_data)\n        print('C III Emissivity:', emiss_c_iii)\n\n      which gives::\n      \n        C III Emissivity:   7.5749632e-25\n\n    - *N II Emissivity*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n        \n        atom = 'n'\n        ion = 'iii' # N II\n        n_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n        n_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)\n        \n        wavelength=4442.02\n        emiss_n_ii = pyequib.calc_emiss_n_ii_rl(temperature=temperature, density=density,\n                                        wavelength=wavelength,\n                                        n_ii_rc_br=n_ii_rc_data_br, n_ii_rc_data=n_ii_rc_data)\n        print('N II Emissivity:', emiss_n_ii)\n\n      which gives::\n      \n        N II Emissivity:   3.0397397e-26\n\n    - *N III Emissivity*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        import atomneb\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_ppb91_file = os.path.join(base_dir,data_rc_dir, 'rc_PPB91.fits')\n        \n        atom = 'n'\n        ion = 'iv' # N III\n        n_iii_rc_data = atomneb.read_aeff_ppb91(atom_rc_ppb91_file, atom, ion)\n        \n        wavelength=4640.64\n        emiss_n_iii = pyequib.calc_emiss_n_iii_rl(temperature=temperature, density=density,\n                                          wavelength=wavelength, n_iii_rc_data=n_iii_rc_data)\n        print('N III Emissivity:', emiss_n_iii)\n\n      which gives::\n      \n        N III Emissivity:   4.7908644e-24\n\n    - *O II Emissivity*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n        \n        atom = 'o'\n        ion = 'iii' # O II\n        o_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n        o_ii_rc_data_br = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion, br=True)\n        \n        wavelength=4613.68\n        emiss_o_ii = pyequib.calc_emiss_o_ii_rl(temperature=temperature, density=density,\n                                        wavelength=wavelength,\n                                        o_ii_rc_br=o_ii_rc_data_br, o_ii_rc_data=o_ii_rc_data)\n        print('O II Emissivity:', emiss_o_ii)\n        \n      which gives::\n      \n        O II Emissivity:   5.9047319e-27\n\n    - *Ne II Emissivity*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        import atomneb\n        import os\n        base_dir = 'externals/atomneb'\n        data_rc_dir = os.path.join('atomic-data-rc')\n        atom_rc_all_file = os.path.join(base_dir,data_rc_dir, 'rc_collection.fits')\n        \n        atom = 'ne'\n        ion = 'iii' # Ne II\n        ne_ii_rc_data = atomneb.read_aeff_collection(atom_rc_all_file, atom, ion)\n        \n        wavelength=3777.14\n        emiss_ne_ii = pyequib.calc_emiss_ne_ii_rl(temperature=temperature, density=density,\n                                          wavelength=wavelength, ne_ii_rc_data=ne_ii_rc_data)\n        print('Ne II Emissivity:', emiss_ne_ii)\n\n      which gives::\n      \n        Ne II Emissivity:   1.5996881e-25\n        \n* **Reddening Unit** has the API functions for estimating logarithmic extinctions at H-beta and dereddening observed fluxes based on reddening laws and extinctions. Here are some examples of using *Reddening* Unit:\n\n    - *Reddening Law Function*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        wavelength=6563.0\n        r_v=3.1\n        fl=pyequib.redlaw(wavelength, rv=r_v, ext_law='GAL')\n        print('fl(6563):', fl)\n\n      which gives::\n      \n        fl(6563):     -0.32013816\n\n    - *Galactic Reddening Law Function based on Seaton (1979), Howarth (1983), & CCM (1983)*:\n    \n      .. code-block:: Python\n      \n        import pyequib\n        wavelength=6563.0\n        r_v=3.1\n        fl=pyequib.redlaw_gal(wavelength, rv=r_v)\n        print('fl(6563):', fl)\n\n      which gives::\n      \n        fl(6563):     -0.32013816\n\n    - *Galactic Reddening Law Function based on Savage & Mathis (1979)*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        wavelength=6563.0\n        fl=pyequib.redlaw_gal2(wavelength)\n        print('fl(6563):', fl)\n\n      which gives::\n      \n        fl(6563):     -0.30925984\n\n    - *Reddening Law Function based on Cardelli, Clayton & Mathis (1989)*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        wavelength=6563.0\n        r_v=3.1\n        fl=pyequib.redlaw_ccm(wavelength, rv=r_v)\n        print('fl(6563):', fl)\n\n      which gives::\n      \n        fl(6563):     -0.29756615\n\n    - *Galactic Reddening Law Function based on Whitford (1958), Seaton (1977), & Kaler(1976)*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        wavelength=6563.0\n        fl=pyequib.redlaw_jbk(wavelength)\n        print('fl(6563):', fl)\n\n      which gives::\n      \n        fl(6563):     -0.33113684\n\n    - *Reddening Law Function based on Fitzpatrick & Massa (1990), Fitzpatrick (1999), Misselt (1999)*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        wavelength=6563.0\n        r_v=3.1\n        fmlaw='AVGLMC'\n        fl=pyequib.redlaw_fm(wavelength, fmlaw=fmlaw, rv=r_v)\n        print('fl(6563):', fl)\n\n      which gives::\n      \n        fl(6563):     -0.35053032\n\n    - *Reddening Law Function for the Small Magellanic Cloud*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        wavelength=6563.0\n        fl=pyequib.redlaw_smc(wavelength)\n        print('fl(6563):', fl)\n\n      which gives::\n      \n        fl(6563):     -0.22659261\n\n    - *Reddening Law Function for the Large Magellanic Cloud*:\n    \n      .. code-block:: Python\n    \n        import pyequib\n        wavelength=6563.0\n        fl=pyequib.redlaw_lmc(wavelength)\n        print('fl(6563):', fl)\n\n      which gives::\n      \n        fl(6563):     -0.30871187\n\n    - *Dereddening Relative Flux*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        wavelength=6563.0\n        m_ext=1.0\n        flux=1.0\n        ext_law='GAL'\n        r_v=3.1\n        flux_deredden=pyequib.deredden_relflux(wavelength, flux, m_ext, ext_law=ext_law, rv=r_v)\n        print('dereddened flux(6563)', flux_deredden)\n\n      which gives::\n      \n        dereddened flux(6563)       0.47847785\n\n    - *Dereddening Absolute Flux*:\n    \n      .. code-block:: Python\n\n        import pyequib\n        wavelength=6563.0\n        m_ext=1.0\n        flux=1.0\n        ext_law='GAL'\n        r_v=3.1\n        flux_deredden=pyequib.deredden_flux(wavelength, flux, m_ext, ext_law=ext_law, rv=r_v)\n        print('dereddened flux(6563)', flux_deredden)\n\n      which gives::\n      \n        dereddened flux(6563)      4.7847785\n\nDocumentation\n=============\n\nFor more information on how to use the API functions from the pyEQUIB libray, please read the `API Documentation  <https://equib.github.io/pyEQUIB/doc>`_ published on `equib.github.io/pyEQUIB <https://equib.github.io/pyEQUIB>`_.\n\n\nReferences\n==========\n* Danehkar, A. (2020). pyEQUIB Python Package, an addendum to proEQUIB: IDL Library for Plasma Diagnostics and Abundance Analysis. *J. Open Source Softw.*, **5**, 2798. doi:`10.21105/joss.02798 <https://doi.org/10.21105/joss.02798>`_ ads:`2020JOSS....5.2798D <https://ui.adsabs.harvard.edu/abs/2020JOSS....5.2798D/abstract>`_.\n\n* Danehkar, A. (2018). proEQUIB: IDL Library for Plasma Diagnostics and Abundance Analysis. *J. Open Source Softw.*, **3**, 899. doi:`10.21105/joss.00899 <https://doi.org/10.21105/joss.00899>`_ ads:`2018JOSS....3..899D <https://ui.adsabs.harvard.edu/abs/2018JOSS....3..899D/abstract>`_.\n\n* Danehkar, A. (2018). Bi-Abundance Ionisation Structure of the Wolf-Rayet Planetary Nebula PB 8, *PASA*, **35**, e005.  doi:`10.1017/pasa.2018.1 <https://doi.org/10.1017/pasa.2018.1>`_ ads:`2018PASA...35....5D <https://ui.adsabs.harvard.edu/abs/2018PASA...35....5D/abstract>`_.\n\n* Danehkar, A. (2021). Physical and Chemical Properties of Wolf-Rayet Planetary Nebulae, *ApJS*, **257**, 58.  doi:`10.3847/1538-4365/ac2310 <https://doi.org/10.3847/1538-4365/ac2310>`_ ads:`2021ApJS..257...58D <https://ui.adsabs.harvard.edu/abs/2021ApJS..257...58D/abstract>`_.\n\n\nCitation\n========\n\nUsing the **pyEQUIB** Python package in a scholarly publication? Please cite thess papers:\n\n.. code-block:: bibtex\n\n   @article{Danehkar2020,\n     author = {{Danehkar}, Ashkbiz},\n     title = {pyEQUIB Python Package, an addendum to proEQUIB: IDL Library \n              for Plasma Diagnostics and Abundance Analysis},\n     journal = {Journal of Open Source Software},\n     volume = {5},\n     number = {55},\n     pages = {2798},\n     year = {2020},\n     doi = {10.21105/joss.02798}\n   }\n\nand if you use the `proEQUIB <https://github.com/equib/proEQUIB>`_ IDL library:\n\n.. code-block:: bibtex\n\n   @article{Danehkar2018,\n     author = {{Danehkar}, Ashkbiz},\n     title = {proEQUIB: IDL Library for Plasma Diagnostics and Abundance Analysis},\n     journal = {Journal of Open Source Software},\n     volume = {3},\n     number = {32},\n     pages = {899},\n     year = {2018},\n     doi = {10.21105/joss.00899}\n   }\n\nLearn More\n==========\n\n==================  =============================================\n**Documentation**   https://pyequib.readthedocs.io/\n**Repository**      https://github.com/equib/pyEQUIB\n**Issues & Ideas**  https://github.com/equib/pyEQUIB/issues\n**Conda-Forge**     https://anaconda.org/conda-forge/pyequib\n**PyPI**            https://pypi.org/project/pyequib/\n**DOI**             `10.21105/joss.02798 <https://doi.org/10.21105/joss.02798>`_\n**Archive**         `10.5281/zenodo.4287575 <https://doi.org/10.5281/zenodo.4287575>`_\n==================  =============================================\n",
    "bugtrack_url": null,
    "license": "http://www.gnu.org/licenses/gpl.html",
    "summary": "pyequib: Python Package for Plasma Diagnostics and Abundance Analysis",
    "version": "0.4.3",
    "project_urls": {
        "Download": "https://github.com/equib/pyEQUIB",
        "Homepage": "https://equib.github.io/pyEQUIB/"
    },
    "split_keywords": [
        "pyequib",
        "equib",
        "equilibrium",
        "emissivities",
        "plasma diagnostics",
        "abundance analysis",
        "astronomy",
        "physics",
        "astrophysics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa5fc6f09c6ecd2bb602967a1d16887872cb62ef7e75d92164a78333ec5948aa",
                "md5": "eba84c04d1f553b315b2cd51df10f488",
                "sha256": "8e3e7e775ee0adc715633918eccb9e10be599b1ccbaf5899ad421a513128f8b2"
            },
            "downloads": -1,
            "filename": "pyequib-0.4.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "eba84c04d1f553b315b2cd51df10f488",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 67665,
            "upload_time": "2023-12-22T19:22:52",
            "upload_time_iso_8601": "2023-12-22T19:22:52.799866Z",
            "url": "https://files.pythonhosted.org/packages/fa/5f/c6f09c6ecd2bb602967a1d16887872cb62ef7e75d92164a78333ec5948aa/pyequib-0.4.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a44afd261e3ea0d70b9efcd8c9c522edfcc415cc649d15048a63737390496ac5",
                "md5": "a2c6bd3f8a343423227a3876de1b2e71",
                "sha256": "3e645c8681442d1c4972f6e4ddc6eb7b9d8e552d8b75b1914cb33cc8f206bfe3"
            },
            "downloads": -1,
            "filename": "pyequib-0.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a2c6bd3f8a343423227a3876de1b2e71",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 65097,
            "upload_time": "2023-12-22T19:22:54",
            "upload_time_iso_8601": "2023-12-22T19:22:54.491693Z",
            "url": "https://files.pythonhosted.org/packages/a4/4a/fd261e3ea0d70b9efcd8c9c522edfcc415cc649d15048a63737390496ac5/pyequib-0.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-22 19:22:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "equib",
    "github_project": "pyEQUIB",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "appveyor": true,
    "lcname": "pyequib"
}
        
Elapsed time: 0.18528s