diff --git a/chemicals/temperature.py b/chemicals/temperature.py index 7d22de2..8a60ce9 100644 --- a/chemicals/temperature.py +++ b/chemicals/temperature.py @@ -36,7 +36,7 @@ """ - +from fluids.numerics import splev, implementation_optimize_tck __all__ = ['T_converter', 'T_scales', 'ITS90_68_difference', 'Ts_68', 'diffs_68', 'Ts_48', 'diffs_48', 'Ts_76', 'diffs_76', 'Ts_27', 'diffs_27'] @@ -159,30 +159,93 @@ -16.6, -18.3, -19.9, -21.7, -23.7, -25.7, -27.9, -30.1, -32.4, -35.1] -built_splines_90_68 = False - -def build_splines(): - global built_splines_90_68 - global T68_to_T90, T48_to_T90, T76_to_T90, T27_to_T90 - global T90_to_T68, T90_to_T48, T90_to_T76, T90_to_T27 - import numpy as np - from scipy.interpolate import UnivariateSpline - - Ts_90_from_68 = np.array(Ts_68) + diffs_68 - Ts_90_from_48 = np.array(Ts_48) + diffs_48 - Ts_90_from_76 = np.array(Ts_76) + diffs_76 - Ts_90_from_27 = np.array(Ts_27) + diffs_27 +'''# The following code is autogenerated from the following. +import numpy as np +from scipy.interpolate import splrep + +# Generate spline representations +t68_to_90_spline = splrep(Ts_68, Ts_90_from_68) +t90_to_68_spline = splrep(Ts_90_from_68, Ts_68) +t48_to_90_spline = splrep(Ts_48, Ts_90_from_48) +t90_to_48_spline = splrep(Ts_90_from_48, Ts_48) +t76_to_90_spline = splrep(Ts_76, Ts_90_from_76) +t90_to_76_spline = splrep(Ts_90_from_76, Ts_76) +t27_to_90_spline = splrep(Ts_27, Ts_90_from_27) +t90_to_27_spline = splrep(Ts_90_from_27, Ts_27) + +# Print each spline in your format +def print_spline(name, tck): + print(f"{name}_tck = implementation_optimize_tck([") + print(f" {tck[0].tolist()!r},") + print(f" {tck[1].tolist()!r},") + print(f" {tck[2]}") + print("])") + print(f"{name} = lambda x : float(splev(x, {name}_tck))\n") + +print_spline("T68_to_T90", t68_to_90_spline) +print_spline("T90_to_T68", t90_to_68_spline) +print_spline("T48_to_T90", t48_to_90_spline) +print_spline("T90_to_T48", t90_to_48_spline) +print_spline("T76_to_T90", t76_to_90_spline) +print_spline("T90_to_T76", t90_to_76_spline) +print_spline("T27_to_T90", t27_to_90_spline) +print_spline("T90_to_T27", t90_to_27_spline)''' +T68_to_T90_tck = implementation_optimize_tck([ + [14.0, 14.0, 14.0, 14.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0, 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0, 110.0, 120.0, 130.0, 140.0, 150.0, 160.0, 170.0, 180.0, 190.0, 200.0, 210.0, 220.0, 230.0, 240.0, 250.0, 260.0, 270.0, 273.15, 280.0, 290.0, 300.0, 310.0, 320.0, 330.0, 340.0, 350.0, 360.0, 370.0, 380.0, 390.0, 400.0, 410.0, 420.0, 430.0, 440.0, 450.0, 460.0, 470.0, 480.0, 490.0, 500.0, 510.0, 520.0, 530.0, 540.0, 550.0, 560.0, 570.0, 580.0, 590.0, 600.0, 610.0, 620.0, 630.0, 640.0, 650.0, 660.0, 670.0, 680.0, 690.0, 700.0, 710.0, 720.0, 730.0, 740.0, 750.0, 760.0, 770.0, 780.0, 790.0, 800.0, 810.0, 820.0, 830.0, 840.0, 850.0, 860.0, 870.0, 880.0, 890.0, 900.0, 903.89, 910.0, 920.0, 930.0, 940.0, 950.0, 960.0, 970.0, 980.0, 990.0, 1000.0, 1010.0, 1020.0, 1030.0, 1040.0, 1050.0, 1060.0, 1070.0, 1080.0, 1090.0, 1100.0, 1110.0, 1120.0, 1130.0, 1140.0, 1150.0, 1160.0, 1170.0, 1180.0, 1190.0, 1200.0, 1210.0, 1220.0, 1230.0, 1235.08, 1240.0, 1250.0, 1260.0, 1270.0, 1280.0, 1290.0, 1300.0, 1310.0, 1320.0, 1330.0, 1337.58, 1340.0, 1350.0, 1360.0, 1400.0, 1500.0, 1600.0, 1700.0, 1800.0, 1900.0, 2000.0, 2100.0, 2200.0, 2300.0, 2400.0, 2500.0, 2600.0, 2700.0, 2800.0, 2900.0, 3000.0, 3100.0, 3200.0, 3300.0, 3400.0, 3500.0, 3600.0, 3700.0, 3800.0, 3900.0, 4000.0, 4100.0, 4300.0, 4300.0, 4300.0, 4300.0], + [13.994000000000003, 14.664790251296571, 15.663419497406867, 16.994037420556374, 17.99177633958026, 18.9908572211226, 19.99079477592933, 20.991963675160104, 21.993350523430262, 22.992634231118842, 23.994112552094368, 24.99491556050371, 25.996225205890855, 26.996183615932868, 27.995040330377638, 28.993655062556602, 29.99433941939599, 30.992987259859497, 31.991711541166012, 32.992166575476475, 33.99162215692805, 34.993344796811286, 35.99299865582683, 36.992660579881395, 37.99435902464761, 38.9939033215282, 39.994027689239566, 40.99398592151358, 41.994028624706154, 42.99389957966182, 43.99437305664659, 44.99260819375181, 45.99319416834621, 46.99261513286339, 47.99434530020029, 48.99400366633542, 49.99364003445805, 50.99543619583239, 51.99461518221241, 52.99610307531803, 53.996972516515456, 54.998006858620165, 55.99900004900385, 56.9999929453645, 58.001028169538166, 59.00189437648283, 60.003394324530504, 61.00252832539512, 62.00449237388906, 63.003502179048596, 64.00549890991661, 65.00450218128493, 66.00649236494368, 67.00552835894038, 68.00739419929475, 69.00689484388062, 70.00702642518287, 71.00699945538786, 72.00697575326578, 73.00709753154905, 74.00663412053805, 75.00836598629878, 76.00790193426681, 77.00802627663401, 78.00799295919713, 79.00800188657752, 80.00799949449284, 81.00800013545114, 82.00799996370263, 83.00800000973831, 84.00799999734409, 85.00800000088532, 86.00799999911457, 87.00800000265636, 88.00799999026003, 89.00800003630353, 90.00799986452591, 91.00800050559293, 92.00799811310243, 93.0080070419973, 94.00797371890833, 95.00809808236934, 96.0076339516143, 97.00936611117352, 98.00890160369161, 99.00902747406013, 103.0088715780913, 110.01125524445376, 120.01312901539193, 130.01422869397862, 140.01395620869377, 150.01394647124627, 160.01425790632132, 170.0130219034685, 180.01165447980466, 190.01236017731318, 200.01090481094255, 210.01002057891685, 220.0090128733899, 230.00792792752372, 240.00727541651565, 250.0049704064138, 260.0028429578291, 267.71859504858935, 274.3827416701131, 281.04941698639766, 289.9954211887045, 299.99442947804965, 309.99086089909684, 319.98812692556294, 329.9846313986516, 339.98334747983097, 349.979978682025, 359.97673779206946, 369.9750701496972, 379.97298160914187, 389.97100341373545, 399.96900473591603, 409.9669776426007, 419.9650846936809, 429.96268358267554, 439.9621809756168, 449.960592514857, 459.9614489649556, 469.95961162532075, 479.96010453376135, 489.9599702396339, 499.96001450770336, 509.9599717295527, 519.9600985740863, 529.9596339741025, 539.9613655295043, 549.96090390788, 559.9610188389757, 569.961020736216, 579.9608982161603, 589.9613863991427, 599.959556187269, 609.9603888517821, 619.9588884056028, 629.958057525807, 639.9568814911692, 649.9564165095157, 659.9534524707681, 669.9537736074117, 679.9494530995853, 689.948413994247, 699.9448909234263, 709.9420223120485, 719.9390198283797, 729.9358983744321, 739.933386673892, 749.9285549300002, 759.9263936061074, 769.9218706455703, 779.9181238116109, 789.9136341079854, 799.9113397564482, 809.9070068662207, 819.902632778669, 829.900462019104, 839.895519144915, 849.8934614012358, 859.8886352501414, 869.8859975981978, 879.883374357068, 889.87850497353, 897.8403258909135, 904.5040436375672, 911.1760752641405, 919.9048333231759, 929.9050460141879, 939.9349826200732, 949.9350235055184, 959.964923357854, 969.9652830630658, 979.9939443898843, 989.9989393773964, 1000.0102981005301, 1010.019868220484, 1020.0302290175342, 1030.0392157093793, 1040.05290814495, 1050.0491517108198, 1060.0504850117711, 1070.0489082420963, 1080.053882019843, 1090.0355636785318, 1100.0438632660287, 1110.0289832573544, 1120.0202037045533, 1130.0102019244337, 1139.998988597712, 1149.9938436847183, 1159.9656366634163, 1169.963609661618, 1179.939924690113, 1189.916691577932, 1199.9133089981601, 1209.890072429428, 1219.8664012841275, 1228.2246633654713, 1234.8769076709664, 1241.5281783775818, 1249.8347751832898, 1259.8060399812725, 1269.8010648916215, 1279.7897004522392, 1289.780133299421, 1299.7697663500783, 1309.7608013002643, 1319.7470284488645, 1328.9440910168737, 1335.609647463711, 1342.2774281118718, 1349.735879953996, 1369.7454949274265, 1419.7179743076954, 1499.6953076487778, 1599.635128432465, 1699.6041786213625, 1799.5481570820848, 1899.5031930502985, 1999.4390707167224, 2099.380524082808, 2199.3188329520467, 2299.264144109009, 2399.1845906119192, 2499.137493443318, 2599.045435614806, 2698.9807640974577, 2798.911507995357, 2898.8332039211127, 2998.7356763201924, 3098.664090798113, 3198.5679604873553, 3298.484067252461, 3398.375770502797, 3498.2928507363476, 3598.192826551809, 3698.075843056416, 3797.9838012225227, 3897.868952053488, 3997.760390563517, 4130.945850735434, 4230.839574632283, 4297.42, 0.0, 0.0, 0.0, 0.0], + 3 +]) +T68_to_T90 = lambda x : float(splev(x, T68_to_T90_tck)) + +T90_to_T68_tck = implementation_optimize_tck([ + [13.994, 13.994, 13.994, 13.994, 15.996, 16.994, 17.992, 18.991, 19.991, 20.992, 21.993, 22.993, 23.994, 24.995, 25.996, 26.996, 27.995, 28.994, 29.994, 30.993, 31.992, 32.992, 33.992, 34.993, 35.993, 36.993, 37.994, 38.994, 39.994, 40.994, 41.994, 42.994, 43.994, 44.993, 45.993, 46.993, 47.994, 48.994, 49.994, 50.995, 51.995, 52.996, 53.997, 54.998, 55.999, 57.0, 58.001, 59.002, 60.003, 61.003, 62.004, 63.004, 64.005, 65.005, 66.006, 67.006, 68.007, 69.007, 70.007, 71.007, 72.007, 73.007, 74.007, 75.008, 76.008, 77.008, 78.008, 79.008, 80.008, 81.008, 82.008, 83.008, 84.008, 85.008, 86.008, 87.008, 88.008, 89.008, 90.008, 91.008, 92.008, 93.008, 94.008, 95.008, 96.008, 97.009, 98.009, 99.009, 100.009, 110.011, 120.013, 130.014, 140.014, 150.014, 160.014, 170.013, 180.012, 190.012, 200.011, 210.01, 220.009, 230.008, 240.007, 250.005, 260.003, 270.001, 273.15, 279.999, 289.996, 299.994, 309.991, 319.988, 329.985, 339.983, 349.98, 359.977, 369.975, 379.973, 389.971, 399.969, 409.967, 419.965, 429.963, 439.962, 449.961, 459.961, 469.96, 479.96, 489.96, 499.96, 509.96, 519.96, 529.96, 539.961, 549.961, 559.961, 569.961, 579.961, 589.961, 599.96, 609.96, 619.959, 629.958, 639.957, 649.956, 659.954, 669.953, 679.95, 689.948, 699.945, 709.942, 719.939, 729.936, 739.933, 749.929, 759.926, 769.922, 779.918, 789.914, 799.911, 809.907, 819.903, 829.9, 839.896, 849.893, 859.889, 869.886, 879.883, 889.879, 899.876, 903.765, 909.88, 919.9, 929.91, 939.93, 949.94, 959.96, 969.97, 979.99, 990.0, 1000.01, 1010.02, 1020.03, 1030.04, 1040.05, 1050.05, 1060.05, 1070.05, 1080.05, 1090.04, 1100.04, 1110.03, 1120.02, 1130.01, 1140.0, 1149.99, 1159.97, 1169.96, 1179.94, 1189.92, 1199.91, 1209.89, 1219.87, 1229.86, 1234.9299999999998, 1239.84, 1249.83, 1259.81, 1269.8, 1279.79, 1289.78, 1299.77, 1309.76, 1319.75, 1329.75, 1337.33, 1339.75, 1349.74, 1359.74, 1399.73, 1499.69, 1599.64, 1699.6, 1799.55, 1899.5, 1999.44, 2099.38, 2199.32, 2299.26, 2399.19, 2499.13, 2599.05, 2698.98, 2798.91, 2898.83, 2998.74, 3098.66, 3198.57, 3298.48, 3398.38, 3498.29, 3598.19, 3698.08, 3797.98, 3897.87, 3997.76, 4097.65, 4297.42, 4297.42, 4297.42, 4297.42], + [13.999999999999998, 14.663213783731901, 15.664574313049924, 16.999962927118506, 18.00055784969119, 19.000476363195446, 20.00053816960056, 21.000036355766785, 21.999316479971164, 23.000698744444616, 23.99988741555301, 25.000084434339747, 25.999441949847625, 26.999482564669265, 27.999959728251447, 29.000678602949073, 29.99932690677507, 31.000012761684967, 32.00062202093615, 32.99983344661878, 34.00071088876699, 34.99932219892024, 36.00000134626136, 37.000672413341896, 37.999307980437145, 39.00009654777605, 39.999972343431175, 41.00001407849923, 41.99997134257193, 43.00010055121314, 43.99929327727504, 45.000725420520475, 45.999805828756266, 47.00071792849435, 47.99932169201748, 48.99999634567202, 50.00069293260305, 50.999230852430266, 52.0007178029208, 52.99989688521837, 54.00002749400801, 54.99999313874954, 55.99999995099391, 57.00000705727483, 57.999971819906705, 59.00010566309832, 59.99927269391235, 61.00080458852838, 61.99917470442075, 63.00083073793073, 63.999168172496944, 65.00083073799951, 65.99917471503564, 67.00080458955975, 67.99927284252122, 69.0001050116993, 69.99997361112497, 71.00000054380082, 72.0000242136717, 72.99990260151249, 74.00069886787135, 74.99930102529277, 76.00009793191995, 76.99997375922113, 78.00000703119554, 78.99999811599676, 80.0000005048174, 80.9999998647337, 82.00000003624784, 82.999999990275, 84.0000000026523, 84.99999999911587, 86.00000000088424, 86.99999999734727, 88.00000000972669, 88.99999996374599, 90.00000013528927, 90.9999994950969, 92.0000018843231, 92.99999296761071, 94.00002624523408, 94.99990205145303, 96.00069903678613, 96.99930090028707, 98.00009826274085, 98.99997256079118, 103.00079498662593, 109.99974478062036, 119.99953773739016, 129.99943798665967, 140.000043782461, 150.00005354108126, 159.99940873026353, 169.99997809665427, 180.00067888750067, 189.9993064540778, 200.00009518519246, 209.99997942330228, 219.9999871215983, 230.00007209030466, 239.99939116209947, 250.00002958286422, 260.0001570962616, 267.71607145712505, 274.38392515458196, 281.0489161143118, 290.0009123650845, 299.99923700330794, 310.00013912257685, 319.99987305406006, 330.00070211107106, 339.9993190165971, 350.0000213223914, 360.0005956895719, 369.9999298254636, 380.00001839750195, 389.9999965845281, 399.99999526438614, 410.00002235792726, 419.9999153039049, 430.0006498398394, 439.99981900889463, 450.0007408609552, 459.99921766124845, 470.0007217456371, 479.99989545181836, 490.00002976399077, 499.99998549221885, 510.0000282671347, 519.999901439242, 530.0006993247149, 539.9993011718149, 550.0000960784565, 559.9999811656406, 569.9999792589812, 580.000101798434, 589.9992802302243, 600.0007771850977, 609.9992777791889, 620.000111592472, 629.999942467571, 640.0001185372433, 649.9992500346249, 660.0008810229541, 669.9985594378766, 680.0008804254521, 689.999252496333, 700.0001090914669, 709.9999776869922, 719.9999801605652, 730.0001016707458, 739.999279739378, 750.0007786758189, 759.9992728069769, 770.0001293882311, 779.9998761559341, 790.0006994710877, 799.9993266749696, 809.999993132088, 820.000700798053, 829.9992043671493, 840.0008144736668, 849.9992049884438, 860.0006983320324, 870.000002393586, 879.999292094102, 890.0008285179302, 897.963007640012, 904.6329571046689, 911.3022476307158, 919.9918461389295, 930.0082747256582, 939.991696541357, 950.0082973826469, 959.9917556846797, 970.0080383867636, 979.9927332889569, 990.0010581205704, 999.9997025627061, 1010.0001316286047, 1019.9997709228757, 1030.00078467989, 1039.993761584443, 1050.0008472291602, 1059.9995149152307, 1070.0010931099173, 1079.9927809719218, 1090.0077735304371, 1099.9927999292656, 1110.001016298633, 1119.9997965785485, 1129.999797387176, 1140.0010138727478, 1149.9928120757036, 1160.0077082678492, 1169.9930467559052, 1180.0000753387333, 1190.0066517381815, 1199.9933476825627, 1209.999927553492, 1220.0069422486533, 1228.3553289141419, 1235.026425236796, 1241.6984970872052, 1249.9918794335092, 1260.0073044461362, 1269.9989325813053, 1280.0003002180092, 1289.999866546658, 1300.0002335953584, 1309.9991990719082, 1320.006308045286, 1329.1925744801713, 1335.8603531105314, 1342.522571199137, 1350.0074574663145, 1369.9911660487214, 1420.0020281646555, 1499.9913548320744, 1600.0082087111377, 1699.9924845876394, 1800.0018438190882, 1899.9934701014838, 2000.0009297078693, 2099.999475594953, 2200.00116791232, 2299.992517598515, 2400.008748675256, 2499.985830024165, 2600.0079033771967, 2699.9992352904937, 2799.9951553077776, 2899.993456971568, 3000.007663582811, 3099.992569468585, 3200.002041347341, 3299.9925924692266, 3400.0075699456906, 3499.9938103646778, 3599.9938333281452, 3700.007498210966, 3799.9928579317107, 3900.0010489707106, 3999.9996090194445, 4133.330813227925, 4233.323747871463, 4300.0, 0.0, 0.0, 0.0, 0.0], + 3 +]) +T90_to_T68 = lambda x : float(splev(x, T90_to_T68_tck)) + +T48_to_T90_tck = implementation_optimize_tck([ + [93.15, 93.15, 93.15, 93.15, 113.15, 123.15, 133.15, 143.15, 153.15, 163.15, 173.15, 183.15, 193.15, 203.15, 213.15, 223.15, 233.15, 243.15, 253.15, 263.15, 273.15, 283.15, 293.15, 303.15, 313.15, 323.15, 333.15, 343.15, 353.15, 363.15, 373.15, 383.15, 393.15, 403.15, 413.15, 423.15, 433.15, 443.15, 453.15, 463.15, 473.15, 483.15, 493.15, 503.15, 513.15, 523.15, 533.15, 543.15, 553.15, 563.15, 573.15, 583.15, 593.15, 603.15, 613.15, 623.15, 633.15, 643.15, 653.15, 663.15, 673.15, 683.15, 693.15, 703.15, 713.15, 723.15, 733.15, 743.15, 753.15, 763.15, 773.15, 783.15, 793.15, 803.15, 813.15, 823.15, 833.15, 843.15, 853.15, 863.15, 873.15, 883.15, 893.15, 903.15, 913.15, 923.15, 933.15, 943.15, 953.15, 963.15, 973.15, 983.15, 993.15, 1003.15, 1013.15, 1023.15, 1033.15, 1043.15, 1053.15, 1063.15, 1073.15, 1083.15, 1093.15, 1103.15, 1113.15, 1123.15, 1133.15, 1143.15, 1153.15, 1163.15, 1173.15, 1183.15, 1193.15, 1203.15, 1213.15, 1223.15, 1233.15, 1243.15, 1253.15, 1263.15, 1273.15, 1283.15, 1293.15, 1303.15, 1313.15, 1323.15, 1333.15, 1343.15, 1373.15, 1473.15, 1573.15, 1673.15, 1773.15, 1873.15, 1973.15, 2073.15, 2173.15, 2273.15, 2373.15, 2473.15, 2573.15, 2673.15, 2773.15, 2873.15, 2973.15, 3073.15, 3173.15, 3273.15, 3373.15, 3473.15, 3573.15, 3673.15, 3773.15, 3873.15, 3973.15, 4073.15, 4273.15, 4273.15, 4273.15, 4273.15], + [93.17000000000002, 99.83941813042652, 109.82566373914702, 123.14842105794615, 133.14996269936873, 143.15772814457893, 153.16712472231566, 163.17577296615855, 173.1857834130503, 183.19109338164043, 193.1958430603882, 203.1955343768068, 213.1920194323851, 223.18838789365307, 233.18242899300262, 243.17389613433673, 253.16598646965056, 263.15815798706143, 273.149381582104, 283.1443156845225, 293.137355679806, 303.1342615962535, 313.1295979351797, 323.127346663028, 333.12301541270807, 343.1245916861396, 353.1226178427335, 363.1229369429264, 373.12363438556093, 383.1265255148301, 393.12626355511856, 403.13042026469566, 413.1320553860989, 423.1333581909086, 433.13851185026624, 443.1405944080264, 453.1451105176282, 463.148963521461, 473.15303539652825, 483.1568948924259, 493.16138503376834, 503.1635649725009, 513.1683550762286, 523.1710147225853, 533.1735860334297, 543.1786411436962, 553.1798493917861, 563.1819612891591, 573.1843054515782, 583.1848169045275, 593.1864269303119, 603.1854753742244, 613.1876715727906, 623.185838334613, 633.1849750887566, 643.184261310361, 653.1819796697993, 663.1798200104428, 673.1787402884296, 683.1732188358386, 693.1723843682164, 703.1692436912954, 713.1646408666023, 723.1621928422956, 733.1585877642152, 743.1574561008437, 753.1535878324096, 763.1521925695181, 773.1496418895177, 783.1492398724104, 793.1473986208415, 803.1491656442232, 813.1499388022662, 823.1510791467127, 833.157744610883, 843.159942409755, 853.1684857500975, 863.1741145898548, 873.1850558904841, 883.1956618482076, 893.214296716685, 903.2071512850514, 913.3070981431104, 923.3644561425074, 933.4550772868598, 943.5152347100529, 953.6039838729284, 963.6688297982336, 973.7406969341371, 983.8083824652183, 993.8857732049889, 1003.9285247148258, 1013.9801279357083, 1024.0309635423414, 1034.0760178949263, 1044.0849648779554, 1054.1241225932542, 1064.1385447490281, 1074.1616984106345, 1084.174661608436, 1094.1596551556217, 1104.1467177690774, 1114.1534737680693, 1124.1393871586472, 1134.1289775973432, 1144.1247024519812, 1154.0922125947336, 1164.1064471690859, 1174.0819987289237, 1184.1055579152207, 1194.0957696101948, 1204.111363644001, 1214.1187758138024, 1224.1335331007913, 1234.127091783034, 1244.1380997670724, 1254.1605091486763, 1264.1798636382234, 1274.2000362984313, 1284.219991168052, 1294.2399990293604, 1304.2600127145072, 1314.2799501126108, 1324.3001868350523, 1334.3193025471817, 1351.0248032622442, 1397.6544385961433, 1474.605083870049, 1574.6449875287642, 1674.7149660148948, 1774.9951484116546, 1875.0044403384848, 1975.2870902344075, 2075.347198723882, 2175.424114870061, 2275.6563417958782, 2375.850517946427, 2476.041586418415, 2576.283136379912, 2676.325868061937, 2776.5133913723316, 2876.9205664487363, 2976.9043428327204, 3077.162062220379, 3177.3474082857633, 3277.5483046365694, 3377.7593731679585, 3477.914202691589, 3578.2838160656906, 3678.4505330456464, 3778.6140517517247, 3878.9932599474555, 3979.112908458454, 4112.902505472141, 4213.19874726393, 4279.95, 0.0, 0.0, 0.0, 0.0], + 3 +]) +T48_to_T90 = lambda x : float(splev(x, T48_to_T90_tck)) + +T90_to_T48_tck = implementation_optimize_tck([ + [93.17, 93.17, 93.17, 93.17, 113.15700000000001, 123.15, 133.151, 143.15800000000002, 153.167, 163.17600000000002, 173.185, 183.191, 193.195, 203.195, 213.192, 223.18800000000002, 233.18200000000002, 243.174, 253.166, 263.15799999999996, 273.15, 283.144, 293.138, 303.13399999999996, 313.13, 323.12699999999995, 333.12399999999997, 343.12399999999997, 353.123, 363.123, 373.12399999999997, 383.126, 393.12699999999995, 403.13, 413.132, 423.13399999999996, 433.138, 443.14099999999996, 453.145, 463.149, 473.15299999999996, 483.157, 493.161, 503.164, 513.168, 523.1709999999999, 533.174, 543.178, 553.18, 563.182, 573.184, 583.185, 593.1859999999999, 603.1859999999999, 613.187, 623.1859999999999, 633.185, 643.184, 653.182, 663.18, 673.178, 683.174, 693.172, 703.169, 713.165, 723.1619999999999, 733.159, 743.1569999999999, 753.154, 763.1519999999999, 773.15, 783.149, 793.148, 803.149, 813.15, 823.1519999999999, 833.1569999999999, 843.161, 853.168, 863.175, 873.185, 883.197, 893.2099999999999, 903.225, 913.3, 923.37, 933.4499999999999, 943.52, 953.6, 963.67, 973.74, 983.81, 993.88, 1003.93, 1013.98, 1024.03, 1034.0700000000002, 1044.0900000000001, 1054.1200000000001, 1064.14, 1074.16, 1084.17, 1094.16, 1104.15, 1114.15, 1124.14, 1134.13, 1144.1200000000001, 1154.1000000000001, 1164.1000000000001, 1174.0900000000001, 1184.1000000000001, 1194.1000000000001, 1204.1100000000001, 1214.1200000000001, 1224.13, 1234.13, 1244.14, 1254.16, 1264.18, 1274.2, 1284.22, 1294.24, 1304.26, 1314.2800000000002, 1324.3000000000002, 1334.3200000000002, 1344.3400000000001, 1374.3500000000001, 1474.5500000000002, 1574.65, 1674.75, 1774.95, 1875.0500000000002, 1975.25, 2075.35, 2175.4500000000003, 2275.65, 2375.85, 2476.05, 2576.25, 2676.35, 2776.55, 2876.85, 2976.9500000000003, 3077.15, 3177.35, 3277.55, 3377.75, 3477.9500000000003, 3578.25, 3678.4500000000003, 3778.65, 3878.9500000000003, 3979.15, 4079.4500000000003, 4279.95, 4279.95, 4279.95, 4279.95], + [93.15, 99.8095753794073, 109.81667069393511, 123.15424730859756, 133.1530352392868, 143.1509376250642, 153.14987537404545, 163.1502269195702, 173.14821794777072, 183.1492403344089, 193.14782422466547, 203.14846512463708, 213.14964711354065, 223.14894499335773, 233.14890348897356, 243.15010393609015, 253.15001353066276, 263.1498419412588, 273.151285956555, 283.1496841313605, 293.15131165352227, 303.1497382684248, 313.1507356346183, 323.1496533334858, 333.15198487307197, 343.1490748580181, 353.15071555661996, 363.1503963654703, 373.1506988290006, 383.1491413063744, 393.1514028399584, 403.1492465550415, 413.149944671706, 423.1513080591001, 433.14915509096403, 443.15073867480106, 453.14988950965744, 463.1500364694302, 473.1499646126217, 483.1501050800827, 493.14928188332067, 503.15076809189276, 513.1493118351435, 523.1499852767447, 533.1507470608207, 543.1486925940831, 553.1501505220299, 563.1500387316923, 573.14936129599, 583.1501830841139, 593.1492397715987, 603.1508579380173, 613.1486617791518, 623.150161623478, 633.1500249380545, 643.1494052671787, 653.1500203103768, 663.1501800819109, 673.1485926233479, 683.151448252142, 693.1492821222502, 703.1494227459106, 713.1506927057999, 723.149807100294, 733.1507457615189, 743.1492103686672, 753.1507456803782, 763.1498073950817, 773.1506915375159, 783.1497601327353, 793.1512680676973, 803.1498342805072, 813.1503946667071, 823.1519200486222, 833.14892259202, 843.1520563976215, 853.1495148003928, 863.1518829844293, 873.150613406748, 883.1516569171417, 893.1464202460945, 903.1876725523207, 913.1412612496296, 923.1588228106505, 933.1416489648151, 943.1580393775914, 953.14273702508, 963.1511610178684, 973.1493070490494, 983.1516107859343, 993.1376343560261, 1003.1514637339048, 1013.1498724389613, 1023.1457300346045, 1033.1373487093797, 1043.1583460659617, 1053.142563358927, 1063.1514498284496, 1073.1449831633001, 1083.1386682435239, 1093.1503433976363, 1103.1566191406175, 1113.143189514817, 1123.150611986161, 1133.1510245076945, 1143.141955226478, 1153.1644666592906, 1163.140214738795, 1173.164669281666, 1183.1411099730258, 1193.1575611159233, 1203.1486355390837, 1213.1512248671247, 1223.1431365741282, 1233.1562406727692, 1243.155222923325, 1253.149491705933, 1263.1501361327387, 1273.149963763113, 1283.1500088148118, 1293.1500009776419, 1303.149987274621, 1313.1500499238737, 1323.1498130298855, 1333.150697956585, 1349.795232029068, 1396.5754957074864, 1473.0617051758634, 1573.155005861506, 1673.2182613763912, 1773.0716340467661, 1873.2287766159018, 1973.0796832586007, 2073.152795500876, 2173.2091291524825, 2273.1436611747095, 2373.149482232551, 2473.1584098950907, 2573.0836252036233, 2673.207406144117, 2773.2197670137575, 2873.0130420018845, 2973.228844841641, 3073.13795326735, 3173.152589712402, 3273.1516878830425, 3373.1406587554306, 3473.218958871129, 3573.0830183504713, 3673.1494689317965, 3773.219106982362, 3873.0735976917745, 3973.22025023252, 4106.430975145626, 4206.401464564639, 4273.15, 0.0, 0.0, 0.0, 0.0], + 3 +]) +T90_to_T48 = lambda x : float(splev(x, T90_to_T48_tck)) + +T76_to_T90_tck = implementation_optimize_tck([ + [5.0, 5.0, 5.0, 5.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 27.0, 27.0, 27.0, 27.0], + [4.999900000000002, 5.666500067316808, 6.666399865366388, 7.999600201950417, 8.999499242685939, 9.99940282730582, 10.99928944809078, 11.999239380331066, 12.998953030584966, 13.998948497329089, 14.998652980098697, 15.998639582276114, 16.998388690796848, 17.99820565453652, 18.99798869105709, 19.997839581235134, 20.997452984002386, 21.997348482755342, 22.996953084976248, 23.99683917733968, 25.329707215106883, 26.329446392446574, 26.9959, 0.0, 0.0, 0.0, 0.0], + 3 +]) +T76_to_T90 = lambda x : float(splev(x, T76_to_T90_tck)) + +T90_to_T76_tck = implementation_optimize_tck([ + [4.9999, 4.9999, 4.9999, 4.9999, 6.9997, 7.9996, 8.9995, 9.9994, 10.9993, 11.9992, 12.999, 13.9989, 14.9987, 15.9986, 16.9984, 17.9982, 18.998, 19.9978, 20.9975, 21.9973, 22.997, 23.9968, 24.9965, 26.9959, 26.9959, 26.9959, 26.9959], + [5.000000000000003, 5.666666599333867, 6.666666801332267, 7.999999798001599, 9.000000757494004, 9.999997172022374, 11.00001055441648, 11.999927275309695, 13.00008031463611, 13.999918157056612, 15.00008036546246, 15.99992707350743, 17.000011310115536, 17.999994344332254, 19.00001131255539, 19.999927067142114, 21.000080369250757, 21.999918163456723, 23.000080268586665, 23.999927471316532, 25.33335945580932, 26.33332027209535, 27.0, 0.0, 0.0, 0.0, 0.0], + 3 +]) +T90_to_T76 = lambda x : float(splev(x, T90_to_T76_tck)) + +T27_to_T90_tck = implementation_optimize_tck([ + [903.15, 903.15, 903.15, 903.15, 923.15, 933.15, 943.15, 953.15, 963.15, 973.15, 983.15, 993.15, 1003.15, 1013.15, 1023.15, 1033.15, 1043.15, 1053.15, 1063.15, 1073.15, 1083.15, 1093.15, 1103.15, 1113.15, 1123.15, 1133.15, 1143.15, 1153.15, 1163.15, 1173.15, 1183.15, 1193.15, 1203.15, 1213.15, 1223.15, 1233.15, 1243.15, 1253.15, 1263.15, 1273.15, 1283.15, 1293.15, 1303.15, 1313.15, 1323.15, 1333.15, 1373.15, 1473.15, 1573.15, 1673.15, 1773.15, 1873.15, 1973.15, 2073.15, 2173.15, 2273.15, 2373.15, 2473.15, 2573.15, 2673.15, 2773.15, 2873.15, 2973.15, 3073.15, 3173.15, 3273.15, 3373.15, 3473.15, 3573.15, 3673.15, 3773.15, 3873.15, 3973.15, 4073.15, 4273.15, 4273.15, 4273.15, 4273.15], + [903.2300000000001, 909.9758118581444, 920.0683762837123, 933.5774355744313, 943.6646165958825, 953.7840980420374, 963.8789912359674, 973.9799370140943, 984.0812607076549, 994.1750201552863, 1004.2386586711996, 1014.3103451599154, 1024.37996068914, 1034.4498120835242, 1044.460790976762, 1054.5270240094271, 1064.5511129855304, 1074.5685240484545, 1084.5947908206522, 1094.592312668939, 1104.5759585035914, 1114.5838533166973, 1124.5686282296201, 1134.561633764824, 1144.5448367110853, 1154.4990193908359, 1164.5190857255707, 1174.4846377068818, 1184.4823634469021, 1194.4659085055112, 1204.4740025310537, 1214.4580813702742, 1224.4536719878502, 1234.4272306783262, 1244.4174052988462, 1254.4231481262889, 1264.4100021959994, 1274.396843089716, 1284.402625445138, 1294.3926551297334, 1304.3667540359288, 1314.3603287265526, 1324.3519310578636, 1344.3119630261199, 1394.06601479742, 1474.210221764605, 1573.4291498859575, 1673.0731786915617, 1772.6381353477952, 1872.0342799172568, 1971.5847449831774, 2070.6867401500303, 2170.1682944166973, 2269.1800821831803, 2368.4913768505735, 2467.6144104145246, 2566.650981491329, 2665.5016636201576, 2764.642364028037, 2863.4088802676943, 2962.1221149011853, 3061.0026601275645, 3159.567244588556, 3258.0283615182143, 3356.6193093385828, 3454.7944011274585, 3553.3030861515795, 3651.4932542662227, 3749.4238967835327, 3847.5111585996483, 3945.23146881787, 4075.673465232531, 4173.388267383736, 4238.049999999999, 0.0, 0.0, 0.0, 0.0], + 3 +]) +T27_to_T90 = lambda x : float(splev(x, T27_to_T90_tck)) + +T90_to_T27_tck = implementation_optimize_tck([ + [903.23, 903.23, 903.23, 903.23, 923.4499999999999, 933.5699999999999, 943.67, 953.78, 963.88, 973.98, 984.0799999999999, 994.17, 1004.24, 1014.31, 1024.3799999999999, 1034.44, 1044.47, 1054.52, 1064.5500000000002, 1074.5700000000002, 1084.5900000000001, 1094.5900000000001, 1104.5800000000002, 1114.5800000000002, 1124.5700000000002, 1134.5600000000002, 1144.5400000000002, 1154.51, 1164.51, 1174.49, 1184.48, 1194.47, 1204.47, 1214.46, 1224.45, 1234.43, 1244.42, 1254.42, 1264.41, 1274.4, 1284.4, 1294.39, 1304.3700000000001, 1314.3600000000001, 1324.3500000000001, 1334.3300000000002, 1374.19, 1474.0500000000002, 1573.5, 1673.0600000000002, 1772.6100000000001, 1872.0600000000002, 1971.51, 2070.75, 2170.09, 2269.23, 2368.46, 2467.6, 2566.62, 2665.55, 2764.58, 2863.4, 2962.15, 3060.9500000000003, 3159.55, 3258.05, 3356.55, 3454.85, 3553.25, 3651.4500000000003, 3749.4500000000003, 3847.4500000000003, 3945.25, 4043.05, 4238.049999999999, 4238.049999999999, 4238.049999999999, 4238.049999999999], + [903.1499999999999, 909.8109216254546, 919.8314594972351, 933.13605057691, 943.1586235841731, 953.1426467814443, 963.1509973721603, 973.1500617336768, 983.145455794136, 993.1384024518346, 1003.1513297354381, 1013.1496541093682, 1023.1467435325782, 1033.1302695098336, 1043.165809185992, 1053.1363692585487, 1063.1455543613438, 1073.151477683475, 1083.138558173178, 1093.1443442318202, 1103.157380088686, 1113.1428091404198, 1123.1513721553247, 1133.1450281587795, 1143.1418151443777, 1153.171011702174, 1163.134226574393, 1173.1587064528103, 1183.1476341877396, 1193.1574297086495, 1203.1426594450065, 1213.1519206678774, 1223.142984436323, 1233.1561143623417, 1243.1559282695753, 1253.143515840855, 1263.149997803302, 1273.1564929503375, 1283.144040941448, 1293.1439998176627, 1303.1565898656397, 1313.149669848524, 1323.1447300793031, 1343.1279765769432, 1393.2744156526057, 1472.8521502095296, 1573.2578584405626, 1673.1334640315038, 1773.0881781985202, 1873.1759234823633, 1973.004276216799, 2073.247282267394, 2173.003944409143, 2273.230536712707, 2373.088144547932, 2473.095082315034, 2573.0883686550274, 2673.2325327637445, 2773.016245521531, 2873.117300715573, 2973.1951439746927, 3073.0291520069054, 3173.0985793107156, 3273.172037845178, 3373.0117957524362, 3473.240394822213, 3573.028311036633, 3673.037805413198, 3773.1766752517024, 3873.0194517177974, 3973.1688589301825, 4106.255134612646, 4206.136232873453, 4273.15, 0.0, 0.0, 0.0, 0.0], + 3 +]) +T90_to_T27 = lambda x : float(splev(x, T90_to_T27_tck)) - T68_to_T90 = UnivariateSpline(Ts_68, Ts_90_from_68, s=0) - T48_to_T90 = UnivariateSpline(Ts_48, Ts_90_from_48, s=0) - T76_to_T90 = UnivariateSpline(Ts_76, Ts_90_from_76, s=0) - T27_to_T90 = UnivariateSpline(Ts_27, Ts_90_from_27, s=0) - - T90_to_T68 = UnivariateSpline(Ts_90_from_68, Ts_68, s=0) - T90_to_T48 = UnivariateSpline(Ts_90_from_48, Ts_48, s=0) - T90_to_T76 = UnivariateSpline(Ts_90_from_76, Ts_76, s=0) - T90_to_T27 = UnivariateSpline(Ts_90_from_27, Ts_27, s=0) - built_splines_90_68 = True def ITS90_68_difference(T): @@ -379,9 +442,6 @@ def T_converter(T, current, desired): def range_check(T, Tmin, Tmax): if T < Tmin or T > Tmax: raise Exception('Temperature conversion is outside one or both scales') - if not built_splines_90_68: - build_splines() - try: if current == 'ITS-90': pass