processing_components/imaging/primary_beams.py
def create_vp_generic(model, pointingcentre=None, diameter=25.0, blockage=1.8, use_local=True):
    """
    Make an image like model and fill it with an analytical model of the primary beam
    :param model:
    :return:
    """
    beam = create_empty_image_like(model)
    beam.data = numpy.zeros(beam.data.shape, dtype='complex')
    
    nchan, npol, ny, nx = model.shape
    
    if pointingcentre is not None:
        cx, cy = pointingcentre.to_pixel(model.wcs, origin=0)
    else:
        cx, cy = beam.wcs.sub(2).wcs.crpix[0] - 1, beam.wcs.sub(2).wcs.crpix[1] - 1
    
    for chan in range(nchan):
        
        # The frequency axis is the second to last in the beam
        frequency = model.wcs.sub(['spectral']).wcs_pix2world([chan], 0)[0]
        wavelength = const.c.to('m s^-1').value / frequency
        
        d2r = numpy.pi / 180.0
        scale = d2r * numpy.abs(beam.wcs.sub(2).wcs.cdelt[0])
        xx, yy = numpy.meshgrid(scale * (range(nx) - cx), scale * (range(ny) - cy))
        # Radius of each cell in radians
        rr = numpy.sqrt(xx ** 2 + yy ** 2)
        
        blockage_factor = (blockage / diameter) ** 2
        
        for pol in range(npol):
            reflector = ft_disk(rr * numpy.pi * diameter / wavelength)
            blockage = ft_disk(rr * numpy.pi * blockage / wavelength)
            beam.data[chan, pol, ...] = reflector - blockage_factor * blockage
    
    set_pb_header(beam, use_local=use_local)
    return beam

    Make an image like model and fill it with an analytical model of the primary beam
    :param model:
    :return:
    
Make an image like model and fill it with an analytical model of the primary beam
Make an image like model and fill it with an analytical model of the primary beam
def create_vp_generic(model, pointingcentre=None, diameter=25.0, blockage=1.8, use_local=True):
    beam = create_empty_image_like(model)
    beam.data = numpy.zeros(beam.data.shape, dtype='complex')
    nchan, npol, ny, nx = model.shape
    if pointingcentre is not None:
        cx, cy = pointingcentre.to_pixel(model.wcs, origin=0)
    else:
        cx, cy = beam.wcs.sub(2).wcs.crpix[0] - 1, beam.wcs.sub(2).wcs.crpix[1] - 1
    for chan in range(nchan):
        frequency = model.wcs.sub(['spectral']).wcs_pix2world([chan], 0)[0]
        wavelength = const.c.to('m s^-1').value / frequency
        d2r = numpy.pi / 180.0
        scale = d2r * numpy.abs(beam.wcs.sub(2).wcs.cdelt[0])
        xx, yy = numpy.meshgrid(scale * (range(nx) - cx), scale * (range(ny) - cy))
        rr = numpy.sqrt(xx ** 2 + yy ** 2)
        blockage_factor = (blockage / diameter) ** 2
        for pol in range(npol):
            reflector = ft_disk(rr * numpy.pi * diameter / wavelength)
            blockage = ft_disk(rr * numpy.pi * blockage / wavelength)
            beam.data[chan, pol, ...] = reflector - blockage_factor * blockage
    set_pb_header(beam, use_local=use_local)
    return beam
def create_vp_generic ( model , pointingcentre = None , diameter = 25.0 , blockage = 1.8 , use_local = True ) : beam = create_empty_image_like ( model ) beam . data = numpy . zeros ( beam . data . shape , dtype = 'complex' ) nchan , npol , ny , nx = model . shape if pointingcentre is not None : cx , cy = pointingcentre . to_pixel ( model . wcs , origin = 0 ) else : cx , cy = beam . wcs . sub ( 2 ) . wcs . crpix [ 0 ] - 1 , beam . wcs . sub ( 2 ) . wcs . crpix [ 1 ] - 1 for chan in range ( nchan ) : frequency = model . wcs . sub ( [ 'spectral' ] ) . wcs_pix2world ( [ chan ] , 0 ) [ 0 ] wavelength = const . c . to ( 'm s^-1' ) . value / frequency d2r = numpy . pi / 180.0 scale = d2r * numpy . abs ( beam . wcs . sub ( 2 ) . wcs . cdelt [ 0 ] ) xx , yy = numpy . meshgrid ( scale * ( range ( nx ) - cx ) , scale * ( range ( ny ) - cy ) ) rr = numpy . sqrt ( xx ** 2 + yy ** 2 ) blockage_factor = ( blockage / diameter ) ** 2 for pol in range ( npol ) : reflector = ft_disk ( rr * numpy . pi * diameter / wavelength ) blockage = ft_disk ( rr * numpy . pi * blockage / wavelength ) beam . data [ chan , pol , ... ] = reflector - blockage_factor * blockage set_pb_header ( beam , use_local = use_local ) return beam
Make an image like model and fill it with an analytical model of the primary beam
Make an image like model and fill it with an analytical model of the primary beam
"""
    Make an image like model and fill it with an analytical model of the primary beam
    :param model:
    :return:
    """ # The frequency axis is the second to last in the beam # Radius of each cell in radians
None
model
None
pointingcentre
diameter
blockage
use_local