Changeset 43


Ignore:
Timestamp:
Jun 10, 2014 10:43:56 AM (10 years ago)
Author:
JohnLightfoot
Message:

calculates beams only over truncated fts_wn

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/beamsgenerator.py

    r32 r43  
    77import common.commonobjects as co
    88
    9 def calculate_dirty_beam(npix, rpix, mult, bmax, bxbylist, wn_max, wn):
     9def calculate_dirty_beam(npix, rpix, mult, bmax, bxbylist, wnmax, wn):
    1010    lamb = 1.0 / (wn * 100.0)
    11     lambda_min = 1.0 / (wn_max * 100.0)
     11    lambda_min = 1.0 / (wnmax * 100.0)
    1212    maxbx = bmax / lambda_min
    1313
     
    3939
    4040def calculate_primary_beam(npix, rpix, mult, mx, my, bmax, m1_diameter,
    41   wn_max, wn):
     41  wnmax, wn):
    4242    # assume uniform illumination of primary. uv goes out to
    4343    # +- bmax / lambda_min, fill uv plane appropriate to primary
    4444    # size
    4545    mirror = numpy.ones([mult*npix,mult*npix])
    46     lambda_min = 1.0 / (wn_max * 100.0)
     46    lambda_min = 1.0 / (wnmax * 100.0)
    4747    lamb = 1.0 / (wn * 100.0)
    4848    mirror[(numpy.sqrt(mx*mx + my*my) / (mult*rpix)) *
     
    9999        nsample = fts['ftsnsample']
    100100        fts_wn = fts['fts_wn']
    101         fts_lambda = fts['fts_lambda']
     101        fts_wn_truncated = fts['fts_wn_truncated']
    102102     
    103103        # 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.
    105106        bmax = uvmapgen['bmax']
    106107        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)
    108111        self.result['max pixsize [rad]'] = max_pixsize
    109112
     
    111114        # radius of first null of Airy disk is theta=1.22lambda/d. Number of
    112115        # 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)) /\
    115119          telescope['Primary mirror diameter']
    116120        self.result['beam diam [rad]'] = 2.0 * max_beam_radius
     
    128132        axis1 = co.Axis(data=-axis, title='RA offset', units='arcsec')
    129133        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
    133137        # oversample uv grid by mult to minimise aliasing
    134138        mult = 5
     
    139143        self.result['dirty beam'] = collections.OrderedDict()
    140144
    141         wn_max = np.max(fts_wn)
     145        wnmax = np.max(fts_wn_truncated)
    142146        m1_diameter = telescope['Primary mirror diameter']
    143147
    144148        # first calculate primary beam for each wn
    145149        jobs = {}
    146         for wn in fts_wn:
     150        for wn in fts_wn_truncated:
    147151            # 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,
    149153              wn,)
    150154            jobs[wn] = self.job_server.submit(calculate_primary_beam,
    151155              indata, (), ('numpy',))
    152156
    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):
    155160            # collect and store results
    156161            primary_intensity_beam, primary_amplitude_beam[:,:,iwn] = jobs[wn]()
     
    164169
    165170        # second calculate dirty beam, same use of pp
    166         for wn in fts_wn:
     171        for wn in fts_wn_truncated:
    167172            #
    168173            # 1. uv plane covered by discrete points so should use a
     
    176181            # positions. Fastest but adequate?
    177182
    178             indata = (npix, rpix, mult, bmax, uvmapgen['bxby'], wn_max, wn,)
     183            indata = (npix, rpix, mult, bmax, uvmapgen['bxby'], wnmax, wn,)
    179184            jobs[wn] = self.job_server.submit(calculate_dirty_beam,
    180185              indata, (), ('numpy',))
     
    183188        # axes for dirty beam
    184189        axis = np.arange(-rpix, rpix, dtype=np.float)
    185         axis *= (np.min(fts_lambda) / bmax)
     190        axis *= (lambda_min / bmax)
    186191        axis *= 206264.806247
    187192        axis1 = co.Axis(data=-axis, title='RA offset', units='arcsec')
    188193        axis2 = co.Axis(data=axis, title='Dec offset', units='arcsec')
    189194
    190         for wn in fts_wn:
     195        for wn in fts_wn_truncated:
    191196            dirty_beam = jobs[wn]()
    192197            image = co.Image(data=dirty_beam, axes=[axis1, axis2],
Note: See TracChangeset for help on using the changeset viewer.