|
2 | 2 | # MR: This code is maintained externally, so I'm switching auto-formatting off |
3 | 3 | # to make updating from outside sources easier. |
4 | 4 | from dataclasses import dataclass |
5 | | -from typing import List, Optional, Tuple, Union |
6 | 5 |
|
7 | 6 | import ducc0 |
8 | 7 | import numpy as np |
@@ -37,12 +36,12 @@ class TruncatedBlm: |
37 | 36 | mmax: int |
38 | 37 |
|
39 | 38 |
|
40 | | -def truncate_blm(inp: np.ndarray, lmax: int, mmax: int, epsilon: float = 1e-10) -> List[Optional[TruncatedBlm]]: |
| 39 | +def truncate_blm(inp: np.ndarray, lmax: int, mmax: int, epsilon: float = 1e-10) -> list[TruncatedBlm | None]: |
41 | 40 | """ |
42 | 41 | Analyzes the beam components and truncates them at the highest significant m-mode. |
43 | 42 | """ |
44 | 43 | limit = epsilon * np.max(np.abs(inp)) |
45 | | - out: List[Optional[TruncatedBlm]] = [] |
| 44 | + out: list[TruncatedBlm | None] = [] |
46 | 45 | for i in range(len(inp)): |
47 | 46 | maxk = -1 |
48 | 47 | idx = 0 |
@@ -262,7 +261,8 @@ def _mueller_tc_prep(self, blm: np.ndarray, mueller: np.ndarray, lmax: int, mmax |
262 | 261 | # Since we padded blm2_dense to mmax+4, checking bounds for +/- 2 is safe |
263 | 262 | # Checking +/- 4 might technically hit edge if m is at limit, but loop handles range. |
264 | 263 | def get_d(comp, idx_m): |
265 | | - if idx_m < 0 or idx_m >= blm2_dense.shape[1]: return 0j |
| 264 | + if idx_m < 0 or idx_m >= blm2_dense.shape[1]: |
| 265 | + return 0j |
266 | 266 | return blm2_dense[comp, idx_m, lrange] |
267 | 267 |
|
268 | 268 | # T component, Marta notes [4a] |
|
0 commit comments