@@ -704,6 +704,11 @@ def test_project_pset_with_dataarray_mask_push(self, mock_frame_transform_az_el)
704704
705705 rect_pset = self .rectangular_psets [0 ]
706706
707+ # Set all counts to a uniform non-zero value
708+ rect_pset .data ["counts" ] = xr .full_like (
709+ rect_pset .data ["counts" ], fill_value = 10.0
710+ )
711+
707712 # Create a DataArray mask matching the pset spatial dimensions
708713 valid_mask = xr .DataArray (
709714 np .ones (rect_pset .data ["counts" ].shape [2 :], dtype = bool ),
@@ -713,7 +718,8 @@ def test_project_pset_with_dataarray_mask_push(self, mock_frame_transform_az_el)
713718 },
714719 )
715720 # Mask out one quadrant
716- valid_mask [:90 , :90 ] = False
721+ valid_mask_shape = valid_mask .shape
722+ valid_mask [: valid_mask_shape [0 ] // 2 , : valid_mask_shape [1 ] // 2 ] = False
717723
718724 # Project with DataArray mask
719725 rectangular_map .project_pset_values_to_map (
@@ -727,6 +733,17 @@ def test_project_pset_with_dataarray_mask_push(self, mock_frame_transform_az_el)
727733 assert "counts" in rectangular_map .data_1d
728734 assert rectangular_map .data_1d ["counts" ].sum () > 0
729735
736+ # Check that pixel mask reduces total map counts to ~3/4 of pset counts
737+ total_pset_counts = rect_pset .data ["counts" ].sum ()
738+ expected_map_counts = total_pset_counts * 3 / 4 # Only half should be included
739+ actual_map_counts = rectangular_map .data_1d ["counts" ].sum ()
740+ np .testing .assert_allclose (
741+ actual_map_counts ,
742+ expected_map_counts ,
743+ rtol = 0.1 ,
744+ err_msg = ("Mask filtering failed" ),
745+ )
746+
730747 @pytest .mark .usefixtures ("_setup_rectangular_l1c_pset_products" )
731748 @mock .patch ("imap_processing.spice.geometry.frame_transform_az_el" )
732749 def test_project_pset_with_valid_mask_pull (self , mock_frame_transform_az_el ):
0 commit comments