@@ -601,21 +601,16 @@ def test_get_orthogonal_selection_1d_bool(store: StorePath) -> None:
601601# noinspection PyStatementEffect
602602def test_get_orthogonal_selection_1d_int (store : StorePath ) -> None :
603603 # setup
604- a = np .arange (1050 , dtype = int )
604+ a = np .arange (550 , dtype = int )
605605 z = zarr_array_from_numpy_array (store , a , chunk_shape = (100 ,))
606606
607607 np .random .seed (42 )
608608 # test with different degrees of sparseness
609- for p in 2 , 0.5 , 0.1 , 0.01 :
610- # unordered
609+ for p in 0.5 , 0.01 :
610+ # sorted integer arrays
611611 ix = np .random .choice (a .shape [0 ], size = int (a .shape [0 ] * p ), replace = True )
612- _test_get_orthogonal_selection (a , z , ix )
613- # increasing
614612 ix .sort ()
615613 _test_get_orthogonal_selection (a , z , ix )
616- # decreasing
617- ix = ix [::- 1 ]
618- _test_get_orthogonal_selection (a , z , ix )
619614
620615 selections = basic_selections_1d + [
621616 # test wraparound
@@ -660,12 +655,12 @@ def _test_get_orthogonal_selection_2d(
660655# noinspection PyStatementEffect
661656def test_get_orthogonal_selection_2d (store : StorePath ) -> None :
662657 # setup
663- a = np .arange (10000 , dtype = int ).reshape (1000 , 10 )
658+ a = np .arange (5400 , dtype = int ).reshape (600 , 9 )
664659 z = zarr_array_from_numpy_array (store , a , chunk_shape = (300 , 3 ))
665660
666661 np .random .seed (42 )
667662 # test with different degrees of sparseness
668- for p in 0.5 , 0.1 , 0. 01 :
663+ for p in 0.5 , 0.01 :
669664 # boolean arrays
670665 ix0 = np .random .binomial (1 , p , size = a .shape [0 ]).astype (bool )
671666 ix1 = np .random .binomial (1 , 0.5 , size = a .shape [1 ]).astype (bool )
@@ -679,16 +674,12 @@ def test_get_orthogonal_selection_2d(store: StorePath) -> None:
679674 for selection in selections :
680675 _test_get_orthogonal_selection (a , z , selection )
681676
682- # integer arrays
677+ # sorted integer arrays
683678 ix0 = np .random .choice (a .shape [0 ], size = int (a .shape [0 ] * p ), replace = True )
684679 ix1 = np .random .choice (a .shape [1 ], size = int (a .shape [1 ] * 0.5 ), replace = True )
685- _test_get_orthogonal_selection_2d (a , z , ix0 , ix1 )
686680 ix0 .sort ()
687681 ix1 .sort ()
688682 _test_get_orthogonal_selection_2d (a , z , ix0 , ix1 )
689- ix0 = ix0 [::- 1 ]
690- ix1 = ix1 [::- 1 ]
691- _test_get_orthogonal_selection_2d (a , z , ix0 , ix1 )
692683
693684 for selection_2d in basic_selections_2d :
694685 _test_get_orthogonal_selection (a , z , selection_2d )
@@ -709,65 +700,60 @@ def _test_get_orthogonal_selection_3d(
709700) -> None :
710701 selections = [
711702 # single value
712- (84 , 42 , 4 ),
703+ (60 , 15 , 4 ),
713704 (- 1 , - 1 , - 1 ),
714705 # index all axes with array
715706 (ix0 , ix1 , ix2 ),
716707 # mixed indexing with single array / slices
717- (ix0 , slice (15 , 25 ), slice (1 , 5 )),
718- (slice (50 , 70 ), ix1 , slice (1 , 5 )),
719- (slice (50 , 70 ), slice (15 , 25 ), ix2 ),
720- (ix0 , slice (15 , 25 , 5 ), slice (1 , 5 , 2 )),
721- (slice (50 , 70 , 3 ), ix1 , slice (1 , 5 , 2 )),
722- (slice (50 , 70 , 3 ), slice (15 , 25 , 5 ), ix2 ),
708+ (ix0 , slice (10 , 20 ), slice (1 , 5 )),
709+ (slice (30 , 50 ), ix1 , slice (1 , 5 )),
710+ (slice (30 , 50 ), slice (10 , 20 ), ix2 ),
711+ (ix0 , slice (10 , 20 , 5 ), slice (1 , 5 , 2 )),
712+ (slice (30 , 50 , 3 ), ix1 , slice (1 , 5 , 2 )),
713+ (slice (30 , 50 , 3 ), slice (10 , 20 , 5 ), ix2 ),
723714 # mixed indexing with single array / ints
724- (ix0 , 42 , 4 ),
725- (84 , ix1 , 4 ),
726- (84 , 42 , ix2 ),
715+ (ix0 , 15 , 4 ),
716+ (60 , ix1 , 4 ),
717+ (60 , 15 , ix2 ),
727718 # mixed indexing with single array / slice / int
728- (ix0 , slice (15 , 25 ), 4 ),
729- (42 , ix1 , slice (1 , 5 )),
730- (slice (50 , 70 ), 42 , ix2 ),
719+ (ix0 , slice (10 , 20 ), 4 ),
720+ (15 , ix1 , slice (1 , 5 )),
721+ (slice (30 , 50 ), 15 , ix2 ),
731722 # mixed indexing with two array / slice
732723 (ix0 , ix1 , slice (1 , 5 )),
733- (slice (50 , 70 ), ix1 , ix2 ),
734- (ix0 , slice (15 , 25 ), ix2 ),
724+ (slice (30 , 50 ), ix1 , ix2 ),
725+ (ix0 , slice (10 , 20 ), ix2 ),
735726 # mixed indexing with two array / integer
736727 (ix0 , ix1 , 4 ),
737- (42 , ix1 , ix2 ),
738- (ix0 , 42 , ix2 ),
728+ (15 , ix1 , ix2 ),
729+ (ix0 , 15 , ix2 ),
739730 ]
740731 for selection in selections :
741732 _test_get_orthogonal_selection (a , z , selection )
742733
743734
744735def test_get_orthogonal_selection_3d (store : StorePath ) -> None :
745736 # setup
746- a = np .arange (100000 , dtype = int ).reshape (200 , 50 , 10 )
737+ a = np .arange (32400 , dtype = int ).reshape (120 , 30 , 9 )
747738 z = zarr_array_from_numpy_array (store , a , chunk_shape = (60 , 20 , 3 ))
748739
749740 np .random .seed (42 )
750741 # test with different degrees of sparseness
751- for p in 0.5 , 0.1 , 0. 01 :
742+ for p in 0.5 , 0.01 :
752743 # boolean arrays
753744 ix0 = np .random .binomial (1 , p , size = a .shape [0 ]).astype (bool )
754745 ix1 = np .random .binomial (1 , 0.5 , size = a .shape [1 ]).astype (bool )
755746 ix2 = np .random .binomial (1 , 0.5 , size = a .shape [2 ]).astype (bool )
756747 _test_get_orthogonal_selection_3d (a , z , ix0 , ix1 , ix2 )
757748
758- # integer arrays
749+ # sorted integer arrays
759750 ix0 = np .random .choice (a .shape [0 ], size = int (a .shape [0 ] * p ), replace = True )
760751 ix1 = np .random .choice (a .shape [1 ], size = int (a .shape [1 ] * 0.5 ), replace = True )
761752 ix2 = np .random .choice (a .shape [2 ], size = int (a .shape [2 ] * 0.5 ), replace = True )
762- _test_get_orthogonal_selection_3d (a , z , ix0 , ix1 , ix2 )
763753 ix0 .sort ()
764754 ix1 .sort ()
765755 ix2 .sort ()
766756 _test_get_orthogonal_selection_3d (a , z , ix0 , ix1 , ix2 )
767- ix0 = ix0 [::- 1 ]
768- ix1 = ix1 [::- 1 ]
769- ix2 = ix2 [::- 1 ]
770- _test_get_orthogonal_selection_3d (a , z , ix0 , ix1 , ix2 )
771757
772758
773759def test_orthogonal_indexing_edge_cases (store : StorePath ) -> None :
@@ -805,24 +791,21 @@ def _test_set_orthogonal_selection(
805791
806792def test_set_orthogonal_selection_1d (store : StorePath ) -> None :
807793 # setup
808- v = np .arange (1050 , dtype = int )
794+ v = np .arange (550 , dtype = int )
809795 a = np .empty (v .shape , dtype = int )
810796 z = zarr_array_from_numpy_array (store , a , chunk_shape = (100 ,))
811797
812798 # test with different degrees of sparseness
813799 np .random .seed (42 )
814- for p in 0.5 , 0.1 , 0. 01 :
800+ for p in 0.5 , 0.01 :
815801 # boolean arrays
816802 ix = np .random .binomial (1 , p , size = a .shape [0 ]).astype (bool )
817803 _test_set_orthogonal_selection (v , a , z , ix )
818804
819- # integer arrays
805+ # sorted integer arrays
820806 ix = np .random .choice (a .shape [0 ], size = int (a .shape [0 ] * p ), replace = True )
821- _test_set_orthogonal_selection (v , a , z , ix )
822807 ix .sort ()
823808 _test_set_orthogonal_selection (v , a , z , ix )
824- ix = ix [::- 1 ]
825- _test_set_orthogonal_selection (v , a , z , ix )
826809
827810 # basic selections
828811 for selection in basic_selections_1d :
@@ -870,28 +853,24 @@ def _test_set_orthogonal_selection_2d(
870853
871854def test_set_orthogonal_selection_2d (store : StorePath ) -> None :
872855 # setup
873- v = np .arange (10000 , dtype = int ).reshape (1000 , 10 )
856+ v = np .arange (5400 , dtype = int ).reshape (600 , 9 )
874857 a = np .empty_like (v )
875858 z = zarr_array_from_numpy_array (store , a , chunk_shape = (300 , 3 ))
876859
877860 np .random .seed (42 )
878861 # test with different degrees of sparseness
879- for p in 0.5 , 0.1 , 0. 01 :
862+ for p in 0.5 , 0.01 :
880863 # boolean arrays
881864 ix0 = np .random .binomial (1 , p , size = a .shape [0 ]).astype (bool )
882865 ix1 = np .random .binomial (1 , 0.5 , size = a .shape [1 ]).astype (bool )
883866 _test_set_orthogonal_selection_2d (v , a , z , ix0 , ix1 )
884867
885- # integer arrays
868+ # sorted integer arrays
886869 ix0 = np .random .choice (a .shape [0 ], size = int (a .shape [0 ] * p ), replace = True )
887870 ix1 = np .random .choice (a .shape [1 ], size = int (a .shape [1 ] * 0.5 ), replace = True )
888- _test_set_orthogonal_selection_2d (v , a , z , ix0 , ix1 )
889871 ix0 .sort ()
890872 ix1 .sort ()
891873 _test_set_orthogonal_selection_2d (v , a , z , ix0 , ix1 )
892- ix0 = ix0 [::- 1 ]
893- ix1 = ix1 [::- 1 ]
894- _test_set_orthogonal_selection_2d (v , a , z , ix0 , ix1 )
895874
896875 for selection in basic_selections_2d :
897876 _test_set_orthogonal_selection (v , a , z , selection )
@@ -907,20 +886,20 @@ def _test_set_orthogonal_selection_3d(
907886) -> None :
908887 selections = (
909888 # single value
910- (84 , 42 , 4 ),
889+ (60 , 15 , 4 ),
911890 (- 1 , - 1 , - 1 ),
912891 # index all axes with bool array
913892 (ix0 , ix1 , ix2 ),
914893 # mixed indexing with single bool array / slice or int
915- (ix0 , slice (15 , 25 ), slice (1 , 5 )),
916- (slice (50 , 70 ), ix1 , slice (1 , 5 )),
917- (slice (50 , 70 ), slice (15 , 25 ), ix2 ),
918- (ix0 , 42 , 4 ),
919- (84 , ix1 , 4 ),
920- (84 , 42 , ix2 ),
921- (ix0 , slice (15 , 25 ), 4 ),
922- (slice (50 , 70 ), ix1 , 4 ),
923- (slice (50 , 70 ), 42 , ix2 ),
894+ (ix0 , slice (10 , 20 ), slice (1 , 5 )),
895+ (slice (30 , 50 ), ix1 , slice (1 , 5 )),
896+ (slice (30 , 50 ), slice (10 , 20 ), ix2 ),
897+ (ix0 , 15 , 4 ),
898+ (60 , ix1 , 4 ),
899+ (60 , 15 , ix2 ),
900+ (ix0 , slice (10 , 20 ), 4 ),
901+ (slice (30 , 50 ), ix1 , 4 ),
902+ (slice (30 , 50 ), 15 , ix2 ),
924903 # indexing with two arrays / slice
925904 (ix0 , ix1 , slice (1 , 5 )),
926905 # indexing with two arrays / integer
@@ -932,37 +911,28 @@ def _test_set_orthogonal_selection_3d(
932911
933912def test_set_orthogonal_selection_3d (store : StorePath ) -> None :
934913 # setup
935- v = np .arange (100000 , dtype = int ).reshape (200 , 50 , 10 )
914+ v = np .arange (32400 , dtype = int ).reshape (120 , 30 , 9 )
936915 a = np .empty_like (v )
937916 z = zarr_array_from_numpy_array (store , a , chunk_shape = (60 , 20 , 3 ))
938917
939918 np .random .seed (42 )
940919 # test with different degrees of sparseness
941- for p in 0.5 , 0.1 , 0. 01 :
920+ for p in 0.5 , 0.01 :
942921 # boolean arrays
943922 ix0 = np .random .binomial (1 , p , size = a .shape [0 ]).astype (bool )
944923 ix1 = np .random .binomial (1 , 0.5 , size = a .shape [1 ]).astype (bool )
945924 ix2 = np .random .binomial (1 , 0.5 , size = a .shape [2 ]).astype (bool )
946925 _test_set_orthogonal_selection_3d (v , a , z , ix0 , ix1 , ix2 )
947926
948- # integer arrays
927+ # sorted integer arrays
949928 ix0 = np .random .choice (a .shape [0 ], size = int (a .shape [0 ] * p ), replace = True )
950929 ix1 = np .random .choice (a .shape [1 ], size = int (a .shape [1 ] * 0.5 ), replace = True )
951930 ix2 = np .random .choice (a .shape [2 ], size = int (a .shape [2 ] * 0.5 ), replace = True )
952- _test_set_orthogonal_selection_3d (v , a , z , ix0 , ix1 , ix2 )
953-
954- # sorted increasing
955931 ix0 .sort ()
956932 ix1 .sort ()
957933 ix2 .sort ()
958934 _test_set_orthogonal_selection_3d (v , a , z , ix0 , ix1 , ix2 )
959935
960- # sorted decreasing
961- ix0 = ix0 [::- 1 ]
962- ix1 = ix1 [::- 1 ]
963- ix2 = ix2 [::- 1 ]
964- _test_set_orthogonal_selection_3d (v , a , z , ix0 , ix1 , ix2 )
965-
966936
967937def test_orthogonal_indexing_fallback_on_get_setitem (store : StorePath ) -> None :
968938 z = zarr_array_from_numpy_array (store , np .zeros ((20 , 20 )))
@@ -1128,13 +1098,13 @@ def _test_set_coordinate_selection(
11281098
11291099def test_set_coordinate_selection_1d (store : StorePath ) -> None :
11301100 # setup
1131- v = np .arange (1050 , dtype = int )
1101+ v = np .arange (550 , dtype = int )
11321102 a = np .empty (v .shape , dtype = v .dtype )
11331103 z = zarr_array_from_numpy_array (store , a , chunk_shape = (100 ,))
11341104
11351105 np .random .seed (42 )
11361106 # test with different degrees of sparseness
1137- for p in 2 , 0.5 , 0.1 , 0.01 :
1107+ for p in 0.5 , 0.01 :
11381108 n = int (a .size * p )
11391109 ix = np .random .choice (a .shape [0 ], size = n , replace = True )
11401110 _test_set_coordinate_selection (v , a , z , ix )
@@ -1152,13 +1122,13 @@ def test_set_coordinate_selection_1d(store: StorePath) -> None:
11521122
11531123def test_set_coordinate_selection_2d (store : StorePath ) -> None :
11541124 # setup
1155- v = np .arange (10000 , dtype = int ).reshape (1000 , 10 )
1125+ v = np .arange (5400 , dtype = int ).reshape (600 , 9 )
11561126 a = np .empty_like (v )
11571127 z = zarr_array_from_numpy_array (store , a , chunk_shape = (300 , 3 ))
11581128
11591129 np .random .seed (42 )
11601130 # test with different degrees of sparseness
1161- for p in 2 , 0.5 , 0.1 , 0.01 :
1131+ for p in 0.5 , 0.01 :
11621132 n = int (a .size * p )
11631133 ix0 = np .random .choice (a .shape [0 ], size = n , replace = True )
11641134 ix1 = np .random .choice (a .shape [1 ], size = n , replace = True )
0 commit comments