diff --git a/.gitignore b/.gitignore index d17eb3eaf34e0cb55b74185dd87c46e2cabd6efd..ff3bfd5e7adddc7759451df83bd51828fc5c9bca 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ bindings/matlab/compiled_mex/ bindings/python/dist/ bindings/python/src/steammaterials/CFUN *.egg-info +__pycache__/ ## Output of tests tests/test_compile_STEAM_MatPro/compiled_STEAM_MatPro/STEAM_MatPro.m diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e174aa85aa8855119d42ebb551ee278446609488..385bbb17f4b463cae70b76579cdadf1652e97a9f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -82,6 +82,8 @@ unit-test-job: - venv\Scripts\Activate.ps1 - pip install -r requirements.txt script: + # Prepare STEAM-materials library + - cp build/lib/* bindings/python/src/steammaterials/CFUN/ # Run tests - echo "Running unit tests." - python -m pytest diff --git a/bindings/python/src/steammaterials/STEAM_materials.py b/bindings/python/src/steammaterials/STEAM_materials.py index e3498e6db98717d1ca7a57ae9f303b0e9ba24e44..f320f8ce7009c5836c5025639fd30bcc80499a10 100644 --- a/bindings/python/src/steammaterials/STEAM_materials.py +++ b/bindings/python/src/steammaterials/STEAM_materials.py @@ -45,6 +45,12 @@ class STEAM_materials: self.eval = _dll.eval self.eval.argtypes = [f_name, n_arg, _doublepp, _doublepp, b_size, array_type, array_type] self.eval.restype = ifail + # Binding to the shared library error function + try: + self.getLastError = _dll.getLastError + self.getLastError.restype = ct.c_char_p + except AttributeError: + self.getLastError = None def evaluate(self, numpy2d): """ @@ -57,9 +63,14 @@ class STEAM_materials: if error_out == 1: pass else: - raise ValueError(f"There was a problem with calling {self._dll_name} with arguments {numpy2d}. Check if library file exists or if number of arguments is correct.") + if self.getLastError: + err = self.getLastError().decode('ascii') + else: + err = '[No message. Material does not implement getLastError]' + raise ValueError(f"There was a problem with calling {self._dll_name} with arguments {numpy2d}. \nError: {err}") return np.array(self.RealPtr) + class STEAM_materials_Matlab: def __init__(self,func_name:str,arg_list:str): self.arguments=arg_list @@ -71,26 +82,3 @@ class STEAM_materials_Matlab: result=eng.eval(self.func+self.arguments) print(result) -if __name__ == "__main__": - # STEAM_materials_Matlab("rhoCu_nist","(1.8,1,120.0,5)").evaluate() - - - - func_4d = 'CFUN_rhoCuNIST' # function name, this one takes 4 arguments as input and returns a single float for resistivity - T_min = 1.8 - T_max = 300 - B = 1. - RRR = 120.0 - T_ref_RRR = 273. - num_elem = 1000 - T = np.linspace(T_min, T_max, num_elem) - - # make numpy array - numpy2d = np.vstack((T, np.ones(num_elem) * B, np.ones(num_elem) * RRR, np.ones(num_elem) * T_ref_RRR)) - - # make dll func object - sm = STEAM_materials(func_4d, numpy2d.shape[0], numpy2d.shape[1], r'G:\Projects\lhccm\STEAM\MaterialsLibrary\V0.1') - - # call with 2D numpy array and get results back - result_numpy = sm.evaluate(numpy2d) - print(result_numpy) diff --git a/docs/installation_and_use/Use/python.md b/docs/installation_and_use/Use/python.md index ae94ffb0b5d733038f4dbe0fd12271c0654c30c1..dfe67bf36f7402fe266cba129eb0fe5a8cff021f 100644 --- a/docs/installation_and_use/Use/python.md +++ b/docs/installation_and_use/Use/python.md @@ -21,11 +21,7 @@ Then the module can be imported and used as shown below: import os import numpy as np import matplotlib.pyplot as plt - -# Material properties -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials -matpath = os.path.dirname(steammaterials.__file__) +from steammaterials import SteamMaterials B = [0.0, 4.0, 8.0, 12.0] T_ref_RRR = 295 @@ -36,12 +32,14 @@ for i in range(len(B)): rrr = RRR * np.ones(T.shape) rrr_ref = T_ref_RRR * np.ones(T.shape) numpy2d = np.vstack((T, b, rrr, rrr_ref)) + #1 argument function -sm_CvHast = STEAM_materials("CFUN_CvHast_v1", 1, len(T), matpath) +sm_CvHast = SteamMaterials("CFUN_CvHast_v1", 1, len(T)) Cv_hast = sm_CvHast.evaluate(T) #4 arguments function -sm_cp_rho = STEAM_materials("CFUN_rhoCu_v1", numpy2d.shape[0], numpy2d.shape[1], matpath) -RhoCu = sm_cp_rho.evaluate(numpy2d) +sm_cp_rho = SteamMaterials("CFUN_rhoCu_v1", numpy2d.shape[0], numpy2d.shape[1]) +RhoCu = sm_cp_rho.evaluate(numpy2d) + # Plots the results plt.figure(1) plt.plot(T,Cv_hast) diff --git a/examples/example_1.py b/examples/example_1.py index 0058cd87e2a91499da464eb8a15b76bd061ec480..2e8880ebbf3160de3076159cf6b85c894bc1fcbf 100644 --- a/examples/example_1.py +++ b/examples/example_1.py @@ -7,18 +7,14 @@ import numpy as np import os # Material functions: you need to install STEAM-materials, 'pip install STEAM-materials' -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials - -# It needs to know where the .dll files are stored. So it finds the path to it. -matpath: str = os.path.dirname(steammaterials.__file__) +from steammaterials import SteamMaterials cmap = matplotlib.cm.get_cmap('Spectral') # Example with 1 input value T = np.linspace(2.0, 450, 1000) numpy2d = T.reshape((1, len(T))) -sm = STEAM_materials('CFUN_rhoHast_v1', numpy2d.shape[0], numpy2d.shape[1], matpath) +sm = SteamMaterials('CFUN_rhoHast_v1', numpy2d.shape[0], numpy2d.shape[1]) out = sm.evaluate(numpy2d) fig1 = plt.figure() @@ -45,8 +41,8 @@ for i in range(len(B)): rrr_ref = T_ref_RRR * np.ones(T.shape) numpy2d = np.vstack((T, b, rrr, rrr_ref)) numpy2d2 = np.vstack((T, b, rrr)) - sm = STEAM_materials('CFUN_rhoCu_v1', numpy2d.shape[0], numpy2d.shape[1], matpath) - sm2 = STEAM_materials('CFUN_rhoCu_NIST_v1', numpy2d2.shape[0], numpy2d2.shape[1], matpath) + sm = SteamMaterials('CFUN_rhoCu_v1', numpy2d.shape[0], numpy2d.shape[1]) + sm2 = SteamMaterials('CFUN_rhoCu_NIST_v1', numpy2d2.shape[0], numpy2d2.shape[1]) out = sm.evaluate(numpy2d) out2 = sm2.evaluate(numpy2d2) ax2.plot(T, out, color=colors[i], label='Magnetic Field = ' + str(B[i]) + ' T') @@ -60,4 +56,4 @@ ax2.set_xlabel('Temperature, K') ax2.set_ylabel('Resistivity, $\Omega$m') ax2.legend() -plt.show() \ No newline at end of file +plt.show() diff --git a/examples/example_2.py b/examples/example_2.py index 65f55925e83527feb3e2487321d81622e0e65ce6..a4cca3f548c3be2ba33d7c1dd5aa8ae18e5b47db 100644 --- a/examples/example_2.py +++ b/examples/example_2.py @@ -6,11 +6,7 @@ import numpy as np import os # Material functions: you need to install STEAM-materials, 'pip install STEAM-materials' -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials - -# It needs to know where the .dll files are stored. So it finds the path to it. -matpath: str = os.path.dirname(steammaterials.__file__) +from steammaterials import SteamMaterials # Example with multiple input values fig2 = plt.figure() @@ -26,7 +22,7 @@ b = B rrr = RRR * np.ones(B.shape) rrr_ref = T_ref_RRR * np.ones(B.shape) numpy2d = np.vstack((T, b, rrr, rrr_ref)) -sm = STEAM_materials('CFUN_rhoCu_v1', numpy2d.shape[0], numpy2d.shape[1], matpath) +sm = SteamMaterials('CFUN_rhoCu_v1', numpy2d.shape[0], numpy2d.shape[1]) out = sm.evaluate(numpy2d) ax2.plot(B, out) @@ -35,4 +31,4 @@ ax2.set_xlabel('Magnetic Field, T') ax2.set_ylabel('Resistivity, $\Omega$m') ax2.legend() -plt.show() \ No newline at end of file +plt.show() diff --git a/examples/example_3.py b/examples/example_3.py index d38fdfc4a5f9b9c73236c7b879e3cc4f03802653..4281f271969c708a07aef6de1e538f611ba5fbf0 100644 --- a/examples/example_3.py +++ b/examples/example_3.py @@ -6,11 +6,7 @@ import numpy as np import os # Material functions: you need to install STEAM-materials, 'pip install STEAM-materials' -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials - -# It needs to know where the .dll files are stored. So it finds the path to it. -matpath: str = os.path.dirname(steammaterials.__file__) +from steammaterials import SteamMaterials # Example with multiple input values fig2 = plt.figure() @@ -26,7 +22,7 @@ Jc = np.ones(T.shape) Tc0 = 16.0 * np.ones(T.shape) Bc20 = 29.38 * np.ones(T.shape) numpy2d = np.vstack((T, b, Jc, Tc0, Bc20)) -sm = STEAM_materials('CFUN_Jc_Nb3Sn_Summer_v1', numpy2d.shape[0], numpy2d.shape[1], matpath) +sm = SteamMaterials('CFUN_Jc_Nb3Sn_Summer_v1', numpy2d.shape[0], numpy2d.shape[1]) out = sm.evaluate(numpy2d) ax2.plot(T, out, label='B=0T') @@ -34,4 +30,4 @@ ax2.set_xlabel('Temperature, K') ax2.set_ylabel('Jc') ax2.legend() -plt.show() \ No newline at end of file +plt.show() diff --git a/examples/example_4.py b/examples/example_4.py index 66cde1b78781e6aff0b3e70eae534faa95605b9f..f5c9519ab41cc8bb770af4bd7b41a41c00829311 100644 --- a/examples/example_4.py +++ b/examples/example_4.py @@ -6,11 +6,7 @@ import numpy as np import os # Material functions: you need to install STEAM-materials, 'pip install STEAM-materials' -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials - -# It needs to know where the .dll files are stored. So it finds the path to it. -matpath: str = os.path.dirname(steammaterials.__file__) +from steammaterial import SteamMaterials # Example with multiple input values fig2 = plt.figure() @@ -26,7 +22,7 @@ Jc = np.ones(T.shape) Tc0 = 18.3 * np.ones(T.shape) Bc20 = 28.7 * np.ones(T.shape) numpy2d = np.vstack((T, b, Jc, Tc0, Bc20)) -sm = STEAM_materials('CFUN_Jc_Nb3Sn_Summer_v1', numpy2d.shape[0], numpy2d.shape[1], matpath) +sm = SteamMaterials('CFUN_Jc_Nb3Sn_Summer_v1', numpy2d.shape[0], numpy2d.shape[1]) out = sm.evaluate(numpy2d) ax2.plot(T, out, label='B=0T') @@ -34,4 +30,4 @@ ax2.set_xlabel('Temperature, K') ax2.set_ylabel('Jc') ax2.legend() -plt.show() \ No newline at end of file +plt.show() diff --git a/examples/example_5.py b/examples/example_5.py index 916c7b06ce8a7a9dd2b8ececfba1a837abf548d9..1796e1f02149b3b0c59828c893db1400da2a9e27 100644 --- a/examples/example_5.py +++ b/examples/example_5.py @@ -6,11 +6,7 @@ import numpy as np import os # Material functions: you need to install STEAM-materials, 'pip install STEAM-materials' -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials - -# It needs to know where the .dll files are stored. So it finds the path to it. -matpath: str = os.path.dirname(steammaterials.__file__) +from steammaterials import SteamMaterials # Example with multiple input values fig2 = plt.figure() @@ -27,7 +23,7 @@ Smax = 2 * np.ones(T.shape) numpy2d = np.vstack((T, B, A, S, a, c0, Bc20, Smax)) -sm = STEAM_materials('CFUN_IcNb3Sn_WithStress_v1', numpy2d.shape[0], numpy2d.shape[1], matpath) +sm = SteamMaterials('CFUN_IcNb3Sn_WithStress_v1', numpy2d.shape[0], numpy2d.shape[1]) out = sm.evaluate(numpy2d) ax2.plot(T, out/1.7313358331527338e-08, label='RRR') @@ -36,4 +32,4 @@ ax2.set_xlabel('Temperature, K') ax2.set_ylabel('Resistivity, $\Omega$m') ax2.legend() -plt.show() \ No newline at end of file +plt.show() diff --git a/examples/example_6.py b/examples/example_6.py index 1c13b2eddba72bac6af6ce24edc467ef79fcc78b..72b312a455b609b6a78f28081da75e203c974c25 100644 --- a/examples/example_6.py +++ b/examples/example_6.py @@ -7,11 +7,7 @@ import os from math import isclose # Material functions: you need to install STEAM-materials, 'pip install STEAM-materials' -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials - -# It needs to know where the .dll files are stored. So it finds the path to it. -matpath: str = os.path.dirname(steammaterials.__file__) +from steammaterials import SteamMaterials # Example with multiple input values fig2 = plt.figure() @@ -26,7 +22,7 @@ result = [] for i in range(100000): numpy2d = np.vstack((T, Tc, Tc0, Tcs)) - sm = STEAM_materials('CFUN_CpNb3Sn_v1', numpy2d.shape[0], numpy2d.shape[1], matpath) + sm = SteamMaterials('CFUN_CpNb3Sn_v1', numpy2d.shape[0], numpy2d.shape[1]) out = sm.evaluate(numpy2d) if not isclose(out[0], 166.16752652): print(out) @@ -40,4 +36,4 @@ print(result) # ax2.set_ylabel('Resistivity, $\Omega$m') # ax2.legend() -# plt.show() \ No newline at end of file +# plt.show() diff --git a/examples/example_7.py b/examples/example_7.py index 896f6c755ed15bc14d0eea5d8b3eeab29a732a51..32c93d856086a3603dff83ccf5b95dde98b84cda 100644 --- a/examples/example_7.py +++ b/examples/example_7.py @@ -6,12 +6,7 @@ import numpy as np import os # Material functions: you need to install STEAM-materials, 'pip install STEAM-materials' -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials - -# It needs to know where the .dll files are stored. So it finds the path to it. -matpath: str = os.path.dirname(steammaterials.__file__) -matpath = 'C:\Tim Mulder\CERNBox\Staff - TE-MPE-PE\Projects\steam-material-library\DLL' +from steammaterials import SteamMaterials # Example with multiple input values fig2 = plt.figure() @@ -23,7 +18,7 @@ TheII = 1.9*np.ones_like(T) numpy2dI = np.vstack((T,TheI)) numpy2dII = np.vstack((T,TheII)) -sm = STEAM_materials('CFUN_hHe_v1', numpy2dII.shape[0], numpy2dII.shape[1], matpath) +sm = SteamMaterials('CFUN_hHe_v1', numpy2dII.shape[0], numpy2dII.shape[1]) outI = sm.evaluate(numpy2dI) outII = sm.evaluate(numpy2dII) ax2.plot(T, outI) @@ -33,4 +28,4 @@ ax2.set_xlabel('Temperature, K') ax2.set_ylabel('h, W/m$^2$k') ax2.legend() -plt.show() \ No newline at end of file +plt.show() diff --git a/examples/example_8.py b/examples/example_8.py index 27184463acdfb3da92108f752b6989c1d60f30b0..ae8a769dd41aaf7efef894a9041f3ef8356e4cd8 100644 --- a/examples/example_8.py +++ b/examples/example_8.py @@ -6,11 +6,7 @@ import numpy as np import os # Material functions: you need to install STEAM-materials, 'pip install STEAM-materials' -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials - -# It needs to know where the .dll files are stored. So it finds the path to it. -matpath: str = os.path.dirname(steammaterials.__file__) +from steammaterials import SteamMaterials # Example with multiple input values fig2 = plt.figure() @@ -21,7 +17,7 @@ T = np.linspace(1.0, 300, 1000) RRR = 100 rrr = RRR * np.ones(T.shape) numpy2d = np.vstack((T, rrr, np.ones(T.shape), np.ones(T.shape))) -sm = STEAM_materials('CFUN_kCu_v1', numpy2d.shape[0], numpy2d.shape[1], matpath) +sm = SteamMaterials('CFUN_kCu_v1', numpy2d.shape[0], numpy2d.shape[1]) out = sm.evaluate(numpy2d) ax2.plot(T, out) @@ -32,4 +28,4 @@ ax2.set_xlabel('Temperature, K') ax2.set_ylabel('Thermal Conductivity, W/mk') ax2.legend() -plt.show() \ No newline at end of file +plt.show() diff --git a/requirements.txt b/requirements.txt index 0e95a0f67801c9e0c067a2c2fa259e79c6bff27f..0027d64ad7389589b76fc119c5484676e7c085a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -STEAM-materials~=2024.4.2 +STEAM-materials~=2024.7.1 numpy==1.26.4 pandas==1.5.0 wget==3.2 diff --git a/tests/getdp/test_getdp.py b/tests/getdp/test_getdp.py index 56b12d805046a522fe884e6c5bd4e025712b2dc4..c8f0fdfc72e1bc9e0e11bd6cc8e5a49454fb0d02 100644 --- a/tests/getdp/test_getdp.py +++ b/tests/getdp/test_getdp.py @@ -1,9 +1,9 @@ import unittest import os -import steammaterials -from steammaterials.STEAM_materials import STEAM_materials +from steammaterials import SteamMaterials import numpy as np import pandas as pd +from pathlib import Path # from getdp_test_win import call_getdp_function from tests.getdp.getdp_test_win import call_getdp_function import itertools @@ -11,49 +11,42 @@ import shutil import warnings import time -matpath: str = os.path.dirname(steammaterials.__file__) -number_of_elements = 10 - -def create_outputs_folder(cwd, folder_name): - outputs_folder = os.path.join(cwd, folder_name) - if not os.path.exists(outputs_folder): - os.makedirs(outputs_folder) - return outputs_folder def separate_values(data, number_of_output_arrays): # Unpack the first 'number_of_output_arrays' values from each tuple separated_values = [item[:number_of_output_arrays] for item in data] - # Transpose the list of lists to maintain the order output_arrays = list(map(list, zip(*separated_values))) - return output_arrays + def reorder_list(lst, mapping): ordered_list = [None] * len(lst) - for i, mapped_index in enumerate(mapping): ordered_list[i] = lst[mapped_index] - return ordered_list class GetDP_tests(unittest.TestCase): + @classmethod + def setUpClass(cls): + # df = pd.read_csv(r'C:\\Users\\gzachou\\cernbox\\Technical_studentship\\Projects\\steam-material-library\\tests_GetDP\\input_test.csv', delimiter=',', header=0) + cls.df = pd.read_csv(Path('tests') / 'getdp' / 'input_test.csv') + + # Create the "outputs" folder + cls.pro_template_path = Path.cwd() / 'tests' / 'getdp' + cls.cerngetdp_path = Path.cwd() / 'tests' / 'getdp' / 'tmp_cerngetdp' + cls.outputs_folder_msh = cls.pro_template_path / 'Outputs_msh' + cls.outputs_folder_msh.mkdir(parents=True, exist_ok=True) + cls.outputs_folder_txt = cls.pro_template_path / 'Outputs_txt' + cls.outputs_folder_txt.mkdir(parents=True, exist_ok=True) + cls.outputs_folder_pro = cls.pro_template_path / 'Outputs_pro' + cls.outputs_folder_pro.mkdir(parents=True, exist_ok=True) - # df = pd.read_csv(r'C:\\Users\\gzachou\\cernbox\\Technical_studentship\\Projects\\steam-material-library\\tests_GetDP\\input_test.csv', delimiter=',', header=0) - df = pd.read_csv(r'tests\getdp\input_test.csv') - - # Create the "outputs" folder - cwd = os.getcwd() - pro_template_path = os.path.join(cwd, r'tests\getdp') - cerngetdp_path = os.path.join(cwd, r'tests\getdp\tmp_cerngetdp') - outputs_folder_msh = create_outputs_folder(pro_template_path, "Outputs_msh") - outputs_folder_txt = create_outputs_folder(pro_template_path, "Outputs_txt") - outputs_folder_pro = create_outputs_folder(pro_template_path, "Outputs_pro") def test_cfun(self): - cerngetdp_path = os.path.join(self.cwd, "tests\\getdp\\tmp_cerngetdp") + cerngetdp_path = Path.cwd() / 'tests' / 'getdp' / 'tmp_cerngetdp' if os.path.exists(cerngetdp_path): shutil.rmtree(cerngetdp_path) @@ -143,7 +136,7 @@ class GetDP_tests(unittest.TestCase): else: result_2d = np.vstack(input_var_vals_2d) - sm = STEAM_materials(function_name, result_2d.shape[0], result_2d.shape[1], matpath) + sm = SteamMaterials(function_name, result_2d.shape[0], result_2d.shape[1]) @@ -182,7 +175,3 @@ class GetDP_tests(unittest.TestCase): except AssertionError as e: print(f"Function {function_name} failed. Error: {e}") - -GetDP_Test = GetDP_tests() -GetDP_Test.test_cfun() - diff --git a/tests/matlab/compare_mat_pro/test_cpr_Cpp_Matlab.py b/tests/matlab/compare_mat_pro/test_cpr_Cpp_Matlab.py index a827d5be3d0600cdf0b422528984a054a5063fcf..98a17a716e557930d9ae172ce7f6df4dac4650c1 100644 --- a/tests/matlab/compare_mat_pro/test_cpr_Cpp_Matlab.py +++ b/tests/matlab/compare_mat_pro/test_cpr_Cpp_Matlab.py @@ -2,7 +2,7 @@ import unittest import os import numpy as np -from bindings.python.STEAM_mat import STEAM_materials, STEAM_materials_Matlab +from bindings.python.src.steammaterials import SteamMaterials class TestBuilderLEDET(unittest.TestCase): @@ -16,7 +16,6 @@ class TestBuilderLEDET(unittest.TestCase): print('\nCurrent folder: {}'.format(self.current_path)) print('\nTest is run from folder: {}'.format(os.getcwd())) - self.path_library_Cpp = r'G:\Projects\lhccm\STEAM\MaterialsLibrary\V0.1' self.path_library_Matlab = r'C:\cernbox\steam-ledet-material-library' def tearDown(self) -> None: @@ -28,10 +27,10 @@ class TestBuilderLEDET(unittest.TestCase): def test_Cpp_function_1arg(self): """ - Compare teh output of one function with one argument + Compare the output of one function with one argument """ # arrange - function_Cpp = 'CFUN_rhoCuNIST' # function name, this one takes 4 arguments as input and returns a single float for resistivity + function_Cpp = 'CFUN_rhoCu_v1' # function name, this one takes 4 arguments as input and returns a single float for resistivity expected_output = [1.603168309364817e-10, 2.8154110271157387e-10, 1.4926699252833116e-09, 3.758699930591927e-09, 6.179156760168926e-09, 8.491840943360736e-09, 1.073302888748694e-08, 1.2948228439992961e-08, 1.516281083675451e-08, 1.738937005100772e-08] # act @@ -47,7 +46,7 @@ class TestBuilderLEDET(unittest.TestCase): numpy2d = np.vstack((T, np.ones(num_elem) * B, np.ones(num_elem) * RRR, np.ones(num_elem) * T_ref_RRR)) #print(numpy2d) # make dll func object - sm = STEAM_materials(function_Cpp, numpy2d.shape[0], numpy2d.shape[1], self.path_library_Cpp) + sm = SteamMaterials(function_Cpp, numpy2d.shape[0], numpy2d.shape[1]) # call with 2D numpy array and get results back result_Cpp = sm.evaluate(numpy2d) @@ -58,7 +57,7 @@ class TestBuilderLEDET(unittest.TestCase): def test_bhiron1_v1_inter_extra(self): - function_Cpp = 'BHIron1_v1' + function_Cpp = 'BHIron2_v1' num_elem = 10 x = np.linspace(0, 5000000, num_elem) expected_output = [0.0, 2.8354114125541225, 3.534787990907976, 4.233391566651791, 4.931798446918102, 5.629902497142767, @@ -66,7 +65,7 @@ class TestBuilderLEDET(unittest.TestCase): # make numpy array print(x) numpy2d = np.vstack((x, np.ones(num_elem), np.ones(num_elem), np.ones(num_elem))) - sm = STEAM_materials(function_Cpp, numpy2d.shape[0], numpy2d.shape[1], self.path_library_Cpp) + sm = SteamMaterials(function_Cpp, numpy2d.shape[0], numpy2d.shape[1]) # call with 2D numpy array and get results back result_Cpp = sm.evaluate(numpy2d) @@ -84,7 +83,7 @@ class TestBuilderLEDET(unittest.TestCase): # make numpy array print(x) numpy2d = np.vstack((x, np.ones(num_elem), np.ones(num_elem), np.ones(num_elem))) - sm = STEAM_materials(function_Cpp, numpy2d.shape[0], numpy2d.shape[1], self.path_library_Cpp) + sm = SteamMaterials(function_Cpp, numpy2d.shape[0], numpy2d.shape[1]) # call with 2D numpy array and get results back result_Cpp = sm.evaluate(numpy2d) @@ -97,7 +96,7 @@ class TestBuilderLEDET(unittest.TestCase): Compare teh output of one function with one argument """ # arrange - function_Cpp = 'CFUN_rhoCuNIST' # function name, this one takes 4 arguments as input and returns a single float for resistivity + function_Cpp = 'CFUN_rhoCu_v1' # function name, this one takes 4 arguments as input and returns a single float for resistivity # act T_min = 1.8 @@ -113,13 +112,13 @@ class TestBuilderLEDET(unittest.TestCase): # make dll func object - sm = STEAM_materials(function_Cpp, numpy2d.shape[0], numpy2d.shape[1], self.path_library_Cpp) + sm = SteamMaterials(function_Cpp, numpy2d.shape[0], numpy2d.shape[1]) # call with 2D numpy array and get results back result_Cpp = sm.evaluate(numpy2d) print(result_Cpp) - #results_Matlab = STEAM_materials_Matlab(function_Matlab, numpy2d.shape[0], numpy2d.shape[1], self.path_library_Matlab) + #results_Matlab = SteamMaterials_Matlab(function_Matlab, numpy2d.shape[0], numpy2d.shape[1], self.path_library_Matlab) #print(results_Matlab) # assert