From fc952307659599db66f1722b8c55663ba340f786 Mon Sep 17 00:00:00 2001 From: Vanya Belyaev Date: Tue, 8 Oct 2024 09:05:21 +0200 Subject: [PATCH] fix ? --- ostap/stats/gof_np.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ostap/stats/gof_np.py b/ostap/stats/gof_np.py index 9acea08d..b4a77ba0 100644 --- a/ostap/stats/gof_np.py +++ b/ostap/stats/gof_np.py @@ -39,7 +39,10 @@ import numpy as np import scipy as sp from numpy.lib.recfunctions import structured_to_unstructured as s2u - from scipy.spatial.distance import cdist as cdist + from scipy.spatial.distance import cdist as cdist + sp_version = tuple ( int ( i ) for i in sp.__version__.split('.') ) + if (1,6,0) <= sp_version : qconf = { 'k' : [ 2 ] , 'workers' : -1 } + else : qconf = { 'k' : 2 } # ========================================================================= except ImportError : # ========================================================================= @@ -392,9 +395,7 @@ def t_value ( self , ds1 , vpdf ) : "Invalid arrays: %s , %s" % ( sh1 , sh2 ) tree = sp.spatial.KDTree ( ds1 ) - conf = { 'k' : [2] } - if '1.6.0' <= sp.__version__ : conf [ 'workers'] = -1 - uvalues , _ = tree.query ( ds1 , **conf ) + uvalues , _ = tree.query ( ds1 , **qconf ) uvalues = uvalues.flatten () @@ -465,7 +466,8 @@ def histo ( self ) : if not sp : logger.warning ( 'Scipy is not available' ) if not s2u : logger.warning ( 's2u is not available' ) if not cdist : logger.warning ( 'cdist is not available' ) - + if sp and sp_version < (1,6,0) : + logger.warning ( 'very ancient version of scipy: %s' % str ( sp_version ) ) # ============================================================================= ## The END