Read a slice based on `startl`, `stopl` and `stepl`.
(
self,
startl: np.ndarray,
stopl: np.ndarray,
stepl: np.ndarray,
shape: list[int],
)
| 761 | return nparr |
| 762 | |
| 763 | def _read_slice( |
| 764 | self, |
| 765 | startl: np.ndarray, |
| 766 | stopl: np.ndarray, |
| 767 | stepl: np.ndarray, |
| 768 | shape: list[int], |
| 769 | ) -> np.ndarray: |
| 770 | """Read a slice based on `startl`, `stopl` and `stepl`.""" |
| 771 | nparr = np.empty(dtype=self.atom.dtype, shape=shape) |
| 772 | # Protection against reading empty arrays |
| 773 | if 0 not in shape: |
| 774 | # Arrays that have non-zero dimensionality |
| 775 | self._g_read_slice(startl, stopl, stepl, nparr) |
| 776 | # For zero-shaped arrays, return the scalar |
| 777 | if nparr.shape == (): |
| 778 | nparr = nparr[()] |
| 779 | return nparr |
| 780 | |
| 781 | def _read_coords(self, coords: np.ndarray) -> np.ndarray: |
| 782 | """Read a set of points defined by `coords`.""" |