From a6fa8ab64dae83bfa697fa62d9a049905599dc23 Mon Sep 17 00:00:00 2001 From: Hanbin Lee Date: Sun, 13 Oct 2024 13:47:05 -0400 Subject: [PATCH] input checking for range_sketch to align with windows --- python/tskit/trees.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/tskit/trees.py b/python/tskit/trees.py index f2f000457f..aab8687c50 100644 --- a/python/tskit/trees.py +++ b/python/tskit/trees.py @@ -8653,11 +8653,12 @@ def pca( assert individuals is not None output_type = "individual" dim = len(individuals) - - if windows is None and range_sketch is not None: - raise ValueError("Windows should be given to supply range_sketch") + if range_sketch is not None: - assert range_sketch.shape == len(windows) - 1 + if windows is not None: + assert range_sketch.shape[0] == len(windows) - 1 + elif windows is None: + range_sketch = np.expand_dims(range_sketch, 0) if num_components > dim: raise ValueError(