|
21 | 21 | "\n", |
22 | 22 | "import numpy\n", |
23 | 23 | "\n", |
24 | | - "sys.path.append(os.path.join('..', '..'))\n", |
25 | | - "\n", |
26 | 24 | "import astropy.units as u\n", |
27 | | - "\n", |
28 | | - "from arl.graphs.execute import arlexecute\n", |
29 | | - "\n", |
30 | 25 | "from astropy.coordinates import SkyCoord\n", |
31 | 26 | "\n", |
| 27 | + "from arl.graphs.execute import arlexecute\n", |
32 | 28 | "from arl.data.polarisation import PolarisationFrame\n", |
33 | 29 | "from arl.graphs.generic_graphs import create_generic_image_graph\n", |
34 | 30 | "from arl.graphs.dask_init import get_dask_Client\n", |
35 | | - "from arl.image.iterators import image_raster_iter\n", |
36 | | - "from arl.image.operations import qa_image\n", |
37 | | - "from arl.util.testing_support import create_test_image\n", |
38 | | - "\n" |
| 31 | + "from arl.util.testing_support import create_test_image" |
39 | 32 | ] |
40 | 33 | }, |
41 | 34 | { |
|
48 | 41 | "outputs": [], |
49 | 42 | "source": [ |
50 | 43 | "frequency = numpy.array([1e8])\n", |
51 | | - "\n", |
52 | 44 | "phasecentre = SkyCoord(ra=+15.0 * u.deg, dec=-35.0 * u.deg, frame='icrs', equinox='J2000')\n", |
53 | | - "test_image = create_test_image(frequency=frequency, phasecentre=phasecentre,\n", |
54 | | - " cellsize=0.001,\n", |
55 | | - " polarisation_frame=PolarisationFrame('stokesI'))\n", |
56 | | - "\n", |
57 | | - "image_graph = arlexecute.execute(create_test_image)(frequency=frequency, phasecentre=phasecentre, cellsize=0.001,\n", |
58 | | - " polarisation_frame=PolarisationFrame('stokesI'))" |
| 45 | + "model_graph = arlexecute.execute(create_test_image)(frequency=frequency, phasecentre=phasecentre, cellsize=0.001,\n", |
| 46 | + " polarisation_frame=PolarisationFrame('stokesI'))\n", |
| 47 | + "model = arlexecute.get(model_graph)\n" |
59 | 48 | ] |
60 | 49 | }, |
61 | 50 | { |
|
77 | 66 | " im.data = numpy.sqrt(numpy.abs(im.data))\n", |
78 | 67 | " return im\n", |
79 | 68 | "\n", |
80 | | - "root = create_generic_image_graph(imagerooter, test_image, facets=4)\n", |
81 | | - "if arlexecute.use_dask:\n", |
82 | | - " root.visualize()\n", |
83 | | - "\n", |
84 | | - "print(root)" |
| 69 | + "root = create_generic_image_graph(imagerooter, model_graph, facets=4)" |
85 | 70 | ] |
86 | 71 | }, |
87 | 72 | { |
|
98 | 83 | "outputs": [], |
99 | 84 | "source": [ |
100 | 85 | "result = arlexecute.get(root)\n", |
101 | | - "numpy.testing.assert_array_almost_equal_nulp(result.data**2, numpy.abs(test_image.data), 7)" |
| 86 | + "numpy.testing.assert_array_almost_equal_nulp(result.data**2, numpy.abs(model.data), 7)" |
102 | 87 | ] |
103 | 88 | }, |
104 | 89 | { |
|
116 | 101 | "source": [ |
117 | 102 | "client = get_dask_Client()\n", |
118 | 103 | "result=client.compute(root, sync=True)\n", |
119 | | - "numpy.testing.assert_array_almost_equal_nulp(result.data**2, numpy.abs(test_image.data), 7)\n", |
| 104 | + "numpy.testing.assert_array_almost_equal_nulp(result.data**2, numpy.abs(model.data), 7)\n", |
120 | 105 | "client.close()" |
121 | 106 | ] |
| 107 | + }, |
| 108 | + { |
| 109 | + "cell_type": "code", |
| 110 | + "execution_count": null, |
| 111 | + "metadata": {}, |
| 112 | + "outputs": [], |
| 113 | + "source": [] |
122 | 114 | } |
123 | 115 | ], |
124 | 116 | "metadata": { |
|
0 commit comments