Changeset 43
- Timestamp:
- Jun 10, 2014 10:43:56 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/beamsgenerator.py
r32 r43 7 7 import common.commonobjects as co 8 8 9 def calculate_dirty_beam(npix, rpix, mult, bmax, bxbylist, wn _max, wn):9 def calculate_dirty_beam(npix, rpix, mult, bmax, bxbylist, wnmax, wn): 10 10 lamb = 1.0 / (wn * 100.0) 11 lambda_min = 1.0 / (wn _max * 100.0)11 lambda_min = 1.0 / (wnmax * 100.0) 12 12 maxbx = bmax / lambda_min 13 13 … … 39 39 40 40 def calculate_primary_beam(npix, rpix, mult, mx, my, bmax, m1_diameter, 41 wn _max, wn):41 wnmax, wn): 42 42 # assume uniform illumination of primary. uv goes out to 43 43 # +- bmax / lambda_min, fill uv plane appropriate to primary 44 44 # size 45 45 mirror = numpy.ones([mult*npix,mult*npix]) 46 lambda_min = 1.0 / (wn _max * 100.0)46 lambda_min = 1.0 / (wnmax * 100.0) 47 47 lamb = 1.0 / (wn * 100.0) 48 48 mirror[(numpy.sqrt(mx*mx + my*my) / (mult*rpix)) * … … 99 99 nsample = fts['ftsnsample'] 100 100 fts_wn = fts['fts_wn'] 101 fts_ lambda = fts['fts_lambda']101 fts_wn_truncated = fts['fts_wn_truncated'] 102 102 103 103 # max pixel size (radians) that will fully sample the image. 104 # Sampling freq is 2 * Nyquist freq. So sampling freq = 2 * b_max / lambda_min. 104 # Sampling freq is 2 * Nyquist freq. 105 # So sampling freq = 2 * b_max / lambda_min. 105 106 bmax = uvmapgen['bmax'] 106 107 self.result['max baseline [m]'] = bmax 107 max_pixsize = np.min(fts_lambda) / (2.0 * bmax) 108 109 lambda_min = 1.0 / (np.max(fts_wn) * 100.0) 110 max_pixsize = lambda_min / (2.0 * bmax) 108 111 self.result['max pixsize [rad]'] = max_pixsize 109 112 … … 111 114 # radius of first null of Airy disk is theta=1.22lambda/d. Number of 112 115 # pixels is beam diameter/max_pixsize. Calculate this for the 113 # longest wavelength, largest beam 114 max_beam_radius = 1.22 * np.max(fts_lambda) /\ 116 # longest wavelength that has flux (at wnmin), largest beam 117 118 max_beam_radius = 1.22 * (1.0 / (np.min(fts_wn_truncated) * 100.0)) /\ 115 119 telescope['Primary mirror diameter'] 116 120 self.result['beam diam [rad]'] = 2.0 * max_beam_radius … … 128 132 axis1 = co.Axis(data=-axis, title='RA offset', units='arcsec') 129 133 axis2 = co.Axis(data=axis, title='Dec offset', units='arcsec') 130 axis3 = co.Axis(data=fts_wn , title='Frequency', units='cm-1')131 132 # calculate beams for each point on fts_wn 134 axis3 = co.Axis(data=fts_wn_truncated, title='Frequency', units='cm-1') 135 136 # calculate beams for each point on fts_wn_truncated 133 137 # oversample uv grid by mult to minimise aliasing 134 138 mult = 5 … … 139 143 self.result['dirty beam'] = collections.OrderedDict() 140 144 141 wn _max = np.max(fts_wn)145 wnmax = np.max(fts_wn_truncated) 142 146 m1_diameter = telescope['Primary mirror diameter'] 143 147 144 148 # first calculate primary beam for each wn 145 149 jobs = {} 146 for wn in fts_wn :150 for wn in fts_wn_truncated: 147 151 # submit jobs 148 indata = (npix, rpix, mult, mx, my, bmax, m1_diameter, wn _max,152 indata = (npix, rpix, mult, mx, my, bmax, m1_diameter, wnmax, 149 153 wn,) 150 154 jobs[wn] = self.job_server.submit(calculate_primary_beam, 151 155 indata, (), ('numpy',)) 152 156 153 primary_amplitude_beam = np.zeros([npix,npix,len(fts_wn)], np.complex) 154 for iwn,wn in enumerate(fts_wn): 157 primary_amplitude_beam = np.zeros([npix,npix,len(fts_wn_truncated)], 158 np.complex) 159 for iwn,wn in enumerate(fts_wn_truncated): 155 160 # collect and store results 156 161 primary_intensity_beam, primary_amplitude_beam[:,:,iwn] = jobs[wn]() … … 164 169 165 170 # second calculate dirty beam, same use of pp 166 for wn in fts_wn :171 for wn in fts_wn_truncated: 167 172 # 168 173 # 1. uv plane covered by discrete points so should use a … … 176 181 # positions. Fastest but adequate? 177 182 178 indata = (npix, rpix, mult, bmax, uvmapgen['bxby'], wn _max, wn,)183 indata = (npix, rpix, mult, bmax, uvmapgen['bxby'], wnmax, wn,) 179 184 jobs[wn] = self.job_server.submit(calculate_dirty_beam, 180 185 indata, (), ('numpy',)) … … 183 188 # axes for dirty beam 184 189 axis = np.arange(-rpix, rpix, dtype=np.float) 185 axis *= ( np.min(fts_lambda)/ bmax)190 axis *= (lambda_min / bmax) 186 191 axis *= 206264.806247 187 192 axis1 = co.Axis(data=-axis, title='RA offset', units='arcsec') 188 193 axis2 = co.Axis(data=axis, title='Dec offset', units='arcsec') 189 194 190 for wn in fts_wn :195 for wn in fts_wn_truncated: 191 196 dirty_beam = jobs[wn]() 192 197 image = co.Image(data=dirty_beam, axes=[axis1, axis2],
Note:
See TracChangeset
for help on using the changeset viewer.