Skip to content

Commit 6145a2a

Browse files
Jammy2211Jammy2211
authored andcommitted
copilot review
1 parent afb6e90 commit 6145a2a

File tree

4 files changed

+22
-26
lines changed

4 files changed

+22
-26
lines changed

autoarray/dataset/interferometer/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def apply_w_tilde(
193193

194194
if curvature_preload is None:
195195

196-
logger.info("INTERFEROMETER Computing W-Tilde; runtime scales with visibility count and mask resolution, extreme inputs may exceed hours.")
196+
logger.info("INTERFEROMETER - Computing W-Tilde; runtime scales with visibility count and mask resolution, extreme inputs may exceed hours.")
197197

198198
curvature_preload = inversion_interferometer_util.w_tilde_curvature_preload_interferometer_from(
199199
noise_map_real=self.noise_map.array.real,

autoarray/dataset/interferometer/w_tilde.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import json
22
import hashlib
3-
from dataclasses import dataclass
43
import numpy as np
54
from pathlib import Path
65
from typing import Any, Dict, Optional, Tuple, Union
@@ -98,7 +97,7 @@ def is_preload_metadata_compatible(
9897
require_mask_hash
9998
If True, require the full mask sha256 to match (safest).
10099
If False, only check bbox + shape + pixel scales.
101-
rtol, atol
100+
atol
102101
Tolerances for pixel scale comparisons (normally exact is fine
103102
because these are configuration constants, but tolerances allow
104103
for tiny float repr differences).
@@ -172,8 +171,8 @@ def load_curvature_preload_if_compatible(
172171
173172
Returns
174173
-------
175-
np.ndarray or None
176-
The loaded curvature_preload if compatible, otherwise None (unless raise_on_mismatch=True).
174+
np.ndarray
175+
The loaded curvature_preload if compatible, otherwise raises ValueError.
177176
"""
178177
file = Path(file)
179178
if file.suffix.lower() != ".npz":

autoarray/inversion/inversion/interferometer/inversion_interferometer_util.py

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -293,23 +293,21 @@ def w_tilde_curvature_preload_interferometer_via_np_from(
293293
# -------------------------------------------------
294294
pbar = None
295295
if show_progress:
296-
try:
297-
from tqdm import tqdm # type: ignore
298-
299-
n_quadrants = 1
300-
if x_shape > 1:
301-
n_quadrants += 1
302-
if y_shape > 1:
303-
n_quadrants += 1
304-
if (y_shape > 1) and (x_shape > 1):
305-
n_quadrants += 1
306-
307-
pbar = tqdm(
308-
total=n_chunks * n_quadrants,
309-
desc="Accumulating visibilities (W-tilde preload)",
310-
)
311-
except Exception:
312-
pbar = None
296+
297+
from tqdm import tqdm # type: ignore
298+
299+
n_quadrants = 1
300+
if x_shape > 1:
301+
n_quadrants += 1
302+
if y_shape > 1:
303+
n_quadrants += 1
304+
if (y_shape > 1) and (x_shape > 1):
305+
n_quadrants += 1
306+
307+
pbar = tqdm(
308+
total=n_chunks * n_quadrants,
309+
desc="Accumulating visibilities (W-tilde preload)",
310+
)
313311

314312
def accum_from_corner_np(y_ref, x_ref, gy_block, gx_block):
315313
dy = y_ref - gy_block
@@ -327,10 +325,7 @@ def accum_from_corner_np(y_ref, x_ref, gy_block, gx_block):
327325
pbar.update(1)
328326

329327
if show_memory and show_progress and "_report_memory" in globals():
330-
try:
331-
globals()["_report_memory"](acc)
332-
except Exception:
333-
pass
328+
globals()["_report_memory"](acc)
334329

335330
return acc
336331

test_autoarray/dataset/interferometer/test_dataset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ def test__curvature_preload_metadata_from(
178178
file=file, real_space_mask=dataset.real_space_mask
179179
)
180180

181+
assert curvature_preload[0,0] == pytest.approx(1.75, 1.0e-4)
182+
181183
real_space_mask_changed = np.array(
182184
[
183185
[True, True, True, True, True, True, True],

0 commit comments

Comments
 (0)