From 27cb33213ef54e70d5589454240777166e8d73f5 Mon Sep 17 00:00:00 2001 From: Alistair Miles Date: Fri, 30 Aug 2024 16:59:32 +0100 Subject: [PATCH] handle copy kwarg in asarray_ndim --- allel/util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/allel/util.py b/allel/util.py index b96484bf..0d5a8585 100644 --- a/allel/util.py +++ b/allel/util.py @@ -43,9 +43,13 @@ def asarray_ndim(a, *ndims, **kwargs): """ allow_none = kwargs.pop('allow_none', False) + copy = kwargs.pop("copy", False) if a is None and allow_none: return None - a = np.asarray(a, **kwargs) + if copy: + a = np.array(a, **kwargs) + else: + a = np.asarray(a, **kwargs) if a.ndim not in ndims: if len(ndims) > 1: expect_str = 'one of %s' % str(ndims)