disko 1.3.3__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {disko-1.3.3 → disko-1.4.0}/CHANGES.md +17 -0
- {disko-1.3.3 → disko-1.4.0}/Makefile +2 -2
- {disko-1.3.3 → disko-1.4.0}/PKG-INFO +3 -2
- disko-1.4.0/disko/__init__.py +34 -0
- {disko-1.3.3 → disko-1.4.0}/disko/bayes_cli.py +6 -8
- {disko-1.3.3 → disko-1.4.0}/disko/cli.py +5 -2
- {disko-1.3.3 → disko-1.4.0}/disko/disko.py +61 -23
- {disko-1.3.3 → disko-1.4.0}/disko/draw_cli.py +5 -5
- {disko-1.3.3 → disko-1.4.0}/disko/draw_sky.py +7 -14
- disko-1.4.0/disko/fov/__init__.py +4 -0
- {disko-1.3.3 → disko-1.4.0}/disko/fov/factory.py +3 -0
- {disko-1.3.3 → disko-1.4.0}/disko/healpix_sphere.py +72 -65
- {disko-1.3.3 → disko-1.4.0}/disko/ms_helper.py +19 -37
- {disko-1.3.3 → disko-1.4.0}/disko/multivariate_gaussian.py +3 -0
- {disko-1.3.3 → disko-1.4.0}/disko/parser_support.py +1 -1
- {disko-1.3.3 → disko-1.4.0}/disko/projection_lsqr.py +4 -1
- {disko-1.3.3 → disko-1.4.0}/disko/resolution.py +1 -1
- {disko-1.3.3 → disko-1.4.0}/disko/rime.py +1 -4
- {disko-1.3.3 → disko-1.4.0}/disko/sphere.py +18 -17
- {disko-1.3.3 → disko-1.4.0}/disko/sphere_mesh.py +171 -144
- {disko-1.3.3 → disko-1.4.0}/disko/svd_cli.py +8 -5
- {disko-1.3.3 → disko-1.4.0}/disko/telescope_operator.py +41 -40
- disko-1.4.0/disko/tests/__init__.py +2 -0
- {disko-1.3.3 → disko-1.4.0}/disko/tests/test_disko.py +1 -1
- disko-1.4.0/disko/tests/test_meshsphere.py +119 -0
- {disko-1.3.3 → disko-1.4.0}/disko/tests/test_multivariate.py +1 -1
- {disko-1.3.3 → disko-1.4.0}/disko/tests/test_projection_lsqr.py +1 -2
- {disko-1.3.3 → disko-1.4.0}/disko/tests/test_pylops_operator.py +84 -68
- {disko-1.3.3 → disko-1.4.0}/disko/tests/test_sphere.py +11 -21
- {disko-1.3.3 → disko-1.4.0}/disko/tests/test_subsphere.py +3 -3
- {disko-1.3.3 → disko-1.4.0}/disko/tests/test_telescope_operator.py +39 -38
- {disko-1.3.3 → disko-1.4.0}/disko/util.py +4 -0
- {disko-1.3.3 → disko-1.4.0}/pyproject.toml +6 -2
- {disko-1.3.3 → disko-1.4.0}/uv.lock +10 -22
- disko-1.3.3/disko/__init__.py +0 -34
- disko-1.3.3/disko/fov/__init__.py +0 -1
- disko-1.3.3/disko/tests/__init__.py +0 -0
- disko-1.3.3/disko/tests/test_meshsphere.py +0 -111
- {disko-1.3.3 → disko-1.4.0}/.github/workflows/package.yaml +0 -0
- {disko-1.3.3 → disko-1.4.0}/.github/workflows/testing.yaml +0 -0
- {disko-1.3.3 → disko-1.4.0}/.gitignore +0 -0
- {disko-1.3.3 → disko-1.4.0}/.travis.yml +0 -0
- {disko-1.3.3 → disko-1.4.0}/CITATION.cff +0 -0
- {disko-1.3.3 → disko-1.4.0}/LICENSE.txt +0 -0
- {disko-1.3.3 → disko-1.4.0}/MANIFEST.in +0 -0
- {disko-1.3.3 → disko-1.4.0}/README.md +0 -0
- {disko-1.3.3 → disko-1.4.0}/docker/Dockerfile +0 -0
- {disko-1.3.3 → disko-1.4.0}/docker/Makefile +0 -0
- {disko-1.3.3 → disko-1.4.0}/docker/docker-compose.yml +0 -0
- {disko-1.3.3 → disko-1.4.0}/install.sh +0 -0
- {disko-1.3.3 → disko-1.4.0}/movie/.gitignore +0 -0
- {disko-1.3.3 → disko-1.4.0}/movie/Makefile +0 -0
- {disko-1.3.3 → disko-1.4.0}/prof.py +0 -0
- {disko-1.3.3 → disko-1.4.0}/requirements.txt +0 -0
- {disko-1.3.3 → disko-1.4.0}/sequential_test.sh +0 -0
- {disko-1.3.3 → disko-1.4.0}/setup.cfg +0 -0
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 1.4.0 (2026-06-22)
|
|
4
|
+
|
|
5
|
+
- Convert from pygmsh to gmsh native API; remove pygmsh dependency; add meshio
|
|
6
|
+
- Select visibilities from all MS snapshots instead of just snapshot 0
|
|
7
|
+
- Add baseline length percentile output (0-100% in 5% steps)
|
|
8
|
+
- Fix `ms_helper`: rename misleading `res_arcmin` to `res_deg`, remove dead code
|
|
9
|
+
- Fix `image_natural`: broadcast bug in sigma_1 division causing wrong shapes
|
|
10
|
+
- Cache harmonic blocks per-block (float32) for matrix-free FISTA; limit to <500 MB
|
|
11
|
+
- Fix `test_meshsphere`: gmsh compatibility, split standalone `test_areas`
|
|
12
|
+
- Fix `test_telescope_operator`: harmonic normalization for physical pixel areas
|
|
13
|
+
- Fix `test_pylops_operator`: replace broken `from_resolution()` calls
|
|
14
|
+
- Fix `test_sphere`: incorrect zenith physics replaced with round-trip test
|
|
15
|
+
- Fix `test_subsphere`: timezone-naive datetime → UTC-aware
|
|
16
|
+
- Configure pytest to ignore `context/` directory
|
|
17
|
+
- Fix `scipy.misc` deprecation: use `imageio` instead
|
|
18
|
+
- Update copyright notices to 2022-2026 across all files
|
|
19
|
+
|
|
3
20
|
## 1.3.3 (2026-06-19)
|
|
4
21
|
|
|
5
22
|
- Vectorize `get_harmonics`, `make_gamma`, and matrix-free operators (`DiSkOOperator`, `DirectImagingOperator`) using broadcasting and blocked BLAS-level operations (10-50x speedup)
|
|
@@ -70,9 +70,9 @@ dask:
|
|
|
70
70
|
TART_ARGS=--fov 155deg --res 1deg --ms test_data/test.ms --debug --field 1 --HDF tart.hdf
|
|
71
71
|
#TART_ARGS=--fov 155deg --res 1deg --file test_data/test_data.json --show-sources --HDF tart.hdf
|
|
72
72
|
cygnus_lsmr:
|
|
73
|
-
${TIME} uv run disko --healpix --fov 3arcmin --ms ~/astro/cyg2052.ms --FITS --res
|
|
73
|
+
${TIME} uv run disko --healpix --fov 3arcmin --ms ~/astro/cyg2052.ms --FITS --res 0.5arcsec --matrix-free --lsmr --nvis 5000 --alpha 0.01 --title 'cygnus_lsmr'
|
|
74
74
|
cygnus_fista:
|
|
75
|
-
${TIME} uv run disko --healpix --fov 3arcmin --ms ~/astro/cyg2052.ms --FITS --res 1arcsec --matrix-free --fista --niter 200 --nvis
|
|
75
|
+
${TIME} uv run disko --debug --healpix --fov 3arcmin --ms ~/astro/cyg2052.ms --FITS --res 1arcsec --matrix-free --fista --alpha 1e-7 --niter 200 --nvis 10000 --title 'cygnus_fista'
|
|
76
76
|
|
|
77
77
|
tart:
|
|
78
78
|
uv run disko --healpix ${TART_ARGS} --SVG --alpha=0.025 --tikhonov --title 'tart'
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: disko
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Discrete Sky Operator (DiSkO) Aperture Synthesis Radio Imaging
|
|
5
5
|
Author-email: Tim Molteno <tim@elec.ac.nz>
|
|
6
6
|
License: GPLv3
|
|
7
7
|
License-File: LICENSE.txt
|
|
8
8
|
Requires-Python: <3.14,>=3.11
|
|
9
9
|
Requires-Dist: dask-ms<0.3.0,>=0.2.25
|
|
10
|
+
Requires-Dist: gmsh>=4.9
|
|
10
11
|
Requires-Dist: h5py>=3.7
|
|
11
12
|
Requires-Dist: healpy<2.0.0,>=1.15.0
|
|
12
13
|
Requires-Dist: imageio>=0.6.0b1
|
|
13
14
|
Requires-Dist: matplotlib<4.0.0,>=3.1.0
|
|
15
|
+
Requires-Dist: meshio>=5.0
|
|
14
16
|
Requires-Dist: numpy<3.0.0,>=1.2.1
|
|
15
|
-
Requires-Dist: pygmsh<8.0.0,>=7.1.17
|
|
16
17
|
Requires-Dist: pylops>=2.0
|
|
17
18
|
Requires-Dist: scikit-learn>=1.0.1
|
|
18
19
|
Requires-Dist: scipy>=1.7.3
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright Tim Molteno 2022-2026 tim@elec.ac.nz
|
|
3
|
+
# License: GPLv3
|
|
4
|
+
#
|
|
5
|
+
# Init for the DiSkO imaging algorithm
|
|
6
|
+
import logging # noqa: F401
|
|
7
|
+
|
|
8
|
+
# Public API — imported by external users
|
|
9
|
+
from .cli import disko_from_ms # noqa: F401
|
|
10
|
+
from .disko import ( # noqa: F401
|
|
11
|
+
DirectImagingOperator,
|
|
12
|
+
DiSkO,
|
|
13
|
+
DiSkOOperator,
|
|
14
|
+
get_all_uvw,
|
|
15
|
+
jomega,
|
|
16
|
+
vis_to_real,
|
|
17
|
+
)
|
|
18
|
+
from .draw_sky import mask_to_sky # noqa: F401
|
|
19
|
+
from .healpix_sphere import HealpixFoV, HealpixSubFoV # noqa: F401
|
|
20
|
+
from .multivariate_gaussian import MultivariateGaussian # noqa: F401
|
|
21
|
+
from .parser_support import sphere_args_parser, sphere_from_args # noqa: F401
|
|
22
|
+
from .projection_lsqr import plsqr # noqa: F401
|
|
23
|
+
from .resolution import Resolution # noqa: F401
|
|
24
|
+
from .sphere import SquareFoV # noqa: F401
|
|
25
|
+
from .sphere_mesh import AdaptiveMeshFoV, area # noqa: F401
|
|
26
|
+
from .telescope_operator import ( # noqa: F401
|
|
27
|
+
TelescopeOperator,
|
|
28
|
+
dask_svd,
|
|
29
|
+
normal_svd,
|
|
30
|
+
plot_spectrum,
|
|
31
|
+
plot_uv,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Copyright Tim Molteno 2022-2026 tim@elec.ac.nz
|
|
4
|
+
# License: GPLv3
|
|
2
5
|
import argparse
|
|
3
|
-
import datetime
|
|
4
6
|
import json
|
|
5
7
|
import logging
|
|
6
8
|
import os
|
|
7
9
|
import time
|
|
8
10
|
from copy import deepcopy
|
|
9
11
|
|
|
10
|
-
import matplotlib
|
|
11
12
|
import matplotlib.pyplot as plt
|
|
12
13
|
import numpy as np
|
|
13
|
-
import scipy.special
|
|
14
14
|
from tart.imaging import calibration, elaz, visibility
|
|
15
15
|
from tart.operation import settings
|
|
16
16
|
from tart_tools import api_imaging
|
|
@@ -125,14 +125,14 @@ def handle_bayes(ARGS):
|
|
|
125
125
|
|
|
126
126
|
flag_list = [] # [4, 5, 14, 22]
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
_original_positions = deepcopy # noqa: F841(config.get_antenna_positions())
|
|
129
129
|
|
|
130
130
|
gains_json = calib_info["gains"]
|
|
131
131
|
gains = np.asarray(gains_json["gain"])
|
|
132
132
|
phase_offsets = np.asarray(gains_json["phase_offset"])
|
|
133
133
|
config = settings.from_api_json(info["info"], ant_pos)
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
_measurements = [] # noqa: F841
|
|
136
136
|
for d in calib_info["data"]:
|
|
137
137
|
vis_json, source_json = d
|
|
138
138
|
cv, timestamp = api_imaging.vis_calibrated(
|
|
@@ -210,8 +210,6 @@ def handle_bayes(ARGS):
|
|
|
210
210
|
height = json_info["height"]
|
|
211
211
|
sphere.set_info(timestamp=timestamp, lon=lon, lat=lat, height=height)
|
|
212
212
|
|
|
213
|
-
src_list = None
|
|
214
|
-
|
|
215
213
|
prior = create_prior(disko.vis_arr, sphere, ARGS.prior)
|
|
216
214
|
|
|
217
215
|
posterior = do_inference(disko, sphere, prior, sigma_v=ARGS.sigma_v)
|
|
@@ -411,7 +409,7 @@ def main():
|
|
|
411
409
|
# fh.setLevel(logging.INFO)
|
|
412
410
|
|
|
413
411
|
# create console handler and set level to debug
|
|
414
|
-
ch = logging.StreamHandler()
|
|
412
|
+
ch = logging.StreamHandler() # noqa: F841
|
|
415
413
|
# ch.setLevel(logging.INFO)
|
|
416
414
|
|
|
417
415
|
# create formatter
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Copyright Tim Molteno 2022-2026 tim@elec.ac.nz
|
|
4
|
+
# License: GPLv3
|
|
2
5
|
import matplotlib
|
|
3
6
|
import os
|
|
4
7
|
|
|
@@ -229,7 +232,7 @@ def main():
|
|
|
229
232
|
if ARGS.version:
|
|
230
233
|
vers = version("disko")
|
|
231
234
|
print(f"disko: Version {vers}")
|
|
232
|
-
print(" (c) 2022-
|
|
235
|
+
print(" (c) 2022-2026 Tim Molteno")
|
|
233
236
|
sys.exit(0)
|
|
234
237
|
|
|
235
238
|
sphere = sphere_from_args(ARGS)
|
|
@@ -380,7 +383,7 @@ def main():
|
|
|
380
383
|
sphere.pixels = sphere.pixels / sphere.pixel_areas
|
|
381
384
|
|
|
382
385
|
else:
|
|
383
|
-
|
|
386
|
+
_sky = disko.solve_vis(disko.vis_arr, sphere) # noqa: F841
|
|
384
387
|
|
|
385
388
|
if ARGS.HDF:
|
|
386
389
|
fpath = os.path.join(ARGS.dir, ARGS.HDF)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Copyright Tim Molteno 2022-2026 tim@elec.ac.nz
|
|
4
|
+
# License: GPLv3
|
|
2
5
|
#
|
|
3
6
|
# The DiSkO algorithm for imaging without gridding.
|
|
4
7
|
#
|
|
@@ -82,7 +85,10 @@ def get_harmonic(p2j, l, m, n_minus_1, u, v, w, pixel_areas): # noqa: E741 (l i
|
|
|
82
85
|
|
|
83
86
|
class DiSkOOperator(pylops.LinearOperator):
|
|
84
87
|
"""
|
|
85
|
-
Linear operator for the telescope with a discrete sky
|
|
88
|
+
Linear operator for the telescope with a discrete sky.
|
|
89
|
+
|
|
90
|
+
Matrix-free: harmonic blocks are computed once and cached
|
|
91
|
+
(as float32) since UVW and frequency are constant across iterations.
|
|
86
92
|
"""
|
|
87
93
|
|
|
88
94
|
def __init__(self, u_arr, v_arr, w_arr, data, frequencies, sphere):
|
|
@@ -118,13 +124,31 @@ class DiSkOOperator(pylops.LinearOperator):
|
|
|
118
124
|
|
|
119
125
|
self.shape = (self.M, self.N)
|
|
120
126
|
self.explicit = False # Can't be directly inverted
|
|
127
|
+
|
|
128
|
+
# Cache for precomputed harmonic blocks (keyed by block index).
|
|
129
|
+
# Since UVW and frequency don't change between iterations, the
|
|
130
|
+
# harmonic matrix for each block is constant. Only enabled when
|
|
131
|
+
# the total cached size would fit within ~500 MB.
|
|
132
|
+
block_size = self._block_size()
|
|
133
|
+
n_blocks = (len(self.u_arr) + block_size - 1) // block_size
|
|
134
|
+
bytes_per_block = 2 * block_size * self.N * np.dtype(np.float32).itemsize
|
|
135
|
+
total_cache_bytes = n_blocks * bytes_per_block
|
|
136
|
+
self._use_cache = total_cache_bytes < 500_000_000
|
|
137
|
+
self._block_cache = {} if self._use_cache else None
|
|
138
|
+
|
|
139
|
+
if self._use_cache:
|
|
140
|
+
logger.info(
|
|
141
|
+
f"Block cache: {n_blocks} blocks x {bytes_per_block / 1e6:.0f} MB"
|
|
142
|
+
f" = {total_cache_bytes / 1e6:.0f} MB total"
|
|
143
|
+
)
|
|
144
|
+
|
|
121
145
|
logger.info("Creating DiSkOOperator data={}".format(self.shape))
|
|
122
146
|
|
|
123
147
|
def __call__(self, x):
|
|
124
148
|
# A callback to use during optimization routintes, should be used to write some temporary results
|
|
125
149
|
if (self.iteration_count > 0) and (self.iteration_count % 10 == 0):
|
|
126
150
|
logger.info(f"callback {self.sphere} {x.shape}")
|
|
127
|
-
self.sphere.callback(x, self.iteration_count)
|
|
151
|
+
# self.sphere.callback(x, self.iteration_count)
|
|
128
152
|
self.iteration_count = self.iteration_count + 1
|
|
129
153
|
|
|
130
154
|
def A(self, i, j, p2j):
|
|
@@ -172,6 +196,24 @@ class DiSkOOperator(pylops.LinearOperator):
|
|
|
172
196
|
"""Number of visibility rows per block, targeting ~200 MB per block."""
|
|
173
197
|
return max(256, int(200 * 1024 * 1024 / (16 * max(1, self.N))))
|
|
174
198
|
|
|
199
|
+
def _get_block(self, block_idx, p2j, u_blk, v_blk, w_blk):
|
|
200
|
+
"""Return (real, imag) float32 arrays for a harmonic block.
|
|
201
|
+
Computed once, cached for subsequent calls when cache enabled."""
|
|
202
|
+
if not self._use_cache:
|
|
203
|
+
H = self._compute_harmonics_block(p2j, u_blk, v_blk, w_blk)
|
|
204
|
+
return np.asarray(np.real(H), dtype=np.float32), np.asarray(
|
|
205
|
+
np.imag(H), dtype=np.float32
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
key = (block_idx,)
|
|
209
|
+
if key not in self._block_cache:
|
|
210
|
+
H = self._compute_harmonics_block(p2j, u_blk, v_blk, w_blk)
|
|
211
|
+
self._block_cache[key] = (
|
|
212
|
+
np.asarray(np.real(H), dtype=np.float32),
|
|
213
|
+
np.asarray(np.imag(H), dtype=np.float32),
|
|
214
|
+
)
|
|
215
|
+
return self._block_cache[key]
|
|
216
|
+
|
|
175
217
|
def _matvec(self, x):
|
|
176
218
|
"""
|
|
177
219
|
Multiply by the sky x, producing the set of measurements y
|
|
@@ -180,26 +222,26 @@ class DiSkOOperator(pylops.LinearOperator):
|
|
|
180
222
|
( v_real = (T_real x
|
|
181
223
|
v_imag ) T_imag)
|
|
182
224
|
|
|
183
|
-
|
|
184
|
-
exp(p2j * (u_i*l_j + v_i*m_j + w_i*(n_j-1))) * area_j
|
|
225
|
+
Matrix-free: uses cached float32 harmonic blocks.
|
|
185
226
|
"""
|
|
186
227
|
n_u = self.u_arr.shape[0]
|
|
187
|
-
y_re = np.zeros(n_u)
|
|
188
|
-
y_im = np.zeros(n_u)
|
|
228
|
+
y_re = np.zeros(n_u, dtype=np.float64)
|
|
229
|
+
y_im = np.zeros(n_u, dtype=np.float64)
|
|
189
230
|
block_size = self._block_size()
|
|
190
231
|
|
|
191
232
|
for f in self.frequencies:
|
|
192
233
|
p2j = jomega(f)
|
|
193
|
-
for i_start in range(0, n_u, block_size):
|
|
234
|
+
for block_idx, i_start in enumerate(range(0, n_u, block_size)):
|
|
194
235
|
i_end = min(i_start + block_size, n_u)
|
|
195
|
-
|
|
236
|
+
Hr, Hi = self._get_block(
|
|
237
|
+
block_idx,
|
|
196
238
|
p2j,
|
|
197
239
|
self.u_arr[i_start:i_end],
|
|
198
240
|
self.v_arr[i_start:i_end],
|
|
199
241
|
self.w_arr[i_start:i_end],
|
|
200
|
-
)
|
|
201
|
-
y_re[i_start:i_end] =
|
|
202
|
-
y_im[i_start:i_end] =
|
|
242
|
+
)
|
|
243
|
+
y_re[i_start:i_end] = Hr @ x.ravel()
|
|
244
|
+
y_im[i_start:i_end] = Hi @ x.ravel()
|
|
203
245
|
|
|
204
246
|
return np.concatenate((y_re, y_im))
|
|
205
247
|
|
|
@@ -210,32 +252,28 @@ class DiSkOOperator(pylops.LinearOperator):
|
|
|
210
252
|
x = ( T_real' T_imag') (v_real
|
|
211
253
|
v_imag)
|
|
212
254
|
|
|
213
|
-
|
|
214
|
-
A^T @ [v_r; v_i] = real(H)^T @ v_r + imag(H)^T @ v_i
|
|
255
|
+
Matrix-free: uses cached float32 harmonic blocks.
|
|
215
256
|
"""
|
|
216
257
|
assert v.shape == (self.M,)
|
|
217
258
|
n_u = self.u_arr.shape[0]
|
|
218
|
-
v_real = v[:n_u]
|
|
219
|
-
v_imag = v[n_u:]
|
|
259
|
+
v_real = np.asarray(v[:n_u], dtype=np.float64).ravel()
|
|
260
|
+
v_imag = np.asarray(v[n_u:], dtype=np.float64).ravel()
|
|
220
261
|
|
|
221
|
-
ret = np.zeros(self.N)
|
|
262
|
+
ret = np.zeros(self.N, dtype=np.float64)
|
|
222
263
|
block_size = self._block_size()
|
|
223
264
|
|
|
224
265
|
for f in self.frequencies:
|
|
225
266
|
p2j = jomega(f)
|
|
226
|
-
for i_start in range(0, n_u, block_size):
|
|
267
|
+
for block_idx, i_start in enumerate(range(0, n_u, block_size)):
|
|
227
268
|
i_end = min(i_start + block_size, n_u)
|
|
228
|
-
|
|
269
|
+
Hr, Hi = self._get_block(
|
|
270
|
+
block_idx,
|
|
229
271
|
p2j,
|
|
230
272
|
self.u_arr[i_start:i_end],
|
|
231
273
|
self.v_arr[i_start:i_end],
|
|
232
274
|
self.w_arr[i_start:i_end],
|
|
233
|
-
) # shape (block_size, N)
|
|
234
|
-
# A^T[:, block] * v[block] = R_block^T @ v_r_block + I_block^T @ v_i_block
|
|
235
|
-
ret += (
|
|
236
|
-
np.real(H_block).T @ v_real[i_start:i_end]
|
|
237
|
-
+ np.imag(H_block).T @ v_imag[i_start:i_end]
|
|
238
275
|
)
|
|
276
|
+
ret += Hr.T @ v_real[i_start:i_end] + Hi.T @ v_imag[i_start:i_end]
|
|
239
277
|
|
|
240
278
|
return ret
|
|
241
279
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
|
+
# Copyright Tim Molteno 2022-2026 tim@elec.ac.nz
|
|
4
|
+
# License: GPLv3
|
|
5
|
+
|
|
3
6
|
import argparse
|
|
4
|
-
import datetime
|
|
5
|
-
import json
|
|
6
7
|
import logging
|
|
7
8
|
import sys
|
|
8
|
-
import os
|
|
9
9
|
|
|
10
10
|
import numpy as np
|
|
11
11
|
import matplotlib.pyplot as plt
|
|
@@ -111,11 +111,11 @@ def main():
|
|
|
111
111
|
ts = field_of_view.timestamp
|
|
112
112
|
geo = field_of_view.geolocation
|
|
113
113
|
logger.info(f"geo {geo}")
|
|
114
|
-
|
|
114
|
+
|
|
115
115
|
if ARGS.sqrt:
|
|
116
116
|
new_pixels = np.sqrt(field_of_view.pixels)
|
|
117
117
|
field_of_view.set_visible_pixels(new_pixels)
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
src_list = None
|
|
120
120
|
if ARGS.show_sources:
|
|
121
121
|
api = api_handler.APIhandler("")
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright Tim Molteno
|
|
2
|
+
# Copyright Tim Molteno 2022-2026 tim@elec.ac.nz
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
from argparse import ArgumentParser
|
|
6
|
-
import json
|
|
7
5
|
import logging
|
|
6
|
+
from argparse import ArgumentParser
|
|
8
7
|
|
|
9
8
|
import healpy as hp
|
|
9
|
+
import imageio
|
|
10
10
|
import matplotlib.pyplot as plt
|
|
11
11
|
import numpy as np
|
|
12
12
|
|
|
13
|
-
from scipy import misc
|
|
14
|
-
|
|
15
13
|
from .healpix_sphere import HealpixFoV
|
|
16
|
-
from .disko import DiSkO
|
|
17
|
-
from .telescope_operator import TelescopeOperator
|
|
18
14
|
|
|
19
15
|
logger = logging.getLogger(__name__)
|
|
20
16
|
# logger.setLevel(logging.INFO)
|
|
21
17
|
|
|
18
|
+
|
|
22
19
|
def mask_to_sky(mask, nside):
|
|
23
20
|
height, width, col = mask.shape
|
|
24
21
|
mask = mask / np.max(mask)
|
|
@@ -36,14 +33,12 @@ def mask_to_sky(mask, nside):
|
|
|
36
33
|
s = np.zeros(npix)
|
|
37
34
|
|
|
38
35
|
for i in pixel_indices:
|
|
39
|
-
|
|
40
36
|
th = theta[i] # elevation np.pi/2 is horizon, zero vertical
|
|
41
37
|
ph = phi[i]
|
|
42
38
|
|
|
43
39
|
# Calcular image pixel corresponding to the theta, phi
|
|
44
40
|
|
|
45
41
|
if th < np.pi / 2:
|
|
46
|
-
|
|
47
42
|
r = rmax * np.sin(th)
|
|
48
43
|
|
|
49
44
|
x = int(x0 + r * np.sin(ph))
|
|
@@ -60,16 +55,14 @@ if __name__ == "__main__":
|
|
|
60
55
|
description="Draw something in the Null Space.",
|
|
61
56
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
62
57
|
)
|
|
63
|
-
parser.add_argument("--mask", default="batman.jpeg",
|
|
64
|
-
|
|
65
|
-
parser.add_argument("--nside", default=32, type=int,
|
|
66
|
-
help="Use the mask file.")
|
|
58
|
+
parser.add_argument("--mask", default="batman.jpeg", help="Use the mask file.")
|
|
59
|
+
parser.add_argument("--nside", default=32, type=int, help="Use the mask file.")
|
|
67
60
|
|
|
68
61
|
source_json = None
|
|
69
62
|
|
|
70
63
|
ARGS = parser.parse_args()
|
|
71
64
|
|
|
72
|
-
mask =
|
|
65
|
+
mask = imageio.v3.imread(ARGS.mask)
|
|
73
66
|
s = mask_to_sky(mask, ARGS.nside)
|
|
74
67
|
|
|
75
68
|
sphere = HealpixFoV(ARGS.nside)
|