def show_mask(self, ax: axes.Axes, title="", fontfamily="times new roman", fontsize=15, scatter=20): phi = np.linspace(0, 2 * np.pi, 360 * 4) circle = ax.fill(self._aperture * np.cos(phi), self._aperture * np.sin(phi), color="lightblue", zorder=0) elements = ax.scatter(x=self._locations[0], y=self._locations[1], s=scatter, c="gray", zorder=2) if title == "": title = "Total number: " + str(self.get_total_number()) # loop line for radius in self._radius: ax.plot(radius * np.cos(phi), radius * np.sin(phi), color="orange", zorder=1) ax.set_aspect("equal", 'box') ax.set_axis_off() ax.grid(True) ax.set_title(title, fontsize=fontsize, fontfamily=fontfamily) return ax
def IFT_LoopMaskArray(aperture, loop_number: np.array, loop_radius: np.array, ax: axes.Axes, centred=False): """ Draw circular array on the circular aperture face :param aperture: the radius of the array :param loop_number: number of each loop :param loop_radius: radius of each loop :param ax: handle of subplot :param centred: the centre whether has the element for True or False :return: """ detal_phi = 2 * np.pi / loop_number total_number = np.einsum("i->", loop_number) if centred: loc = np.zeros([2, total_number + 1], dtype=np.float64) loop_index = 1 else: loc = np.zeros([2, total_number], dtype=np.float64) loop_index = 0 for zmc, radius in enumerate(loop_radius): current_number = loop_number[zmc] phi = np.arange(0, current_number) * detal_phi[zmc] loc_x = radius * np.cos(phi) loc_y = radius * np.sin(phi) loc[0, loop_index:loop_index + current_number] = loc_x loc[1, loop_index:loop_index + current_number] = loc_y loop_index = loop_index + current_number phi = np.linspace(0, 2 * np.pi, 360 * 4) # draw circle = ax.fill(aperture * np.cos(phi), aperture * np.sin(phi), color='lightblue', zorder=0) elements = ax.scatter(x=loc[0], y=loc[1], s=10, c='gray', zorder=1) ax.set_aspect('equal', 'box') ax.set_axis_off() ax.grid(True) return ax