# 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


import pyneb as pn
import numpy as np
    import matplotlib as mpl
    import matplotlib.pyplot as plt
    from matplotlib.ticker import MaxNLocator
from pyneb.utils.misc import int_to_roman, parseAtom
class DataPlot(object):
    """
    Plot transition probabilities and collision strengths from different data sets
    
    """
    def __init__(self, elem=None, spec=None, all_data=[], atom=None, n_tem_points=10000, 
                 ref_tem=None, OmegaInterp='linear',NLevels=None):
        """
    Parameters:
        - elem         atomic elem 
        - spec       ionization stage in spectroscopic notation (I = 1, II = 2, etc.)
        - atom        e.g. 'O3'
        - all_data       dictionary of all_data to be compared (see above for format)
        - [n_tem_points] number of points in the fit (default=100; increase if fit is not smooth)
        - [ref_tem]      array of temperature values to be signaled in the plots
        - OmegaInterp    interpolating function between Omega values ('Cheb' [default], 'Linear')
    
    Example:
        dataplot = pn.DataPlot('O', 3) # initializes the plot
        dataplot.plotA() # transition probabilities plot 
        dataplot.plotRelA() # relative transition probabilities plot
        dataplot.plotOmega() # collision strength plot    

        
        """
        colors = np.array(['r', 'g', 'b', 'm', 'c', 'y'])
        self.calling = 'DataPlot'
        if atom is not None:
            self.atom = str.capitalize(atom)
            self.elem = parseAtom(self.atom)[0]

# 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


# Path: pyneb/plot/plotAtomicData.py
import pyneb as pn
import numpy as np
    import matplotlib as mpl
    import matplotlib.pyplot as plt
    from matplotlib.ticker import MaxNLocator
from pyneb.utils.misc import int_to_roman, parseAtom

class DataPlot(object):
    """
    Plot transition probabilities and collision strengths from different data sets
    
    """
    def __init__(self, elem=None, spec=None, all_data=[], atom=None, n_tem_points=10000, 
                 ref_tem=None, OmegaInterp='linear',NLevels=None):
        """
    Parameters:
        - elem         atomic elem 
        - spec       ionization stage in spectroscopic notation (I = 1, II = 2, etc.)
        - atom        e.g. 'O3'
        - all_data       dictionary of all_data to be compared (see above for format)
        - [n_tem_points] number of points in the fit (default=100; increase if fit is not smooth)
        - [ref_tem]      array of temperature values to be signaled in the plots
        - OmegaInterp    interpolating function between Omega values ('Cheb' [default], 'Linear')
    
    Example:
        dataplot = pn.DataPlot('O', 3) # initializes the plot
        dataplot.plotA() # transition probabilities plot 
        dataplot.plotRelA() # relative transition probabilities plot
        dataplot.plotOmega() # collision strength plot    

        
        """
        colors = np.array(['r', 'g', 'b', 'm', 'c', 'y'])
        self.calling = 'DataPlot'
        if atom is not None:
            self.atom = str.capitalize(atom)
            self.elem = parseAtom(self.atom)[0]

            self.spec = int(parseAtom(self.atom)[1])