[docs]defget_region_of_interest(self,chunk):post_ps=[ct.get_placement_set()forctinself.postsynaptic.cell_types]lpre,upre=self.presynaptic._get_rect_ext(tuple(chunk.dimensions))lpost,upost=self.postsynaptic._get_rect_ext(tuple(chunk.dimensions))# Get the `np.arange`s between bounds offset by the chunk position, to be used in# `np.meshgrid` below.bounds=list(np.arange(l1-u2+c,u1-l2+c+1)forl1,l2,u1,u2,cinzip(lpre,lpost,upre,upost,chunk,strict=False))# Flatten and stack the meshgrid coordinates into a list.clist=np.column_stack([a.reshape(-1)forainnp.meshgrid(*bounds,indexing="ij")])ifnothasattr(self,"_occ_chunks"):# Filter by chunks where cells were actually placedself._occ_chunks=set(chain.from_iterable(ps.get_all_chunks()forpsinpost_ps))ifnotself._occ_chunks:warn(f"No {', '.join(ps.tagforpsinpost_ps)} were placed, "f"skipping {self.name}",ConnectivityWarning,)return[]else:size=next(iter(self._occ_chunks)).dimensionsreturn[tforcinclistif(t:=Chunk(c,size))inself._occ_chunks]