@@ -573,7 +573,6 @@ def test_155_boost_factory():
573573 import boost_histogram as bh
574574
575575 dak = pytest .importorskip ("dask_awkward" )
576- import numpy as np
577576
578577 import dask_histogram as dh
579578
@@ -584,3 +583,56 @@ def test_155_boost_factory():
584583 axes = (axis ,),
585584 ).compute ()
586585 assert np .all (hist .values () == [3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 ])
586+
587+
588+ def test_155_2 ():
589+ import boost_histogram as bh
590+
591+ import dask_histogram as dh
592+
593+ dak = pytest .importorskip ("dask_awkward" )
594+
595+ arr = dak .from_lists ([list (range (10 ))] * 3 )
596+ axis = bh .axis .Regular (10 , 0.0 , 10.0 )
597+ hist = dh .factory (
598+ arr ,
599+ axes = (axis ,),
600+ weights = arr ,
601+ ).compute ()
602+ assert np .all (
603+ hist .values () == [0.0 , 3.0 , 6.0 , 9.0 , 12.0 , 15.0 , 18.0 , 21.0 , 24.0 , 27.0 ]
604+ )
605+
606+
607+ def test_155_3_2d ():
608+ import boost_histogram as bh
609+
610+ dak = pytest .importorskip ("dask_awkward" )
611+
612+ import dask_histogram as dh
613+
614+ arr1 = dak .from_lists ([list (range (10 ))] * 3 )
615+ arr2 = dak .from_lists ([list (reversed (range (10 )))] * 3 )
616+ axis1 = bh .axis .Regular (10 , 0.0 , 10.0 )
617+ axis2 = bh .axis .Regular (10 , 0.0 , 10.0 )
618+ hist = dh .factory (
619+ arr1 ,
620+ arr2 ,
621+ axes = (axis1 , axis2 ),
622+ weights = arr1 ,
623+ ).compute ()
624+ should_be = (
625+ [
626+ [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ],
627+ [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 3.0 , 0.0 ],
628+ [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 6.0 , 0.0 , 0.0 ],
629+ [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 9.0 , 0.0 , 0.0 , 0.0 ],
630+ [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 12.0 , 0.0 , 0.0 , 0.0 , 0.0 ],
631+ [0.0 , 0.0 , 0.0 , 0.0 , 15.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ],
632+ [0.0 , 0.0 , 0.0 , 18.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ],
633+ [0.0 , 0.0 , 21.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ],
634+ [0.0 , 24.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ],
635+ [27.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ],
636+ ],
637+ )
638+ assert np .all (hist .values () == should_be )
0 commit comments