# Path: pyneb/utils/init.py
# ELEM_LIST = ['Ag', 'Al', 'Ar', 'As', 'Au', 'B', 'Ba', 'Be', 'Bi', 'Br',
#      'C', 'Ca', 'Cd', 'Ce', 'Cl', 'Co', 'Cr', 'Cs', 'Cu', 'Dy', 'Er', 'Eu', 'F', 'Fe', 'Ga', 'Gd', 'Ge',
#      'H', 'He', 'Hf', 'Hg', 'Ho', 'I', 'In', 'Ir', 'K', 'Kr', 'La', 'Li', 'Lu', 'Mg', 'Mn', 'Mo',
#      'N', 'Na', 'Nb', 'Nd', 'Ne', 'Ni', 'O', 'Os', 'P', 'Pb', 'Pd', 'Pm', 'Pr', 'Pt',
#      'Rb', 'Re', 'Rh', 'Ru', 'S', 'Sb', 'Sc', 'Se', 'Si', 'Sm', 'Sn', 'Sr',
#      'Ta', 'Tb', 'Te', 'Tc', 'Th', 'Ti', 'Tl','Tm', 'U', 'V', 'W', 'Xe', 'Y', 'Yb', 'Zn', 'Zr', '3He']
# 
# SPEC_LIST = ['1', '2', '3', '4', '5', '6', '7']
# 
# Path: pyneb/utils/misc.py
# def parseAtom(atom):
#     '''
#     Parses an atom label into the element and spectrum parts
#     '''
# 
#     iso = ''
#     elem = ''
#     spec = ''
#     cont = True
#     firstdigit = True
#     for l in atom:
#         if l.isalpha() and cont:
#             elem += l
#             firstdigit = False
#         elif l.isdigit():
#             if firstdigit:
#                 iso += l
#             else:
#                 spec += l
#                 cont = False
#     return iso+str.capitalize(elem), spec


import numpy as np
import pyneb as pn
import random
from pyneb.utils.init import ELEM_LIST, SPEC_LIST
from pyneb.utils.misc import parseAtom
    def _calcIal06(self, coeff, degree):
        """
        Compute the analytical expressions of the Ial06 paper
        
        """
        if degree == 'v':
            k1 = 'abun["O2"] / (abun["O2"] + abun["O3"])'
            k2 = '(abun["O2"] + abun["O3"]) / abun["O2"]'
        else:
            k1 = 'abun["O3"] / (abun["O2"] + abun["O3"])'
            k2 = '(abun["O2"] + abun["O3"]) / abun["O3"]'
        return '(' + str(coeff[0]) + ' * ' + k1 + ' + ' + str(coeff[1]) + ' + ' + str(coeff[2]) + ' * ' + k2 + ')'


    def _getAtomExp(self, label):
        """
        Clean the ionic factor expressions for display purposes
        
        """
        return self.all_icfs[label]['atom'].replace('abun["', '').replace('"]', '')


    def _getIcfExp(self, label):
        """
        Clean the icf expressions for display purposes

        """        
        return self.all_icfs[label]['icf'].replace('elem_abun["', '').replace('abun["', '').replace('"]', '')

    

# Path: pyneb/utils/init.py
# ELEM_LIST = ['Ag', 'Al', 'Ar', 'As', 'Au', 'B', 'Ba', 'Be', 'Bi', 'Br',
#      'C', 'Ca', 'Cd', 'Ce', 'Cl', 'Co', 'Cr', 'Cs', 'Cu', 'Dy', 'Er', 'Eu', 'F', 'Fe', 'Ga', 'Gd', 'Ge',
#      'H', 'He', 'Hf', 'Hg', 'Ho', 'I', 'In', 'Ir', 'K', 'Kr', 'La', 'Li', 'Lu', 'Mg', 'Mn', 'Mo',
#      'N', 'Na', 'Nb', 'Nd', 'Ne', 'Ni', 'O', 'Os', 'P', 'Pb', 'Pd', 'Pm', 'Pr', 'Pt',
#      'Rb', 'Re', 'Rh', 'Ru', 'S', 'Sb', 'Sc', 'Se', 'Si', 'Sm', 'Sn', 'Sr',
#      'Ta', 'Tb', 'Te', 'Tc', 'Th', 'Ti', 'Tl','Tm', 'U', 'V', 'W', 'Xe', 'Y', 'Yb', 'Zn', 'Zr', '3He']
# 
# SPEC_LIST = ['1', '2', '3', '4', '5', '6', '7']
# 
# Path: pyneb/utils/misc.py
# def parseAtom(atom):
#     '''
#     Parses an atom label into the element and spectrum parts
#     '''
# 
#     iso = ''
#     elem = ''
#     spec = ''
#     cont = True
#     firstdigit = True
#     for l in atom:
#         if l.isalpha() and cont:
#             elem += l
#             firstdigit = False
#         elif l.isdigit():
#             if firstdigit:
#                 iso += l
#             else:
#                 spec += l
#                 cont = False
#     return iso+str.capitalize(elem), spec


# Path: pyneb/core/icf.py
import numpy as np
import pyneb as pn
import random
from pyneb.utils.init import ELEM_LIST, SPEC_LIST
from pyneb.utils.misc import parseAtom

    def _calcIal06(self, coeff, degree):
        """
        Compute the analytical expressions of the Ial06 paper
        
        """
        if degree == 'v':
            k1 = 'abun["O2"] / (abun["O2"] + abun["O3"])'
            k2 = '(abun["O2"] + abun["O3"]) / abun["O2"]'
        else:
            k1 = 'abun["O3"] / (abun["O2"] + abun["O3"])'
            k2 = '(abun["O2"] + abun["O3"]) / abun["O3"]'
        return '(' + str(coeff[0]) + ' * ' + k1 + ' + ' + str(coeff[1]) + ' + ' + str(coeff[2]) + ' * ' + k2 + ')'


    def _getAtomExp(self, label):
        """
        Clean the ionic factor expressions for display purposes
        
        """
        return self.all_icfs[label]['atom'].replace('abun["', '').replace('"]', '')


    def _getIcfExp(self, label):
        """
        Clean the icf expressions for display purposes

        """        
        return self.all_icfs[label]['icf'].replace('elem_abun["', '').replace('abun["', '').replace('"]', '')

    

    def getAvailableICFs(self, elem_list=ELEM_LIST, type_=['HII', 'PNe', 'All']):