def gaussian_2d(beam_params, bolo_params, mesh):
    factor = 2*np.sqrt(2*np.log(2))                                     #FWHM <--> sigma
    sigma = bolo_params.fwhm/factor

    #Building a circular Gaussian beam on the 2D mesh
    x,y = mesh
    beam_kernel = np.exp(-(x**2/(2*sigma**2) + y**2/(2*sigma**2)))
    
    #Normalising the circular Gaussian beam so that the integral is 1
    integral = np.sum(beam_kernel)*beam_params.beam_resolution**2
    #integral = 2*np.pi*sigma**2
    beam_kernel /= integral

    if bolo_params.conv_fwhm == 0.0:
        return beam_kernel, None
        #return <beam_kernel>, <conv_kernel>
    else:
        conv_kernel, del_x = convolution_kernel.get_beam(beam_params, bolo_params)
        beam_kernel = convolve2d(beam_kernel, conv_kernel, mode="same")*beam_params.beam_resolution
    return beam_kernel, conv_kernel
def gaussian_2d(beam_params, bolo_params, mesh):
    factor = 2*np.sqrt(2*np.log(2))                                     #FWHM <--> sigma
    sigma = bolo_params.fwhm/factor

    #Building a circular Gaussian beam on the 2D mesh
    x,y = mesh
    del_x, del_y = bolo_params.pointing_offset_x/60.0, bolo_params.pointing_offset_y/60.0
    beam_kernel = np.exp(-((x-del_x)**2/(2*sigma**2) + (y-del_y)**2/(2*sigma**2)))
    beam_kernel_symmetric = np.exp(-(x**2/(2*sigma**2) + y**2/(2*sigma**2)))
    
    #Normalising the circular Gaussian beam so that the integral is 1
    #integral = np.sum(beam_kernel)*beam_params.beam_resolution**2
    integral = 2*np.pi*sigma**2
    beam_kernel /= integral
    beam_kernel_symmetric /= integral

    if bolo_params.conv_fwhm == 0.0:
        return beam_kernel, None, beam_kernel_symmetric
        #return <beam_kernel>, <conv_kernel>
    else:
        conv_kernel, del_x = convolution_kernel.get_beam(beam_params, bolo_params)
        beam_kernel = convolve2d(beam_kernel, conv_kernel, mode="same")*beam_params.beam_resolution
    return beam_kernel, conv_kernel, beam_kernel_symmetric