Skip to content

Commit 71dea5c

Browse files
committed
Comments
1 parent 876393f commit 71dea5c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/vitessce/data_utils/spatialdata_points_zorder.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,16 @@ def zquery_rows(morton_sorted: List[int], intervals: List[Tuple[int,int]], merge
364364
return merge_adjacent(ranges) if merge else ranges
365365

366366

367+
def row_ranges_to_row_indices(intervals: List[Tuple[int,int]]) -> List[int]:
368+
"""
369+
Convert row ranges [i, j) to a list of row indices.
370+
Then, can index into pandas DataFrame using df.iloc[indices, :]
371+
"""
372+
indices: List[int] = []
373+
for i, j in intervals:
374+
indices.extend(list(range(i, j)))
375+
return indices
376+
377+
# TODO: add unit tests
378+
379+
# TODO: generalize to 3D morton codes

0 commit comments

Comments
 (0)