Skip to content

Commit 70d5647

Browse files
committed
Demonstrate meeting acceptanc criterion SIM-25
1 parent 97c44fc commit 70d5647

5 files changed

Lines changed: 101 additions & 4 deletions

File tree

‎data/models/MID_GRASP_VP_imag.fits‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:68a38fbd02f9b5e407460f13ea804203282700b8911cf3381e9f9ba7e29a04dd
2+
oid sha256:13179372fde611d5b4632cf07094c6d7c2e809f39c2f7ad78fc1c4b5df914e91
33
size 1267200

‎data/models/MID_GRASP_VP_real.fits‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:dcc5d6b32640127b4d3ce010979b423c31d73620b7d807b1f5e907ae6473075c
2+
oid sha256:00767dc6b73b7d42c582fd272ae6ee638eaf4854dcf87685263e3ae4de776f37
33
size 1267200

‎processing_components/imaging/primary_beams.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ def create_vp(model, telescope='MID', pointingcentre=None, padding=4, use_local=
7070
log.info("create_vp: Using no taper analytic model for MID voltage pattern")
7171
return create_vp_generic(model, pointingcentre=pointingcentre, diameter=15.0, blockage=0.0, use_local=use_local)
7272
elif telescope == 'MID_GRASP':
73-
real_vp = import_image_from_fits(arl_path('data/models/data/models/MID_GRASP_VP_real.fits'))
74-
imag_vp = import_image_from_fits(arl_path('data/models/data/models/MID_GRASP_VP_imag.fits'))
73+
real_vp = import_image_from_fits(arl_path('data/models/MID_GRASP_VP_real.fits'))
74+
imag_vp = import_image_from_fits(arl_path('data/models/MID_GRASP_VP_imag.fits'))
7575
real_vp.data = real_vp.data + 1j * imag_vp.data
76+
real_vp.data /= numpy.max(numpy.abs(real_vp.data))
7677
return real_vp
7778
elif telescope == 'MEERKAT':
7879
return create_vp_generic(model, pointingcentre=pointingcentre, diameter=13.5, blockage=0.0, use_local=use_local)

‎tests/processing_components/test_pointing.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,25 @@ def test_create_gaintable_from_pointingtable_global_dynamic(self):
168168
plt.show()
169169
assert gt[0].gain.shape == (self.ntimes, self.nants, 1, 1, 1), gt[0].gain.shape
170170

171+
def test_create_gaintable_from_pointingtable_GRASP(self):
172+
comp = create_skycomponent(direction=self.phasecentre, flux=[[1.0]], frequency=self.frequency,
173+
polarisation_frame=PolarisationFrame('stokesI'))
174+
175+
pt = create_pointingtable_from_blockvisibility(self.vis)
176+
pt = simulate_pointingtable(pt, pointing_error=0.0,
177+
static_pointing_error=0.0,
178+
global_pointing_error=[0.0, 0.01])
179+
vp = create_vp(self.model, 'MID_GRASP')
180+
gt = create_gaintable_from_pointingtable(self.vis, [comp], pt, vp)
181+
if self.doplot:
182+
import matplotlib.pyplot as plt
183+
plt.clf()
184+
plt.plot(gt[0].time, numpy.real(1.0 / gt[0].gain[:, 0, 0, 0, 0]), '.')
185+
plt.plot(gt[0].time, numpy.imag(1.0 / gt[0].gain[:, 0, 0, 0, 0]), '.')
186+
plt.title('test_create_gaintable_from_pointingtable_global_dynamic')
187+
plt.show()
188+
assert gt[0].gain.shape == (self.ntimes, self.nants, 1, 1, 1), gt[0].gain.shape
189+
190+
171191
if __name__ == '__main__':
172192
unittest.main()
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
""" Unit tests for pointing
2+
3+
"""
4+
5+
import logging
6+
import unittest
7+
8+
import astropy.units as u
9+
import numpy
10+
from astropy.coordinates import SkyCoord
11+
12+
from data_models.polarisation import PolarisationFrame
13+
14+
from processing_components.skycomponent.operations import create_skycomponent
15+
from processing_components.calibration.pointing import create_pointingtable_from_blockvisibility
16+
from processing_components.imaging.primary_beams import create_vp
17+
from processing_components.simulation.configurations import create_named_configuration
18+
from processing_components.simulation.pointing import create_gaintable_from_pointingtable
19+
from processing_components.simulation.testing_support import create_test_image, simulate_pointingtable
20+
from processing_components.simulation.testing_support import create_test_skycomponents_from_s3
21+
from processing_components.visibility.base import create_blockvisibility
22+
from processing_library.image.operations import create_image
23+
24+
log = logging.getLogger(__name__)
25+
26+
27+
class TestPointing(unittest.TestCase):
28+
def setUp(self):
29+
from data_models.parameters import arl_path
30+
31+
self.doplot = True
32+
33+
self.midcore = create_named_configuration('MID', rmax=300.0)
34+
self.nants = len(self.midcore.names)
35+
self.dir = arl_path('test_results')
36+
self.ntimes = 300
37+
self.times = numpy.linspace(-12.0, 12.0, self.ntimes) * numpy.pi / (12.0)
38+
39+
self.frequency = numpy.array([1e9])
40+
self.channel_bandwidth = numpy.array([1e7])
41+
self.phasecentre = SkyCoord(ra=+15.0 * u.deg, dec=-90.0 * u.deg, frame='icrs', equinox='J2000')
42+
self.vis = create_blockvisibility(self.midcore, self.times, self.frequency,
43+
channel_bandwidth=self.channel_bandwidth,
44+
phasecentre=self.phasecentre, weight=1.0,
45+
polarisation_frame=PolarisationFrame('stokesI'))
46+
self.vis.data['vis'] *= 0.0
47+
48+
# Create model
49+
self.model = create_image(npixel=2048, cellsize=0.00015, polarisation_frame=PolarisationFrame("stokesI"),
50+
frequency=self.frequency, channel_bandwidth=self.channel_bandwidth,
51+
phasecentre=self.phasecentre)
52+
53+
def test_create_gaintable_from_pointingtable_roll(self):
54+
self.sidelobe = SkyCoord(ra=+15.0 * u.deg, dec=-88.5 * u.deg, frame='icrs', equinox='J2000')
55+
comp = create_skycomponent(direction=self.sidelobe, flux=[[1.0]], frequency=self.frequency,
56+
polarisation_frame=PolarisationFrame('stokesI'))
57+
58+
for telescope in ['MID', 'MID_GAUSS', 'MID_GRASP']:
59+
pt = create_pointingtable_from_blockvisibility(self.vis)
60+
pt = simulate_pointingtable(pt, pointing_error=0.0,
61+
static_pointing_error=0.0,
62+
global_pointing_error=[0.0, 0.0])
63+
vp = create_vp(self.model, telescope)
64+
gt = create_gaintable_from_pointingtable(self.vis, [comp], pt, vp)
65+
if self.doplot:
66+
import matplotlib.pyplot as plt
67+
plt.clf()
68+
plt.plot(gt[0].time, numpy.real(1.0 / gt[0].gain[:, 0, 0, 0, 0]), '.')
69+
plt.plot(gt[0].time, numpy.imag(1.0 / gt[0].gain[:, 0, 0, 0, 0]), '.')
70+
plt.title('test_create_gaintable_from_pointingtable_%s' % telescope)
71+
plt.show()
72+
assert gt[0].gain.shape == (self.ntimes, self.nants, 1, 1, 1), gt[0].gain.shape
73+
74+
75+
if __name__ == '__main__':
76+
unittest.main()

0 commit comments

Comments
 (0)