# Path: auxi/tools/materialphysicalproperties/polynomial.py
# class PolynomialModelT(Model):
#     def create(dataset, symbol, degree):
#     def __init__(self, material, property, symbol, display_symbol, units,
#                  references, datasets, coeffs):
#     def calculate(self, **state):
#     def plot(self, datasets, path, show=False):
# 
# Path: auxi/tools/materialphysicalproperties/core.py
# class DataSet(object):
#     """
#     Contains a data set used to create and/or test a material physical property
#     model.
# 
#     :param csvfilepath: path to the csv file that contains the data
#     """
# 
#     @staticmethod
#     def create_template(material, path, show=False):
#         """
#         Create a template csv file for a data set.
# 
#         :param material: the name of the material
#         :param path: the path of the directory where the file must be written
#         :param show: a boolean indicating whether the created file should be \
#         displayed after creation
#         """
#         file_name = 'dataset-%s.csv' % material.lower()
#         file_path = os.path.join(path, file_name)
# 
#         with open(file_path, 'w', newline='') as csvfile:
#             writer = csv.writer(csvfile, delimiter=',',
#                                 quotechar='"', quoting=csv.QUOTE_MINIMAL)
#             writer.writerow(['Name', material])
#             writer.writerow(['Description', '<Add a data set description '
#                                             'here.>'])
#             writer.writerow(['Reference', '<Add a reference to the source of '
#                                           'the data set here.>'])
#             writer.writerow(['Temperature', '<parameter 1 name>',
#                             '<parameter 2 name>', '<parameter 3 name>'])
#             writer.writerow(['T', '<parameter 1 display symbol>',
#                              '<parameter 2 display symbol>',
#                              '<parameter 3 display symbol>'])
#             writer.writerow(['K', '<parameter 1 units>',
#                              '<parameter 2 units>', '<parameter 3 units>'])
#             writer.writerow(['T', '<parameter 1 symbol>',
#                              '<parameter 2 symbol>', '<parameter 3 symbol>'])
#             for i in range(10):
#                 writer.writerow([100.0 + i*50, float(i), 10.0 + i, 100.0 + i])
# 
#         if show is True:
#             webbrowser.open_new(file_path)
# 
#     def __init__(self, csvfilepath):
#         self._file_path = csvfilepath
#         self._read_header_information()
#         self._read_data()
# 
#     def __str__(self):
#         result = 'Material:         %s\n' % self.material
#         result += 'Description:      %s\n' % self.description
#         result += 'References:       %s\n' % self.reference
#         result += 'Properties:       %s\n' % self.col_names
#         result += 'Symbols:          %s\n' % self.col_symbols
#         result += 'Display symbols:  %s\n' % self.col_display_symbols
#         result += 'Units:            %s\n' % self.col_units
#         result += 'Data:\n'
#         result += str(self.data)
# 
#         return result
# 
#     def _read_header_information(self):
#         with open(self._file_path, newline='') as file:
#             lines = csv.reader(file, delimiter=',', quotechar='"')
# 
#             self.name = os.path.basename(self._file_path)
#             """The name of the data set."""
# 
#             self.material = next(lines)[1]
#             """The name of the material represented by the data set."""
# 
#             self.description = next(lines)[1]
#             """A description of the data set."""
# 
#             self.reference = next(lines)[1]
#             """A reference to the source of the data set."""
# 
#             self.col_names = next(lines)
#             """A list of data set column names."""
# 
#             self.col_display_symbols = next(lines)
#             """A list of data set column display symbols."""
# 
#             self.col_units = next(lines)
#             """A list of data set column units."""
# 
#             self.col_symbols = next(lines)
#             """A list of data set column symbols."""
# 
#             self.names_dict = dict(zip(self.col_symbols, self.col_names))
#             """A dictionary to translate a parameter's symbol to its name."""
# 
#             self.display_symbols_dict = dict(zip(self.col_symbols,
#                                                  self.col_display_symbols))
#             """
#             A dictionary to translate a parameter's symbol to its display
#             symbol.
#             """
# 
#             self.units_dict = dict(zip(self.col_symbols, self.col_units))
#             """A dictionary to translate a parameter's symbol to its units."""
# 
#     def _read_data(self):
#         self.data = pd.read_csv(self._file_path, header=6)


import unittest
from os import remove
from os.path import realpath, dirname, join, isfile
from auxi.tools.materialphysicalproperties import polynomial as testee
from auxi.tools.materialphysicalproperties.core import DataSet
                  0.0009239972475093591, -0.13882710545123356,
                  11.147387712425617]

        for c, cref in zip(model._coeffs, coeffs):
            self.assertAlmostEqual(c, cref)

    def test_create(self):
        """
        Test whether a model is created successfully from a data set.
        """
        dataset_path = join(MODULE_PATH, 'data/dataset-air-lienhard2015.csv')
        dataset = DataSet(dataset_path)
        model = testee.PolynomialModelT.create(dataset, 'rho', 10)
        self._test_properties(model)

    @unittest.skip("This test needs attention.")
    def test_read(self):
        """
        Test whether a model is created successfully by loading it from a json
        file.
        """
        model = testee.PolynomialModelT.read(join(MODULE_PATH,
                                             'data/air-rho.json'))
        self._test_properties(model)

    def test_write(self):
        """
        Test whether a model is successfully written to a json file.
        """
        dataset_path = join(MODULE_PATH, 'data/dataset-air-lienhard2015.csv')

