@@ -283,3 +283,28 @@ def test__file_context_manager():
283283 buffer = StringIO ("test content" )
284284 with tools ._file_context_manager (buffer ) as obj :
285285 assert obj .read () == "test content"
286+
287+
288+ def test_lambertw_pvlib ():
289+ test_exp = np .arange (- 10. , 300 , step = 10 )
290+ test_x = 10. ** test_exp
291+ # known solution from scipy.special.lambertw
292+ expected = np .array ([
293+ 9.9999999989999997e-11 , 5.6714329040978384e-01 ,
294+ 2.0028685413304952e+01 , 4.2306755091738395e+01 ,
295+ 6.4904633770046118e+01 , 8.7630277151947183e+01 ,
296+ 1.1042491882731335e+02 , 1.3326278259180333e+02 ,
297+ 1.5613026581351718e+02 , 1.7901931374150624e+02 ,
298+ 2.0192476320084489e+02 , 2.2484310644511851e+02 ,
299+ 2.4777185185877809e+02 , 2.7070916610249782e+02 ,
300+ 2.9365366103997610e+02 , 3.1660426041503479e+02 ,
301+ 3.3956011295458728e+02 , 3.6252053376149752e+02 ,
302+ 3.8548496362161768e+02 , 4.0845294003314166e+02 ,
303+ 4.3142407612718210e+02 , 4.5439804503371403e+02 ,
304+ 4.7737456808796901e+02 , 5.0035340579834485e+02 ,
305+ 5.2333435083468805e+02 , 5.4631722251791496e+02 ,
306+ 5.6930186244110166e+02 , 5.9228813095427859e+02 ,
307+ 6.1527590431628334e+02 , 6.3826507236734335e+02 ,
308+ 6.6125553661218726e+02 ])
309+ result = tools .lambertw_pvlib (test_x )
310+ assert np .allclose (result , expected , rtol = 1e-14 )
0 commit comments