# 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
            return None
        for em in emis_grids:
            if not isinstance(emis_grids[em], pn.EmisGrid):
                self.log_.error('the first parameter must be a dictionary of EmisGrid', calling=self.calling + '.plot')
                return None
        if not isinstance(obs, pn.Observation):
            self.log_.error('the second parameter must be an Observation', calling=self.calling + '.plot')
            return None
        if (i_obs is None) and (obs.n_obs != 1):
            self.log_.error('i_obs must be specified when obs is multiple. try i_obs=0', calling=self.calling)
            return None
        if ax is None:
            f, ax = plt.subplots()
        else:
            f = plt.gcf()
        X = np.log10(emis_grids[list(emis_grids.keys())[0]].den2D)
        Y = emis_grids[list(emis_grids.keys())[0]].tem2D
        for label in self.diags:
            self.log_.message('plotting {0}'.format(label), calling=self.calling)
            diag = self.diags[label]
            atom = diag[0]
            def I(i, j):
                return emis_grids[atom].getGrid(lev_i=i, lev_j=j)
            def L(wave):
                return emis_grids[atom].getGrid(wave=wave)
            def S(label):
                return emis_grids[atom].getGrid(label=label)
            def B(label, I=I, L=L):
                full_label = atom + '_' + label
                if full_label in BLEND_LIST:

# 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

            return None
        for em in emis_grids:
            if not isinstance(emis_grids[em], pn.EmisGrid):
                self.log_.error('the first parameter must be a dictionary of EmisGrid', calling=self.calling + '.plot')
                return None
        if not isinstance(obs, pn.Observation):
            self.log_.error('the second parameter must be an Observation', calling=self.calling + '.plot')
            return None
        if (i_obs is None) and (obs.n_obs != 1):
            self.log_.error('i_obs must be specified when obs is multiple. try i_obs=0', calling=self.calling)
            return None
        if ax is None:
            f, ax = plt.subplots()
        else:
            f = plt.gcf()
        X = np.log10(emis_grids[list(emis_grids.keys())[0]].den2D)
        Y = emis_grids[list(emis_grids.keys())[0]].tem2D
        for label in self.diags:
            self.log_.message('plotting {0}'.format(label), calling=self.calling)
            diag = self.diags[label]
            atom = diag[0]
            def I(i, j):
                return emis_grids[atom].getGrid(lev_i=i, lev_j=j)
            def L(wave):
                return emis_grids[atom].getGrid(wave=wave)
            def S(label):
                return emis_grids[atom].getGrid(label=label)
            def B(label, I=I, L=L):
                full_label = atom + '_' + label
                if full_label in BLEND_LIST:

                    to_eval = BLEND_LIST[full_label]