@@ -148,11 +148,11 @@ def _parse_maximise(maximise, nobj):
148
148
149
149
def _unary_refset_common (data , ref , maximise ):
150
150
# Convert to numpy.array in case the user provides a list. We use
151
- # np.asfarray to convert it to floating-point, otherwise if a user inputs
151
+ # np.asarray(dtype=float) to convert it to floating-point, otherwise if a user inputs
152
152
# something like ref = np.array([10, 10]) then numpy would interpret it as
153
153
# an int array.
154
- data = np .asfarray (data )
155
- ref = np .atleast_2d (np .asfarray (ref ))
154
+ data = np .asarray (data , dtype = float )
155
+ ref = np .atleast_2d (np .asarray (ref , dtype = float ))
156
156
nobj = data .shape [1 ]
157
157
if nobj != ref .shape [1 ]:
158
158
raise ValueError (
@@ -357,9 +357,9 @@ def hypervolume(data: ArrayLike, /, ref) -> float:
357
357
# np.asfarray to convert it to floating-point, otherwise if a user inputs
358
358
# something like ref = np.array([10, 10]) then numpy would interpret it as
359
359
# an int array.
360
- data = np .asfarray (data )
360
+ data = np .asarray (data , dtype = float )
361
361
nobj = data .shape [1 ]
362
- ref = atleast_1d_of_length_n (np .asfarray (ref ), nobj )
362
+ ref = atleast_1d_of_length_n (np .asarray (ref , dtype = float ), nobj )
363
363
if nobj != ref .shape [0 ]:
364
364
raise ValueError (
365
365
f"data and ref need to have the same number of objectives ({ nobj } != { ref .shape [0 ]} )"
@@ -413,7 +413,7 @@ def is_nondominated(data, maximise=False, keep_weakly: bool = False):
413
413
[1, 0]])
414
414
415
415
"""
416
- data = np .asfarray (data )
416
+ data = np .asarray (data , dtype = float )
417
417
nrows , nobj = data .shape
418
418
maximise = _parse_maximise (maximise , nobj )
419
419
data_p , npoints , nobj = np2d_to_double_array (data )
@@ -484,7 +484,7 @@ def filter_dominated_within_sets(
484
484
With a single dataset, use :func:`filter_dominated`
485
485
486
486
"""
487
- data = np .asfarray (data )
487
+ data = np .asarray (data , dtype = float )
488
488
ncols = data .shape [1 ]
489
489
if ncols < 3 :
490
490
raise ValueError (
@@ -579,7 +579,7 @@ def pareto_rank(data, /, *, maximise=False):
579
579
True
580
580
581
581
"""
582
- data = np .asfarray (data )
582
+ data = np .asarray (data , dtype = float )
583
583
nrows , nobj = data .shape
584
584
maximise = _parse_maximise (maximise , nobj )
585
585
if maximise .any ():
@@ -686,15 +686,15 @@ def normalise(
686
686
687
687
"""
688
688
# Normalise modifies the data, so we need to create a copy.
689
- data = np .asfarray (data ).copy ()
689
+ data = np .asarray (data , dtype = float ).copy ()
690
690
npoints , nobj = data .shape
691
691
if nobj == 1 :
692
692
raise ValueError ("'data' must have at least two columns" )
693
- to_range = np .asfarray (to_range )
693
+ to_range = np .asarray (to_range , dtype = float )
694
694
if to_range .shape [0 ] != 2 :
695
695
raise ValueError ("'to_range' must have length 2" )
696
- lower = atleast_1d_of_length_n (np .asfarray (lower ), nobj )
697
- upper = atleast_1d_of_length_n (np .asfarray (upper ), nobj )
696
+ lower = atleast_1d_of_length_n (np .asarray (lower , dtype = float ), nobj )
697
+ upper = atleast_1d_of_length_n (np .asarray (upper , dtype = float ), nobj )
698
698
if np .any (np .isnan (lower )):
699
699
lower = np .where (np .isnan (lower ), data .min (axis = 0 ), lower )
700
700
if np .any (np .isnan (upper )):
@@ -805,7 +805,7 @@ def eaf(data, /, percentiles=[]):
805
805
[ 7.92511295, 3.92669598, 100. ]])
806
806
807
807
"""
808
- data = np .asfarray (data )
808
+ data = np .asarray (data , dtype = float )
809
809
ncols = data .shape [1 ]
810
810
if ncols < 3 :
811
811
raise ValueError (
@@ -824,7 +824,7 @@ def eaf(data, /, percentiles=[]):
824
824
if len (percentiles ) == 0 :
825
825
percentiles = np .arange (1.0 , nsets + 1 ) * (100.0 / nsets )
826
826
else :
827
- percentiles = np .unique (np .asfarray (percentiles ))
827
+ percentiles = np .unique (np .asarray (percentiles , dtype = float ))
828
828
percentile_p , npercentiles = np1d_to_double_array (percentiles )
829
829
830
830
# Get C pointers + matrix size for calling CFFI generated extension module
@@ -886,7 +886,7 @@ def vorobT(data, /, reference):
886
886
8943.333191728081
887
887
888
888
"""
889
- data = np .asfarray (data )
889
+ data = np .asarray (data , dtype = float )
890
890
ncols = data .shape [1 ]
891
891
if ncols < 3 :
892
892
raise ValueError (
@@ -957,7 +957,7 @@ def vorobDev(x, /, reference, *, VE=None) -> float:
957
957
if VE is None :
958
958
VE = vorobT (x , reference )["VE" ]
959
959
960
- x = np .asfarray ( x )
960
+ x = np .asarray ( x , dtype = float )
961
961
ncols = x .shape [1 ]
962
962
if ncols < 3 :
963
963
raise ValueError (
@@ -1075,8 +1075,8 @@ def eafdiff(x, y, /, *, intervals=None, maximise=False, rectangles=False):
1075
1075
[ 4. , 2.5, inf, 3. , 1. ]])
1076
1076
1077
1077
"""
1078
- x = np .asfarray ( x )
1079
- y = np .asfarray ( y )
1078
+ x = np .asarray ( x , dtype = float )
1079
+ y = np .asarray ( y , dtype = float )
1080
1080
assert (
1081
1081
x .shape [1 ] == y .shape [1 ]
1082
1082
), "'x' and 'y' must have the same number of columns"
@@ -1158,7 +1158,7 @@ def eafdiff(x, y, /, *, intervals=None, maximise=False, rectangles=False):
1158
1158
# intervals = int(intervals)
1159
1159
1160
1160
# data = np.ascontiguousarray(
1161
- # np.asfarray (data)
1161
+ # np.asarray (data, dtype=float )
1162
1162
# ) # C function requires contiguous data
1163
1163
# num_data_columns = data.shape[1]
1164
1164
# data_p, npoints, ncols = np2d_to_double_array(data)
@@ -1286,13 +1286,15 @@ def whv_hype(
1286
1286
# Convert to numpy.array in case the user provides a list. We use
1287
1287
# np.asfarray to convert it to floating-point, otherwise if a user inputs
1288
1288
# something like [10, 10] then numpy would interpret it as an int array.
1289
- data = np .asfarray (data )
1289
+ data = np .asarray (data , dtype = float )
1290
1290
nobj = data .shape [1 ]
1291
1291
if nobj != 2 :
1292
1292
raise NotImplementedError ("Only 2D datasets are currently supported" )
1293
1293
1294
- reference = atleast_1d_of_length_n (np .asfarray (reference ), nobj )
1295
- ideal = atleast_1d_of_length_n (np .asfarray (ideal ), nobj )
1294
+ reference = atleast_1d_of_length_n (
1295
+ np .asarray (reference , dtype = float ), nobj
1296
+ )
1297
+ ideal = atleast_1d_of_length_n (np .asarray (ideal , dtype = float ), nobj )
1296
1298
1297
1299
maximise = _parse_maximise (maximise , nobj )
1298
1300
data [:, maximise ] = - data [:, maximise ]
@@ -1319,7 +1321,7 @@ def whv_hype(
1319
1321
data_p , npoints , ideal , reference , nsamples , seed , mu
1320
1322
)
1321
1323
elif dist == "point" :
1322
- mu = atleast_1d_of_length_n (np .asfarray (mu ), nobj )
1324
+ mu = atleast_1d_of_length_n (np .asarray (mu , dtype = float ), nobj )
1323
1325
mu , _ = np1d_to_double_array (mu )
1324
1326
hv = lib .whv_hype_gaus (
1325
1327
data_p , npoints , ideal , reference , nsamples , seed , mu
0 commit comments