Skip to content

Commit 76e767b

Browse files
committed
skymodel_cal notebook fix
.compute() returns a future if dask is being used.
1 parent efa5464 commit 76e767b

4 files changed

Lines changed: 10 additions & 18 deletions

File tree

‎arl/graphs/execute.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,11 @@ def set_client(self, client=None, use_dask=True, **kwargs):
6363
self._using_dask = False
6464

6565

66-
def compute(self, value, sync=True):
66+
def compute(self, value):
6767
"""Get the actual value
6868
6969
:param value:
70-
:param sync: Operate synchronously
71-
:return: If sync=True then the value, otherwise a Future
70+
:return: If not using dask then the value, otherwise a Future
7271
"""
7372
if self._using_dask:
7473
start = time.time()

‎examples/arl/skymodel_cal.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@
375375
"corrupted_vis = arlexecute.client.scatter(corrupted_vis)\n",
376376
"graph = create_skymodel_cal_solve_graph(corrupted_vis, calskymodel_graph, niter=30, \n",
377377
" gain=0.25, tol=1e-8)\n",
378-
"calskymodel, residual_vis = arlexecute.compute(graph)"
378+
"calskymodel, residual_vis = arlexecute.compute(graph).result()"
379379
]
380380
},
381381
{

‎tests/test_imaging_deconvolve_delayed.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_deconvolve_spectral(self):
116116
dopsf=True, normalize=True)
117117
deconvolved, _ = create_deconvolve_graph(dirty_graph, psf_graph, self.model_graph, niter=1000,
118118
fractional_threshold=0.1, scales=[0, 3, 10],
119-
threshold=0.1, nmajor=0, gain=0.7)
119+
threshold=0.1, gain=0.7)
120120
deconvolved = arlexecute.compute(deconvolved)
121121

122122
export_image_to_fits(deconvolved[0], '%s/test_imaging_%s_deconvolve_spectral.fits' %
@@ -131,7 +131,7 @@ def test_deconvolve_and_restore_cube_mmclean(self):
131131
dec_graph, _ = create_deconvolve_graph(dirty_graph, psf_graph, self.model_graph, niter=1000,
132132
fractional_threshold=0.1, scales=[0, 3, 10],
133133
algorithm='mmclean', nmoments=3, nchan=self.freqwin,
134-
threshold=0.1, nmajor=0, gain=0.7)
134+
threshold=0.1, gain=0.7)
135135
residual_graph = create_residual_graph(self.vis_graph_list, model_graph=dec_graph,
136136
context='wstack', vis_slices=51)
137137
restored = create_restore_graph(model_graph=dec_graph, psf_graph=psf_graph, residual_graph=residual_graph,
@@ -150,8 +150,8 @@ def test_deconvolve_and_restore_cube_mmclean_facets(self):
150150
dec_graph, _ = create_deconvolve_graph(dirty_graph, psf_graph, self.model_graph, niter=1000,
151151
fractional_threshold=0.1, scales=[0, 3, 10],
152152
algorithm='mmclean', nmoments=3, nchan=self.freqwin,
153-
threshold=0.1, nmajor=0, gain=0.7, deconvolve_facets=4,
154-
deconvolve_overlap=16)
153+
threshold=0.1, gain=0.7, deconvolve_facets=4,
154+
deconvolve_overlap=16, deconvolve_taper='tukey')
155155
residual_graph = create_residual_graph(self.vis_graph_list, model_graph=dec_graph,
156156
context='2d')
157157
restored = create_restore_graph(model_graph=dec_graph, psf_graph=psf_graph, residual_graph=residual_graph,

‎tests/test_imaging_params.py‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,14 @@ def test_get_frequency_map_mfs(self):
6767

6868
def test_get_frequency_map_gleam(self):
6969
self.model = create_low_test_image_from_gleam(npixel=512, cellsize=0.001, frequency=self.frequency,
70-
channel_bandwidth=self.channel_bandwidth)
71-
spectral_mode, vfrequency_map = get_frequency_map(self.vis, self.model)
72-
assert numpy.max(vfrequency_map) == self.model.nchan - 1
73-
assert spectral_mode == 'channel'
74-
75-
def test_get_frequency_map_s3(self):
76-
self.model = create_test_image_from_s3(npixel=64, cellsize=0.001, frequency=self.frequency,
77-
channel_bandwidth=self.channel_bandwidth)
70+
channel_bandwidth=self.channel_bandwidth, flux_limit=10.0)
7871
spectral_mode, vfrequency_map = get_frequency_map(self.vis, self.model)
7972
assert numpy.max(vfrequency_map) == self.model.nchan - 1
8073
assert spectral_mode == 'channel'
8174

8275
def test_w_kernel_list(self):
83-
oversampling = 4
84-
kernelwidth = 128
76+
oversampling = 2
77+
kernelwidth = 32
8578
kernel_indices, kernels = w_kernel_list(self.vis, self.model,
8679
kernelwidth=kernelwidth, wstep=50, oversampling=oversampling)
8780
assert numpy.max(numpy.abs(kernels[0].data)) > 0.0

0 commit comments

Comments
 (0)