def test_calc_and_calibrate_image_pixel(self): scanset = ScanSet('test.hdf5') scanset.calibrate_images(calibration=self.calfile, map_unit="Jy/pixel") images = scanset.images img = images['Feed0_RCP'] center = img.shape[0] // 2, img.shape[1] // 2 shortest_side = np.min(img.shape) X, Y = np.meshgrid(np.arange(img.shape[1]), np.arange(img.shape[0])) good = (X-center[1])**2 + (Y-center[0])**2 <= (shortest_side//4)**2 rtol = 0.2 assert np.isclose(np.sum(images['Feed0_RCP'][good]), self.simulated_flux, rtol=rtol)
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)