# 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
                        err = obs.getLine(label=full_label).corrError
                        if i_obs is None:
                            return err
                        else:
                            return err[i_obs]                        
                    if quad is True:
                        RMS = lambda err: np.sqrt((np.asarray(err) ** 2.).sum())
                    else:
                        RMS = lambda err: (np.asarray(err)).sum() 
                    tol_value = eval(diag[2])
                    col_dic = {'C':'cyan', 'N':'blue', 'O':'green', 'Ne':'magenta',
                               'Ar':'red', 'Cl':'magenta', 'S':'black', 'Fe':'blue'}
                    if sym in col_dic:
                        col = col_dic[sym]
                    else:
                        col = 'black'
                    style_dic = {'1':'-', '2':'--', '3':':', '4':'-.', '5':'-', '6':'--'}
                    style = style_dic[spec]
                    if tol_value > 0. and error_band:
                        levels = [(1 - tol_value) * diag_value, (1 + tol_value) * diag_value]
                        if levels[0] < levels[1]:
                            #pn.log_.debug('{} levels {}'.format(label, levels), calling=self.calling)
                            CS = ax.contourf(X, Y, diag_map, levels=levels, alpha=alpha, colors=col)
                    CS = ax.contour(X, Y, diag_map, levels=[diag_value], colors=col, linestyles=style)
                    try:
                        ax.set_xlabel(r'log(n$_{\rm e}$) [cm$^{-3}$]')
                        ax.set_ylabel(r'T$_{\rm e}$ [K]')
                        if len(diag) >= 4:
                            fmt = diag[3]
                        else:

# 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

                        err = obs.getLine(label=full_label).corrError
                        if i_obs is None:
                            return err
                        else:
                            return err[i_obs]                        
                    if quad is True:
                        RMS = lambda err: np.sqrt((np.asarray(err) ** 2.).sum())
                    else:
                        RMS = lambda err: (np.asarray(err)).sum() 
                    tol_value = eval(diag[2])
                    col_dic = {'C':'cyan', 'N':'blue', 'O':'green', 'Ne':'magenta',
                               'Ar':'red', 'Cl':'magenta', 'S':'black', 'Fe':'blue'}
                    if sym in col_dic:
                        col = col_dic[sym]
                    else:
                        col = 'black'
                    style_dic = {'1':'-', '2':'--', '3':':', '4':'-.', '5':'-', '6':'--'}
                    style = style_dic[spec]
                    if tol_value > 0. and error_band:
                        levels = [(1 - tol_value) * diag_value, (1 + tol_value) * diag_value]
                        if levels[0] < levels[1]:
                            #pn.log_.debug('{} levels {}'.format(label, levels), calling=self.calling)
                            CS = ax.contourf(X, Y, diag_map, levels=levels, alpha=alpha, colors=col)
                    CS = ax.contour(X, Y, diag_map, levels=[diag_value], colors=col, linestyles=style)
                    try:
                        ax.set_xlabel(r'log(n$_{\rm e}$) [cm$^{-3}$]')
                        ax.set_ylabel(r'T$_{\rm e}$ [K]')
                        if len(diag) >= 4:
                            fmt = diag[3]
                        else:

                            fmt = '[{0}{1}]'.format(sym, int_to_roman(int(spec)))