|
6 | 6 | "source": [ |
7 | 7 | "# Dask imaging demonstration\n", |
8 | 8 | "\n", |
9 | | - "This notebook explores the use of dask for parallelisation. We work through the steps of imaging using dask, ending up with a major/minor cycle algorithm without and with selfcalibration.\n", |
10 | | - "\n", |
11 | | - "The functions used are in pipelines/dask_graphs.py" |
| 9 | + "This notebook explores the use of dask for parallelisation. We work through the steps of imaging using dask, ending up with a major/minor cycle algorithm without and with selfcalibration." |
12 | 10 | ] |
13 | 11 | }, |
14 | 12 | { |
|
110 | 108 | " vt = create_blockvisibility(lowcore, times, frequency, channel_bandwidth=channel_bandwidth,\n", |
111 | 109 | " weight=1.0, phasecentre=phasecentre, \n", |
112 | 110 | " polarisation_frame=PolarisationFrame(\"stokesI\"))\n", |
113 | | - " npixel = 512\n", |
| 111 | + " npixel = 256\n", |
114 | 112 | " cellsize=0.001\n", |
115 | 113 | " model = create_image_from_visibility(vt, npixel=npixel, cellsize=cellsize, npol=1, frequency=reffrequency,\n", |
116 | 114 | " polarisation_frame=PolarisationFrame(\"stokesI\"))\n", |
|
158 | 156 | " return model" |
159 | 157 | ] |
160 | 158 | }, |
| 159 | + { |
| 160 | + "cell_type": "markdown", |
| 161 | + "metadata": {}, |
| 162 | + "source": [ |
| 163 | + "Now create the graphs to define the visibility sets, one without errors and one with 1 radian phase errors." |
| 164 | + ] |
| 165 | + }, |
161 | 166 | { |
162 | 167 | "cell_type": "code", |
163 | 168 | "execution_count": null, |
|
167 | 172 | }, |
168 | 173 | "outputs": [], |
169 | 174 | "source": [ |
170 | | - "nfreqwin=7\n", |
| 175 | + "nfreqwin=3\n", |
171 | 176 | "vis_graph_list=list()\n", |
172 | 177 | "for freq in numpy.linspace(0.8e8,1.2e8,nfreqwin):\n", |
173 | 178 | " vis_graph_list.append(delayed(ingest_visibility)(freq, time=0.0))\n", |
|
196 | 201 | "cell_type": "code", |
197 | 202 | "execution_count": null, |
198 | 203 | "metadata": { |
199 | | - "collapsed": true, |
200 | 204 | "scrolled": false |
201 | 205 | }, |
202 | 206 | "outputs": [], |
203 | 207 | "source": [ |
204 | | - "advice=advise_wide_field(vis_graph_list[0].compute(), guard_band_image=0.5)" |
| 208 | + "advice=advise_wide_field(vis_graph_list[0].compute(), guard_band_image=6.0)" |
205 | 209 | ] |
206 | 210 | }, |
207 | 211 | { |
|
215 | 219 | "cell_type": "code", |
216 | 220 | "execution_count": null, |
217 | 221 | "metadata": { |
218 | | - "collapsed": true, |
219 | 222 | "scrolled": false |
220 | 223 | }, |
221 | 224 | "outputs": [], |
|
229 | 232 | "cell_type": "markdown", |
230 | 233 | "metadata": {}, |
231 | 234 | "source": [ |
232 | | - "Make and display a graph to predict using w stacking" |
| 235 | + "Make and display a graph from invert using w stacking" |
233 | 236 | ] |
234 | 237 | }, |
235 | 238 | { |
236 | 239 | "cell_type": "code", |
237 | 240 | "execution_count": null, |
238 | 241 | "metadata": { |
239 | | - "collapsed": true, |
240 | 242 | "scrolled": false |
241 | 243 | }, |
242 | 244 | "outputs": [], |
|
249 | 251 | "cell_type": "markdown", |
250 | 252 | "metadata": {}, |
251 | 253 | "source": [ |
252 | | - "Do the same for invert" |
| 254 | + "Do the same for invert. note the difference in structure of the graphs." |
253 | 255 | ] |
254 | 256 | }, |
255 | 257 | { |
256 | 258 | "cell_type": "code", |
257 | 259 | "execution_count": null, |
258 | | - "metadata": { |
259 | | - "collapsed": true |
260 | | - }, |
| 260 | + "metadata": {}, |
261 | 261 | "outputs": [], |
262 | 262 | "source": [ |
263 | 263 | "dirty_graph = create_invert_facet_graph(vis_graph_list, model_graph, dopsf=False, \n", |
|
270 | 270 | "cell_type": "code", |
271 | 271 | "execution_count": null, |
272 | 272 | "metadata": { |
273 | | - "collapsed": true, |
274 | 273 | "scrolled": false |
275 | 274 | }, |
276 | 275 | "outputs": [], |
|
284 | 283 | "cell_type": "markdown", |
285 | 284 | "metadata": {}, |
286 | 285 | "source": [ |
287 | | - "Now compute the dirty image using this graph" |
| 286 | + "Now compute the dirty image using this graph We can do this either by using the compute() method of the graph or we can create a distributed.Client and use that. With the latter, information about the processing can be seen at tcp://127.0.0.1:8787." |
288 | 287 | ] |
289 | 288 | }, |
290 | 289 | { |
291 | 290 | "cell_type": "code", |
292 | 291 | "execution_count": null, |
293 | 292 | "metadata": { |
294 | | - "collapsed": true, |
295 | 293 | "scrolled": false |
296 | 294 | }, |
297 | 295 | "outputs": [], |
298 | 296 | "source": [ |
299 | | - "c=get_dask_Client()\n", |
300 | | - "print(c)" |
| 297 | + "c=get_dask_Client()" |
301 | 298 | ] |
302 | 299 | }, |
303 | 300 | { |
304 | 301 | "cell_type": "code", |
305 | 302 | "execution_count": null, |
306 | 303 | "metadata": { |
307 | | - "collapsed": true, |
308 | 304 | "scrolled": false |
309 | 305 | }, |
310 | 306 | "outputs": [], |
|
340 | 336 | " vis_slices=91, \n", |
341 | 337 | " algorithm='hogbom', niter=1000, \n", |
342 | 338 | " fractional_threshold=0.1, threshold=0.2, nmajor=2,\n", |
343 | | - " gain=0.1, facets=4)" |
| 339 | + " gain=0.1, facets=1)" |
344 | 340 | ] |
345 | 341 | }, |
346 | 342 | { |
347 | 343 | "cell_type": "code", |
348 | 344 | "execution_count": null, |
349 | | - "metadata": { |
350 | | - "collapsed": true |
351 | | - }, |
| 345 | + "metadata": {}, |
352 | 346 | "outputs": [], |
353 | 347 | "source": [ |
354 | 348 | "future=c.compute(continuum_imaging_graph)" |
|
358 | 352 | "cell_type": "code", |
359 | 353 | "execution_count": null, |
360 | 354 | "metadata": { |
361 | | - "collapsed": true, |
362 | 355 | "scrolled": false |
363 | 356 | }, |
364 | 357 | "outputs": [], |
|
395 | 388 | " c_residual_graph=create_residual_wstack_graph,\n", |
396 | 389 | " vis_slices=91, \n", |
397 | 390 | " algorithm='hogbom', niter=1000, \n", |
398 | | - " fractional_threshold=0.1, threshold=0.2, nmajor=4,\n", |
399 | | - " gain=0.1, facets=4, first_selfcal=1)\n", |
| 391 | + " fractional_threshold=0.1, threshold=0.2, nmajor=5,\n", |
| 392 | + " gain=0.1, facets=1, first_selfcal=1)\n", |
400 | 393 | "#g=simple_vis(ical_graph, filename='imaging-dask-ical-graph-slices11', format='svg')" |
401 | 394 | ] |
402 | 395 | }, |
|
415 | 408 | "cell_type": "code", |
416 | 409 | "execution_count": null, |
417 | 410 | "metadata": { |
418 | | - "collapsed": true, |
419 | 411 | "scrolled": false |
420 | 412 | }, |
421 | 413 | "outputs": [], |
|
441 | 433 | "cell_type": "code", |
442 | 434 | "execution_count": null, |
443 | 435 | "metadata": { |
444 | | - "collapsed": true, |
445 | 436 | "scrolled": true |
446 | 437 | }, |
447 | 438 | "outputs": [], |
|
0 commit comments