# Path: pyneb/utils/misc.py
# def int_to_roman(input_):
#     """
#     Convert an integer to Roman numerals.
#     
#     Examples:
#     >>> int_to_roman(0)
#     Traceback (most recent call last):
#     ValueError: Argument must be between 1 and 3999
#     
#     >>> int_to_roman(-1)
#     Traceback (most recent call last):
#     ValueError: Argument must be between 1 and 3999
#     
#     >>> int_to_roman(1.5)
#     Traceback (most recent call last):
#     TypeError: expected integer, got <type 'float'>
#     
#     >>> print int_to_roman(2000)
#     MM
# 
#     >>> print int_to_roman(1999)
#     MCMXCIX
# 
#     """
#     if type(input_) != type(1):
#         #raise TypeError, "expected integer, got %s" % type(input_)
#         return None
#     if not 0 < input_ < 4000:
#         #raise ValueError, "Argument must be between 1 and 3999"
#         return None
#     ints = (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1)
#     nums = ('M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I')
#     result = ""
#     for i in range(len(ints)):
#         count = int(input_ / ints[i])
#         result += nums[i] * count
#         input_ -= ints[i] * count
#     return result
# 
# 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
# 
# def parseAtom2(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
#     if atom[-1] == 'r':
#         rec = 'r'
#     else:
#         rec = ''
#     return iso+str.capitalize(elem), spec, rec
# 
# Path: pyneb/utils/init.py
# BLEND_LIST = {}


import numpy as np
import pyneb as pn
            import matplotlib.pyplot as plt
from pyneb.utils.misc import int_to_roman, parseAtom, parseAtom2
from pyneb.utils.init import BLEND_LIST
                from ai4neb import manage_RM
        Add all the possible diagnostics that can be computed from an Observation object
        
        Usage:
            diags.addDiagsFromObs(obs)
            
        Parameter:
            obs     an Observation object
        """
        
        if not isinstance(obs, pn.Observation):
            pn.log_.error('The argument must be an Observation object', calling=self.calling + 'addDiagsFromObs')
        old_level = pn.log_.level
        def I(i, j):
            wave = atom.wave_Ang[i - 1, j - 1]
            corrIntens = obs.getLine(sym, spec, wave).corrIntens
            return corrIntens
        def L(wave):
            corrIntens = obs.getLine(sym, spec, wave).corrIntens
            return corrIntens
        def B(label):
            full_label = atom + '_' + label
            corrIntens = obs.getLine(label=full_label).corrIntens
            return corrIntens
        def S(label):
            full_label = atom + '_' + label + 'A'
            corrIntens = obs.getLine(label=full_label).corrIntens
            return corrIntens
            
        for label in diags_dict:
            atom, diag_expression, error = diags_dict[label]

# Path: pyneb/utils/misc.py
# def int_to_roman(input_):
#     """
#     Convert an integer to Roman numerals.
#     
#     Examples:
#     >>> int_to_roman(0)
#     Traceback (most recent call last):
#     ValueError: Argument must be between 1 and 3999
#     
#     >>> int_to_roman(-1)
#     Traceback (most recent call last):
#     ValueError: Argument must be between 1 and 3999
#     
#     >>> int_to_roman(1.5)
#     Traceback (most recent call last):
#     TypeError: expected integer, got <type 'float'>
#     
#     >>> print int_to_roman(2000)
#     MM
# 
#     >>> print int_to_roman(1999)
#     MCMXCIX
# 
#     """
#     if type(input_) != type(1):
#         #raise TypeError, "expected integer, got %s" % type(input_)
#         return None
#     if not 0 < input_ < 4000:
#         #raise ValueError, "Argument must be between 1 and 3999"
#         return None
#     ints = (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1)
#     nums = ('M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I')
#     result = ""
#     for i in range(len(ints)):
#         count = int(input_ / ints[i])
#         result += nums[i] * count
#         input_ -= ints[i] * count
#     return result
# 
# 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
# 
# def parseAtom2(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
#     if atom[-1] == 'r':
#         rec = 'r'
#     else:
#         rec = ''
#     return iso+str.capitalize(elem), spec, rec
# 
# Path: pyneb/utils/init.py
# BLEND_LIST = {}


# Path: pyneb/core/diags.py
import numpy as np
import pyneb as pn
            import matplotlib.pyplot as plt
from pyneb.utils.misc import int_to_roman, parseAtom, parseAtom2
from pyneb.utils.init import BLEND_LIST
                from ai4neb import manage_RM

        Add all the possible diagnostics that can be computed from an Observation object
        
        Usage:
            diags.addDiagsFromObs(obs)
            
        Parameter:
            obs     an Observation object
        """
        
        if not isinstance(obs, pn.Observation):
            pn.log_.error('The argument must be an Observation object', calling=self.calling + 'addDiagsFromObs')
        old_level = pn.log_.level
        def I(i, j):
            wave = atom.wave_Ang[i - 1, j - 1]
            corrIntens = obs.getLine(sym, spec, wave).corrIntens
            return corrIntens
        def L(wave):
            corrIntens = obs.getLine(sym, spec, wave).corrIntens
            return corrIntens
        def B(label):
            full_label = atom + '_' + label
            corrIntens = obs.getLine(label=full_label).corrIntens
            return corrIntens
        def S(label):
            full_label = atom + '_' + label + 'A'
            corrIntens = obs.getLine(label=full_label).corrIntens
            return corrIntens
            
        for label in diags_dict:
            atom, diag_expression, error = diags_dict[label]

            sym, spec, rec = parseAtom2(atom)