From 29066afba593353febbb1fd3512465a08ea45839 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 16 Dec 2024 18:51:18 +0100 Subject: [PATCH] var names --- pyXSteam/Tables.py | 2 - tests/test_Regions.py | 106 +++++++++++++++++++++++------------------- 2 files changed, 58 insertions(+), 50 deletions(-) diff --git a/pyXSteam/Tables.py b/pyXSteam/Tables.py index 0cc9a59..b382a21 100644 --- a/pyXSteam/Tables.py +++ b/pyXSteam/Tables.py @@ -1049,7 +1049,6 @@ class Sub_psh12: class Sub_psh3: """class with table data from SUB psh12""" - # TODO check table 3! Table3_I = [0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 6, 7, 8, 10, 10, 14, 18, 20, 22, 22, 24, 28, 28, 32, 32] Table3_J = [0, 1, 5, 0, 3, 4, 8, 14, 6, 16, 0, 2, 3, 0, 1, 4, 5, 28, 28, 24, 1, 32, 36, 22, 28, 36, 16, 28, 36, 16, 36, 10, 28] Table3_n = [ @@ -1088,7 +1087,6 @@ class Sub_psh3: 3.77121605943324e40, ] - # TODO check table 4! Table4_I = [ -12, -12, diff --git a/tests/test_Regions.py b/tests/test_Regions.py index 3ea23c8..67f9af3 100644 --- a/tests/test_Regions.py +++ b/tests/test_Regions.py @@ -11,10 +11,12 @@ class Region1Tester(unittest.TestCase): + """tests for functions in region 1""" + def setUp(self): - self.maxError = 1e-8 + self.max_error = 1e-8 # The accumulated Error is bigger than the error of each single function - self.maxMatrixError = 2e-8 + self.max_matrix_error = 2e-8 def tearDown(self): pass @@ -46,9 +48,9 @@ def test_pT_functions(self): Region1_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess( Region1_error, - self.maxMatrixError, + self.max_matrix_error, "Test of p,T Functions for Region 1 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": Region1_error, "max": self.maxMatrixError}, + " %(max)e" % {"error": Region1_error, "max": self.max_matrix_error}, ) def test_ph_function(self): @@ -64,9 +66,9 @@ def test_ph_function(self): T1_ph_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess( T1_ph_error, - self.maxError, + self.max_error, "Test of T(p,h) Function for Region 1 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": T1_ph_error, "max": self.maxError}, + " %(max)e" % {"error": T1_ph_error, "max": self.max_error}, ) def test_ps_function(self): @@ -82,9 +84,9 @@ def test_ps_function(self): T1_ps_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess( T1_ps_error, - self.maxError, + self.max_error, "Test of T(p,s) Function for Region 1 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": T1_ps_error, "max": self.maxError}, + " %(max)e" % {"error": T1_ps_error, "max": self.max_error}, ) def test_hs_function(self): @@ -102,17 +104,19 @@ def test_hs_function(self): p1_hs_error = numpy.sum(numpy.absolute((R1 - IF97) / IF97)) self.assertLess( p1_hs_error, - self.maxError, + self.max_error, "Test of p(h,s) Function for Region 1 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": p1_hs_error, "max": self.maxError}, + " %(max)e" % {"error": p1_hs_error, "max": self.max_error}, ) class Region2Tester(unittest.TestCase): + """tests for functions in region 2""" + def setUp(self): - self.maxError = 1e-8 + self.max_error = 1e-8 # The accumulated Error is bigger than the error of each single function - self.maxMatrixError = 2e-8 + self.max_matrix_error = 2e-8 def tearDown(self): pass @@ -145,9 +149,9 @@ def test_pT_function(self): Region2_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97)) self.assertLess( Region2_error, - self.maxMatrixError, + self.max_matrix_error, "Test of p,T Functions for Region 2 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": Region2_error, "max": self.maxMatrixError}, + " %(max)e" % {"error": Region2_error, "max": self.max_matrix_error}, ) def test_pT_meta_function(self): @@ -177,9 +181,9 @@ def test_pT_meta_function(self): Region2_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97)) self.assertLess( Region2_error, - self.maxMatrixError, + self.max_matrix_error, "Test of p,T Functions for Region 2 in the metastable-vapor region failed. Error was %(error)e allowed:" - " %(max)e" % {"error": Region2_error, "max": self.maxMatrixError}, + " %(max)e" % {"error": Region2_error, "max": self.max_matrix_error}, ) def test_ph_function(self): @@ -214,9 +218,9 @@ def test_ph_function(self): T2_ph_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97)) self.assertLess( T2_ph_error, - self.maxMatrixError, + self.max_matrix_error, "Test of ph Function for Region 2 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": T2_ph_error, "max": self.maxMatrixError}, + " %(max)e" % {"error": T2_ph_error, "max": self.max_matrix_error}, ) def test_ps_function(self): @@ -241,9 +245,9 @@ def test_ps_function(self): T2_ps_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97)) self.assertLess( T2_ps_error, - self.maxMatrixError, + self.max_matrix_error, "Test of ps Function for Region 2 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": T2_ps_error, "max": self.maxMatrixError}, + " %(max)e" % {"error": T2_ps_error, "max": self.max_matrix_error}, ) def test_hs_function(self): @@ -269,17 +273,19 @@ def test_hs_function(self): p2_hs_error = numpy.sum(numpy.absolute((R2 - IF97) / IF97)) self.assertLess( p2_hs_error, - self.maxError, + self.max_error, "Test of hs Function for Region 2 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": p2_hs_error, "max": self.maxError}, + " %(max)e" % {"error": p2_hs_error, "max": self.max_error}, ) class Region3Tester(unittest.TestCase): + """tests for functions in region 3""" + def setUp(self): - self.maxError = 1e-8 + self.max_error = 1e-8 # The accumulated Error is bigger than the error of each single function - self.maxMatrixError = 2e-8 + self.max_matrix_error = 2e-8 def tearDown(self): pass @@ -313,9 +319,9 @@ def test_rhoT_function(self): Region3_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97)) self.assertLess( Region3_error, - self.maxMatrixError, + self.max_matrix_error, "Test of rhoT Function for Region 3 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": Region3_error, "max": self.maxMatrixError}, + " %(max)e" % {"error": Region3_error, "max": self.max_matrix_error}, ) def test_T_ph_function(self): @@ -337,9 +343,9 @@ def test_T_ph_function(self): T3_ph_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97)) self.assertLess( T3_ph_error, - self.maxError, + self.max_error, "Test of T(p,h) Function for Region 3 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": T3_ph_error, "max": self.maxError}, + " %(max)e" % {"error": T3_ph_error, "max": self.max_error}, ) def test_v_ph_function(self): @@ -384,9 +390,9 @@ def test_T_ps_function(self): T3_ps_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97)) self.assertLess( T3_ps_error, - self.maxError, + self.max_error, "Test of T(p,s) Function for Region 3 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": T3_ps_error, "max": self.maxError}, + " %(max)e" % {"error": T3_ps_error, "max": self.max_error}, ) def test_v_ps_function(self): @@ -408,9 +414,9 @@ def test_v_ps_function(self): v3_ps_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97)) self.assertLess( v3_ps_error, - self.maxError, + self.max_error, "Test of v(p,s) Function for Region 3 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": v3_ps_error, "max": self.maxError}, + " %(max)e" % {"error": v3_ps_error, "max": self.max_error}, ) def test_hs_function(self): @@ -432,9 +438,9 @@ def test_hs_function(self): p3_hs_error = numpy.sum(numpy.absolute((R3 - IF97) / IF97)) self.assertLess( p3_hs_error, - self.maxError, + self.max_error, "Test of p(h,s) Function for Region 3 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": p3_hs_error, "max": self.maxError}, + " %(max)e" % {"error": p3_hs_error, "max": self.max_error}, ) def test_pT_function(self): @@ -455,10 +461,12 @@ def test_pT_function(self): class Region4Tester(unittest.TestCase): + """tests for functions in region 4""" + def setUp(self): - self.maxError = 1e-7 + self.max_error = 1e-7 # The accumulated Error is bigger than the error of each single function - self.maxMatrixError = 2e-8 + self.max_matrix_error = 2e-8 def tearDown(self): pass @@ -474,9 +482,9 @@ def test_T_function(self): p4_t_error = numpy.sum(numpy.absolute((R4 - IF97) / IF97)) self.assertLess( p4_t_error, - self.maxError, + self.max_error, "Test of p(T) Function for Region 4 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": p4_t_error, "max": self.maxError}, + " %(max)e" % {"error": p4_t_error, "max": self.max_error}, ) def test_p_functions(self): @@ -489,9 +497,9 @@ def test_p_functions(self): T4_p_error = numpy.sum(numpy.absolute((R4 - IF97) / IF97)) self.assertLess( T4_p_error, - self.maxError, + self.max_error, "Test of T(p) Function for Region 4 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": T4_p_error, "max": self.maxError}, + " %(max)e" % {"error": T4_p_error, "max": self.max_error}, ) def test_s_functions(self): @@ -517,17 +525,19 @@ def test_s_functions(self): h4_s_error = numpy.sum(numpy.absolute((R4 - IF97) / IF97)) self.assertLess( h4_s_error, - self.maxError, + self.max_error, "Test of h(s) Function for Region 4 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": h4_s_error, "max": self.maxError}, + " %(max)e" % {"error": h4_s_error, "max": self.max_error}, ) class Region5Tester(unittest.TestCase): + """tests for functions in region 5""" + def setUp(self): - self.maxError = 1e-8 + self.max_error = 1e-8 # The accumulated Error is bigger than the error of each single function - self.maxMatrixError = 2e-8 + self.max_matrix_error = 2e-8 def tearDown(self): pass @@ -557,9 +567,9 @@ def test_pT_function(self): Region5_error = numpy.sum(numpy.absolute((R5 - IF97) / IF97)) self.assertLess( Region5_error, - self.maxMatrixError, + self.max_matrix_error, "Test of p,T Function for Region 5 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": Region5_error, "max": self.maxMatrixError}, + " %(max)e" % {"error": Region5_error, "max": self.max_matrix_error}, ) def test_ph_function(self): @@ -574,9 +584,9 @@ def test_ph_function(self): T5_ph_error = numpy.sum(numpy.absolute((R5 - IF97) / IF97)) self.assertLess( T5_ph_error, - self.maxError, + self.max_error, "Test of T(p,h) Function for Region 5 failed. Error was %(error)e allowed:" - " %(max)e" % {"error": T5_ph_error, "max": self.maxError}, + " %(max)e" % {"error": T5_ph_error, "max": self.max_error}, ) def test_ps_function(self):