# Path: auxi/tools/materialphysicalproperties/polynomial.py
# class PolynomialModelT(Model):
#     def create(dataset, symbol, degree):
#     def __init__(self, material, property, symbol, display_symbol, units,
#                  references, datasets, coeffs):
#     def calculate(self, **state):
#     def plot(self, datasets, path, show=False):
# 
# Path: auxi/tools/materialphysicalproperties/core.py
# class DataSet(object):
#     """
#     Contains a data set used to create and/or test a material physical property
#     model.
# 
#     :param csvfilepath: path to the csv file that contains the data
#     """
# 
#     @staticmethod
#     def create_template(material, path, show=False):
#         """
#         Create a template csv file for a data set.
# 
#         :param material: the name of the material
#         :param path: the path of the directory where the file must be written
#         :param show: a boolean indicating whether the created file should be \
#         displayed after creation
#         """
#         file_name = 'dataset-%s.csv' % material.lower()
#         file_path = os.path.join(path, file_name)
# 
#         with open(file_path, 'w', newline='') as csvfile:
#             writer = csv.writer(csvfile, delimiter=',',
#                                 quotechar='"', quoting=csv.QUOTE_MINIMAL)
#             writer.writerow(['Name', material])
#             writer.writerow(['Description', '<Add a data set description '
#                                             'here.>'])
#             writer.writerow(['Reference', '<Add a reference to the source of '
#                                           'the data set here.>'])
#             writer.writerow(['Temperature', '<parameter 1 name>',
#                             '<parameter 2 name>', '<parameter 3 name>'])
#             writer.writerow(['T', '<parameter 1 display symbol>',
#                              '<parameter 2 display symbol>',
#                              '<parameter 3 display symbol>'])
#             writer.writerow(['K', '<parameter 1 units>',
#                              '<parameter 2 units>', '<parameter 3 units>'])
#             writer.writerow(['T', '<parameter 1 symbol>',
#                              '<parameter 2 symbol>', '<parameter 3 symbol>'])
#             for i in range(10):
#                 writer.writerow([100.0 + i*50, float(i), 10.0 + i, 100.0 + i])
# 
#         if show is True:
#             webbrowser.open_new(file_path)
# 
#     def __init__(self, csvfilepath):
#         self._file_path = csvfilepath
#         self._read_header_information()
#         self._read_data()
# 
#     def __str__(self):
#         result = 'Material:         %s\n' % self.material
#         result += 'Description:      %s\n' % self.description
#         result += 'References:       %s\n' % self.reference
#         result += 'Properties:       %s\n' % self.col_names
#         result += 'Symbols:          %s\n' % self.col_symbols
#         result += 'Display symbols:  %s\n' % self.col_display_symbols
#         result += 'Units:            %s\n' % self.col_units
#         result += 'Data:\n'
#         result += str(self.data)
# 
#         return result
# 
#     def _read_header_information(self):
#         with open(self._file_path, newline='') as file:
#             lines = csv.reader(file, delimiter=',', quotechar='"')
# 
#             self.name = os.path.basename(self._file_path)
#             """The name of the data set."""
# 
#             self.material = next(lines)[1]
#             """The name of the material represented by the data set."""
# 
#             self.description = next(lines)[1]
#             """A description of the data set."""
# 
#             self.reference = next(lines)[1]
#             """A reference to the source of the data set."""
# 
#             self.col_names = next(lines)
#             """A list of data set column names."""
# 
#             self.col_display_symbols = next(lines)
#             """A list of data set column display symbols."""
# 
#             self.col_units = next(lines)
#             """A list of data set column units."""
# 
#             self.col_symbols = next(lines)
#             """A list of data set column symbols."""
# 
#             self.names_dict = dict(zip(self.col_symbols, self.col_names))
#             """A dictionary to translate a parameter's symbol to its name."""
# 
#             self.display_symbols_dict = dict(zip(self.col_symbols,
#                                                  self.col_display_symbols))
#             """
#             A dictionary to translate a parameter's symbol to its display
#             symbol.
#             """
# 
#             self.units_dict = dict(zip(self.col_symbols, self.col_units))
#             """A dictionary to translate a parameter's symbol to its units."""
# 
#     def _read_data(self):
#         self.data = pd.read_csv(self._file_path, header=6)


# Path: auxi/tools/materialphysicalproperties/polynomial_test.py
import unittest
from os import remove
from os.path import realpath, dirname, join, isfile
from auxi.tools.materialphysicalproperties import polynomial as testee
from auxi.tools.materialphysicalproperties.core import DataSet

                  0.0009239972475093591, -0.13882710545123356,
                  11.147387712425617]

        for c, cref in zip(model._coeffs, coeffs):
            self.assertAlmostEqual(c, cref)

    def test_create(self):
        """
        Test whether a model is created successfully from a data set.
        """
        dataset_path = join(MODULE_PATH, 'data/dataset-air-lienhard2015.csv')
        dataset = DataSet(dataset_path)
        model = testee.PolynomialModelT.create(dataset, 'rho', 10)
        self._test_properties(model)

    @unittest.skip("This test needs attention.")
    def test_read(self):
        """
        Test whether a model is created successfully by loading it from a json
        file.
        """
        model = testee.PolynomialModelT.read(join(MODULE_PATH,
                                             'data/air-rho.json'))
        self._test_properties(model)

    def test_write(self):
        """
        Test whether a model is successfully written to a json file.
        """
        dataset_path = join(MODULE_PATH, 'data/dataset-air-lienhard2015.csv')

        dataset = DataSet(dataset_path)