Changeset 67
- Timestamp:
- Sep 23, 2014 1:20:56 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/beamsgenerator.py
r43 r67 36 36 (mult-1)*rpix:(mult+1)*rpix, (mult-1)*rpix:(mult+1)*rpix] 37 37 38 return dirty_beam 38 # fit Gaussian to dirty beam 39 shape = numpy.shape(dirty_beam) 40 fitter = fitgaussian.FitGaussian() 41 dirty_centre = numpy.array(dirty_beam[shape[0]/2-5:shape[0]/2+5, 42 shape[1]/2-5:shape[1]/2+5]) 43 p = fitter.fitgaussian(dirty_centre) 44 45 # clean beam 46 cp = (1.0, float(shape[0])/2.0, float(shape[1])/2.0, p[3], p[4], p[5]) 47 rotgauss = fitter.gaussian(*cp) 48 bmax = numpy.max(dirty_beam) 49 clean_beam = numpy.fromfunction(rotgauss, numpy.shape(dirty_beam)) 50 51 return dirty_beam, clean_beam 39 52 40 53 def calculate_primary_beam(npix, rpix, mult, mx, my, bmax, m1_diameter, … … 142 155 self.result['primary amplitude beam'] = collections.OrderedDict() 143 156 self.result['dirty beam'] = collections.OrderedDict() 157 self.result['clean beam'] = collections.OrderedDict() 144 158 145 159 wnmax = np.max(fts_wn_truncated) … … 183 197 indata = (npix, rpix, mult, bmax, uvmapgen['bxby'], wnmax, wn,) 184 198 jobs[wn] = self.job_server.submit(calculate_dirty_beam, 185 indata, (), ('numpy', ))199 indata, (), ('numpy','fitgaussian',)) 186 200 187 201 … … 194 208 195 209 for wn in fts_wn_truncated: 196 dirty_beam = jobs[wn]()210 dirty_beam,clean_beam = jobs[wn]() 197 211 image = co.Image(data=dirty_beam, axes=[axis1, axis2], 198 212 title='Dirty Beam %06.4g cm-1' % wn) 199 213 self.result['dirty beam'][wn] = image 214 image = co.Image(data=clean_beam, axes=[axis1, axis2], 215 title='Clean Beam %06.4g cm-1' % wn) 216 self.result['clean beam'][wn] = image 200 217 201 218 return self.result
Note:
See TracChangeset
for help on using the changeset viewer.