@@ -569,9 +569,7 @@ def test_expected_results_bin(self) -> None:
569569 monitor = monitor ,
570570 uncertainty_broadcast_mode = UncertaintyBroadcastMode .fail ,
571571 )
572- expected = detector / sc .scalar (
573- 4 * 0.5 + 5 * 1.5 + 6 * 1 + 10 * 1 , unit = 'counts * Å'
574- )
572+ expected = detector / monitor .sum ()
575573 sc .testing .assert_identical (normalized , expected )
576574
577575 def test_expected_results_hist (self ) -> None :
@@ -588,45 +586,7 @@ def test_expected_results_hist(self) -> None:
588586 monitor = monitor ,
589587 uncertainty_broadcast_mode = UncertaintyBroadcastMode .fail ,
590588 )
591- expected = detector / sc .scalar (
592- 4 * 0.5 + 5 * 1.5 + 6 * 1 + 10 * 1 , unit = 'counts * Å'
593- )
594- sc .testing .assert_identical (normalized , expected )
595-
596- @pytest .mark .parametrize ('event_coord' , [True , False ])
597- def test_uses_monitor_values_at_boundary (
598- self ,
599- event_coord : bool ,
600- ) -> None :
601- detector = sc .DataArray (
602- sc .arange ('wavelength' , 4 , unit = 'counts' ),
603- coords = {'wavelength' : sc .arange ('wavelength' , 4.0 , unit = 'Å' )},
604- )
605- if event_coord :
606- # Make sure event at 3 is included
607- detector = detector .bin (
608- wavelength = sc .array (dims = ['wavelength' ], values = [0.0 , 2 , 3.1 ], unit = 'Å' )
609- )
610- del detector .coords ['wavelength' ]
611- else :
612- detector = detector .bin (
613- wavelength = sc .array (dims = ['wavelength' ], values = [0.0 , 2 , 3 ], unit = 'Å' )
614- )
615- del detector .bins .coords ['wavelength' ]
616- monitor = sc .DataArray (
617- sc .array (dims = ['wavelength' ], values = [4.0 , 10.0 ], unit = 'counts' ),
618- coords = {
619- 'wavelength' : sc .array (
620- dims = ['wavelength' ], values = [0.0 , 2 , 4 ], unit = 'Å'
621- )
622- },
623- )
624- normalized = normalize_by_monitor_integrated (
625- detector ,
626- monitor = monitor ,
627- uncertainty_broadcast_mode = UncertaintyBroadcastMode .fail ,
628- )
629- expected = detector / sc .scalar (4.0 * 2 + 10.0 * 2 , unit = 'counts' )
589+ expected = detector / monitor .sum ()
630590 sc .testing .assert_identical (normalized , expected )
631591
632592 def test_raises_if_monitor_range_too_narrow (
@@ -651,18 +611,18 @@ def test_raises_if_monitor_range_too_narrow(
651611 uncertainty_broadcast_mode = UncertaintyBroadcastMode .fail ,
652612 )
653613
654- def test_independent_of_monitor_binning_bin (self ) -> None :
614+ def test_independent_of_monitor_binning (self ) -> None :
655615 detector = sc .DataArray (
656616 sc .array (dims = ['w' ], values = [3 , 10 , 20 , 30 ], unit = 'counts' ),
657617 coords = {'w' : sc .arange ('w' , 1.0 , 5.0 , unit = 'Å' )},
658618 ).bin (w = sc .array (dims = ['w' ], values = [1.0 , 3 , 4 , 7 ], unit = 'Å' ))
659619
660620 monitor1 = sc .DataArray (
661621 sc .array (dims = ['w' ], values = [5.0 , 6.0 , 7.0 ], unit = 'counts' ),
662- coords = {'w' : sc .array (dims = ['w' ], values = [1.0 , 2 , 4 , 8 ], unit = 'Å' )},
622+ coords = {'w' : sc .array (dims = ['w' ], values = [1.0 , 2 , 4 , 7 ], unit = 'Å' )},
663623 )
664624 monitor2 = monitor1 .rebin (
665- w = sc .array (dims = ['w' ], values = [1.0 , 2 , 3 , 4 , 7 ], unit = 'Å' )
625+ w = sc .array (dims = ['w' ], values = [1.0 , 2 , 3 , 5 , 7 ], unit = 'Å' )
666626 )
667627
668628 normalized1 = normalize_by_monitor_integrated (
0 commit comments