:py:mod:`aces.utilities.emsim.readmat` ====================================== .. py:module:: aces.utilities.emsim.readmat Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: aces.utilities.emsim.readmat.grid_from_file aces.utilities.emsim.readmat.field_from_file aces.utilities.emsim.readmat.interpolate_sub_slow aces.utilities.emsim.readmat.interp_weights aces.utilities.emsim.readmat.interpolate aces.utilities.emsim.readmat.interpolate_sub Attributes ~~~~~~~~~~ .. autoapisummary:: aces.utilities.emsim.readmat.N_REGIONS aces.utilities.emsim.readmat.POINTS_PER_REGION aces.utilities.emsim.readmat.N_PORTS aces.utilities.emsim.readmat.portmapx aces.utilities.emsim.readmat.portmapy aces.utilities.emsim.readmat.portmap aces.utilities.emsim.readmat.portmap .. py:data:: N_REGIONS :value: 54 .. py:data:: POINTS_PER_REGION :value: 961 .. py:data:: N_PORTS :value: 188 .. py:data:: portmapx .. py:data:: portmapy .. py:data:: portmap .. py:data:: portmap .. py:function:: grid_from_file(regions_fname, n_regions=N_REGIONS) Load cartesian grid and differential solid angle from .mat files made by Stuart's simulations of ASKAP patterns Args: regions_fname (str): n_regions (int): Returns: xyz (`numpy.ndarray`): with (x,y,z) cartesian coordinates defining unit vector describing angle one row per coordinate with each coordinate in a separate column, real valued. domega (`numpy.ndarray`): vector of differential solid angle for each pattern point, real valued. .. py:function:: field_from_file(field_fname, n_regions=N_REGIONS, debug=False) Load far-field electric field (far-field pattern) from Stuart's simulations of ASKAP patterns Args: field_fname (str): template name of field file n_regions (int): number of regions (each in individual .mat file) debug (bool): print debug info if True Returns: e_field (`numpy.ndarray`): Ex,Ey,Ez field components in columns and one row per simulation point (direction) complex valued .. py:function:: interpolate_sub_slow(e_field, xyz, xyz_target) Interpolate function at finite list of coordinates that are not necessarily on a grid Interpolation is performed in the Sin projection, with tangent at the positive x direction that is the forward hemisphere of the antenna pattern. This is probably okay near the boresight. Args: e_field (`numpy.ndarray`): Complex valued function of direction in 3-space xyz (`numpy.ndarray`): Grid points representing directions in 3-space at which e_field is evaluated xyz_target (`numpy.ndarray`): List of specific directions in 3-space to interpolate at Returns: e_interp (`numpy.ndarray`): Values of e_field at directions xyz_target .. py:function:: interp_weights(xy, uv, d=2) Setup function for reimplementation of scipy.interpolate.griddata to avoid repeating setup for repeated interpolation for common input and output grids. 1. Call sp.spatial.qhull.Dealunay is made to triangulate the irregular grid coordinates. 2. For each point in the new grid, the triangulation is searched to find in which triangle (actually, in which simplex, which in your 3D case will be in which tetrahedron) does it lay. 3. The barycentric coordinates of each new grid point with respect to the vertices of the enclosing simplex are computed. From http://stackoverflow.com/questions/20915502 Args: xy: existing coordinates for available data uv: points to interpolate to d: dimension Returns: vertices: weights: .. py:function:: interpolate(values, vtx, wts) Reimplementation of scipy.interpolate.griddata to avoid repeating setup for repeated interpolation for common input and output grids. 4. An interpolated values is computed for that grid point, using the barycentric coordinates, and the values of the function at the vertices of the enclosing simplex. http://stackoverflow.com/questions/20915502 Args: values: available data vtx: vertices from interp_weights() wts: weights from interp_weights() Returns: values interpolated to points determined by setup function interp_weights() .. py:function:: interpolate_sub(e_field, xyz, xyz_target) Interpolate function at finite list of coordinates that are not necessarily on a grid Interpolation is performed in the Sin projection, with tangent at the positive x direction that is the forward hemisphere of the antenna pattern. This is probably okay near the boresight. Args: e_field (`numpy.ndarray`): Complex valued function of direction in 3-space xyz (`numpy.ndarray`): Grid points representing directions in 3-space at which e_field is evaluated xyz_target (`numpy.ndarray`): List of specific directions in 3-space to interpolate at Returns: e_interp (`numpy.ndarray`): Values of e_field at directions xyz_target