def show(self, waves, **kwargs): """ Visualize the detector region(s) of the detector as applied to a specified wave function. Parameters ---------- waves : Waves or SMatrix object The wave function the visualization will be created to match kwargs : Additional keyword arguments for abtem.visualize.mpl.show_measurement_2d. """ waves.grid.check_is_defined() array = np.full(waves.gpts, -1, dtype=np.int) for i, indices in enumerate( self._get_regions(waves.gpts, waves.angular_sampling, min(waves.cutoff_scattering_angles))): array.ravel()[indices] = i calibrations = calibrations_from_grid(waves.gpts, waves.sampling, names=['alpha_x', 'alpha_y'], units='mrad', scale_factor=waves.wavelength * 1e3, fourier_space=True) array = np.fft.fftshift(array, axes=(-1, -2)) measurement = Measurement(array, calibrations=calibrations, name='Detector regions') return show_measurement_2d(measurement, discrete_cmap=True, **kwargs)
def show(self, ax=None, **kwargs): """ Show the measurement. Parameters ---------- kwargs: Additional keyword arguments for the abtem.plot.show_image function. """ if self.dimensions == 1: return show_measurement_1d(self, ax=ax, **kwargs) else: return show_measurement_2d(self, ax=ax, **kwargs)