def test_interactive_quit(self): scanset = ScanSet('test.hdf5') imgsel = scanset.interactive_display('Feed0_RCP', test=True) fake_event = type('event', (), {})() fake_event.key = 'q' fake_event.xdata, fake_event.ydata = (130, 30) retval = imgsel.on_key(fake_event) assert retval == (130, 30, 'q')
def test_interactive_scans_all_calibrated_channels(self, capsys): scanset = ScanSet('test.hdf5') scanset.calibrate_images(calibration=self.calfile) images = scanset.images ysize, xsize = images['Feed0_RCP'].shape imgsel = scanset.interactive_display(test=True) fake_event = type('event', (), {})() fake_event.key = 'a' fake_event.xdata, fake_event.ydata = (xsize//2, ysize-1) imgsel.on_key(fake_event) fake_event.key = 'h' fake_event.xdata, fake_event.ydata = (xsize//2, ysize-1) out, err = capsys.readouterr() assert "a open a window to filter all" in out imgsel.on_key(fake_event) fake_event.key = 'v' fake_event.xdata, fake_event.ydata = (xsize//2, ysize-1) imgsel.on_key(fake_event)
def test_interactive_quit_raises(self): scanset = ScanSet('test.hdf5') with pytest.raises(ImportError) as excinfo: imgsel = scanset.interactive_display('Feed0_RCP', test=True) assert "matplotlib is not installed" in str(excinfo.value)