@@ -50,6 +50,59 @@ def test_clear_session_issue_25(qtbot):
5050 mw .on_action_clear (assume_yes = True )
5151
5252
53+ def test_no_events_issue_37 (qtbot ):
54+ """https://github.com/ZELLMECHANIK-DRESDEN/ShapeOut2/issues/37
55+
56+ "ValueError: zero-size array to reduction operation minimum
57+ which has no identity" when all events are filtered out.
58+ """
59+ mw = ShapeOut2 ()
60+ qtbot .addWidget (mw )
61+
62+ # add a dataslot
63+ path = pathlib .Path (__file__ ).parent / "data" / "calibration_beads_47.rtdc"
64+ mw .add_dataslot (paths = [path , path ])
65+
66+ assert len (mw .pipeline .slot_ids ) == 2 , "we added those"
67+ assert len (mw .pipeline .filter_ids ) == 1 , "automatically added"
68+
69+ # activate a dataslot
70+ slot_id = mw .pipeline .slot_ids [0 ]
71+ filt_id = mw .pipeline .filter_ids [0 ]
72+ em = mw .block_matrix .get_widget (slot_id , filt_id )
73+ qtbot .mouseClick (em , QtCore .Qt .LeftButton ) # activate
74+ # did that work?
75+ assert mw .pipeline .is_element_active (slot_id , filt_id )
76+
77+ # filter away all events
78+ fe = mw .block_matrix .get_widget (filt_plot_id = filt_id )
79+ qtbot .mouseClick (fe .toolButton_modify , QtCore .Qt .LeftButton )
80+ fv = mw .widget_ana_view .widget_filter
81+ qtbot .mouseClick (fv .toolButton_moreless , QtCore .Qt .LeftButton )
82+ rc = fv ._box_range_controls ["area_um" ]
83+ qtbot .mouseClick (rc .checkBox , QtCore .Qt .LeftButton )
84+ # did that work?
85+ assert rc .checkBox .isChecked ()
86+ qtbot .mouseClick (fv .toolButton_moreless , QtCore .Qt .LeftButton )
87+ # set range
88+ rc .doubleSpinBox_min .setValue (0 )
89+ rc .doubleSpinBox_max .setValue (1 )
90+ qtbot .mouseClick (fv .pushButton_apply , QtCore .Qt .LeftButton )
91+ # did that work?
92+ ds = mw .pipeline .get_dataset (slot_index = 0 , filt_index = 0 ,
93+ apply_filter = True )
94+ assert np .sum (ds .filter .all ) == 0
95+
96+ # open QuickView
97+ slot_id = mw .pipeline .slot_ids [0 ]
98+ filt_id = mw .pipeline .filter_ids [0 ]
99+ em = mw .block_matrix .get_widget (slot_id , filt_id )
100+
101+ # this raised the error
102+ qtbot .mouseClick (em , QtCore .Qt .LeftButton , QtCore .Qt .ShiftModifier )
103+ mw .close ()
104+
105+
53106def test_update_polygon_filter_issue_26 (qtbot ):
54107 """https://github.com/ZELLMECHANIK-DRESDEN/ShapeOut2/issues/26
55108
0 commit comments