aces.obsplan.tile¶
Routines to support tiling the spherical sky.
Module Contents¶
Classes¶
The Tile object represents a single tile, uniquely defined within a set by location on the celestial |
|
This class performs operations on polygons defined on the unit sphere. It includes an implementation of |
|
Some stuff for playing with ellipsoids |
Functions¶
|
Add a prefix to a word, unless it is already present. |
|
Find the angle equivalent to x in the range [-semi, semi] where |
|
Return a Skypos object given the direction as a 3-vector |
|
Convert a 3-vector direction to (longitude, latitude) pair. |
|
Find the pole of the great circle that passes through p1, p2. |
|
Given two great circles, specified by their poles, find the two intersection points. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns the area of a spherical polygon in steradians |
|
|
|
|
|
|
|
|
|
|
|
|
|
Computes sky positions and position angles for all positions in a |
|
Take a set of tile positions and sizes and return a mask array of the same size with values set False for all tiles |
|
|
|
|
|
|
|
|
|
|
|
Attributes¶
- aces.obsplan.tile.prefix(word, pfx)[source]¶
Add a prefix to a word, unless it is already present. :param word: The string to be prefixed :param pfx: The prefix :return: The prefixed word.
- class aces.obsplan.tile.Tile(ident, lon, lat, posang)[source]¶
Bases:
objectThe Tile object represents a single tile, uniquely defined within a set by location on the celestial sphere, and position angle. All tiles share parameters that are set in the initialise class method that must be called before any Tile object can be created.
- Parameters:
ident (int) – Integer identifier
lon (float) – tile position in longitude (radians)
lat (float) – tile position in latitude (radians)
posang (float) – tile position angle (degrees)
- classmethod initialise(origin, label, footprint, bf_pa, coord='J2000')[source]¶
Initialise the class variables for all subsequent creations of Tile objects. :param origin: Centre of tile sphere in given coordinates as Skypos :type origin: Skypos :param label: Label for tiling; used in names of all related product files :type label: string :param footprint: Footprint object used for this tiling :type footprint: Footprint :param bf_pa: beam-forming position angle (degrees) :type bf_pa: float :param coord: Name of coordinates of tiling (‘J2000’, ‘GALAC’, ‘MAGEL’) :type coord string
- __str__()[source]¶
- Returns:
A formatted string giving tile id, celestial position and position angle
- check_accessible()[source]¶
This function is trivial: it checks for tile positions beyond ASKAP’s northern limit. But could be extended to incorporate additional position constraints. :return: Whether a tile at this position is accessible by ASKAP.
- get_overlay(kind='ds9')[source]¶
Returns a string suitable for overlaying the tile outline on sky maps. Supported kinds are ds9 (works with aladin) and kvis. The string can be written to a file to be presented to image display program. :param kind: “ds9” or “kvis” :return: A formatted string describing the tile outline in the requested format.
- get_overlay_label(label, kind='ds9')[source]¶
Returns a string suitable for overlaying the given label on sky maps and the current tile position. Supported kinds are ds9 (works with aladin) and kvis. The string can be written to a file to be presented to image display program.
- Parameters:
label – The label
kind – “ds9” or “kvis”
- Returns:
A formatted string giving label and its position in correct format
- get_footprint_cmd(kind='ds9')[source]¶
Returns a command line string that will execute the footprint-plan.py script that produces plots and overlays of the beam positions within a footprint. For example:
footprint-plan.py -n ak:square_6x6 -p 0.9 -r 141.382178,-37.100000 -o 141-37 -f kvis -w 0.9 :return: The command line string.
- get_parset_entry(with_interleave=True)[source]¶
Returns the parset entries for observing this tile, and optionally, the interleaved positions. The entry keys are * common.target.src%d.field_direction * common.target.src%d.field_name * common.target.src%d.pol_axis The “%d” formatting code is replaced by the tile identifier number elsewhere.
- Parameters:
with_interleave –
- Returns:
A list of strings, each of the form <key> = <value>
- get_corners()[source]¶
Returns the sky coordinates in the J2000 celestial coordinate frame of each corner for this tile. :return: ndarray of Skypos objects holding the four corner coordinates.
- get_poly()[source]¶
Returns the sky coordinates in the J2000 celestial coordinate frame of each corner for this tile. :return: list of Skypos objects holding the four corner coordinates.
- get_poly_native()[source]¶
Returns the sky coordinates in the user-specified tiling coordinate frame of each corner for this tile. :return: list of Skypos objects holding the four corner coordinates.
- get_interleaved_tile(quadrant=0)[source]¶
Returns a tile that is offset from the current tile by half the tile spacing in both cardinal directions. The sign of each offset is determined by the value of quadrant. This form of interleaving differs from the standard “beam interleaving” in which the interleaved position is offset from the original by a fraction of a beam spacing so as to place the new beam positions in the sensitivity minima of the original tile position. The offset returned by this procedure is intended to smooth sensitivity variations that are dependent on axial distance, independent of beam position. For all-sky tilings, it is of limited use as the set of interleaved tiles do not as neatly tile the sky. :param quadrant: :return: A new Tile object offset froom the current tile.
- _set_posang_deg()[source]¶
Return the required antenna position angle, which differs from the tile position angle by the position angle used at beam forming. :return: Antenna position angle (degrees).
- aces.obsplan.tile.ang_unwrap(x, semi)[source]¶
Find the angle equivalent to x in the range [-semi, semi] where semi is the half-turn angle in the same units as x. Mostly, semi will be either 180 or pi. :param x: Given angle :param semi: Half-turn angle in same angular units as x :return: Angle equivalent to x in range [-semi, semi]
- aces.obsplan.tile.vec_skp(vec)[source]¶
Return a Skypos object given the direction as a 3-vector :param vec: The given direction :return: Direction as Skypos object
- aces.obsplan.tile.xyz_rd(v)[source]¶
Convert a 3-vector direction to (longitude, latitude) pair. :param v: Given direction as 3-vector :return: (longitude, latitude) pair (radians)
- aces.obsplan.tile.get_gc_pole(p1, p2)[source]¶
Find the pole of the great circle that passes through p1, p2. :param p1: Skypos object :param p2: Skypos object :return: A Skypos object giving the direction of one of the poles of the great circle passing though the two input positions.
- aces.obsplan.tile.get_gc_intersect(s1, s2)[source]¶
Given two great circles, specified by their poles, find the two intersection points. :param s1: Pole of first great circle as Skypos object :param s2: Pole of second great circle as Skypos object :return: A list of the two Skypos objects representing the two intersection points.
- aces.obsplan.tile.get_tiling(tile_pitch, beam_pitch, lat_range, cap_radius, expansion='symmetric', mode='squeeze')[source]¶
- aces.obsplan.tile.polygon_area(poly)[source]¶
Returns the area of a spherical polygon in steradians :param (ndarray) Array of polygon vertices of type Skypos
- aces.obsplan.tile.tile_polygon(tile_pitches, polygon, force_symmetry=False)[source]¶
Computes sky positions and position angles for all positions in a quasi-rectangular grid and any interleaving points for each grid position. centre Skypos (ra,dec) of grid centre angle position angle of rectangle (radians) dela “horizontal” grid spacing (radians) deld “vertical” grid spacing (radians) nx,ny number of points horizontally, vertically iofs is a list of pairs, each pair an intereaving offset in polar (d,pa) (radians) long_shift Shifts the area along the “horizontal” great circle (radians)
- aces.obsplan.tile.mask_tiles(tilpos, tile_pitches, polygons)[source]¶
Take a set of tile positions and sizes and return a mask array of the same size with values set False for all tiles within any of the given polygons. The test for position relative to the polygons is based on the method of Bevis and Chatelain, with added steps to allow for polygon sides traversing a tile but with neither the tile centre or its corners falling within the polygon.
- Parameters:
tilpos – ndarray of shape [num_tiles, 3] giving tile locations and position angles (radians)
tile_pitches – length rectangular tile sides (radians)
polygons – list of polygons, each an ndarray of vertices as Skypos objects.
- Returns:
ndarray of booleans shape [num_tiles]
- class aces.obsplan.tile.SphericalPolygon(polygon, external)[source]¶
Bases:
objectThis class performs operations on polygons defined on the unit sphere. It includes an implementation of the Bevis and Chatelain method for determining whether a point on the unit sphere lies inside a polygon on that surface. The concept of “inside” is solidified by defining the input point (xlon,xlat) to be “outside” the polygon. Find a reference to the method at https://www.researchgate.net/publication/227017249_Locating_a_point_on_a_spherical_surface_relative_to_a_spherical_polygon Other methods exist, some claiming to be much more computationally efficient. For the application here, polygons with relatively few vertices are envisaged (10s or 100s), so computation time is not a serious concern. Other potential sources for this function are astropy.regions (seems immature at this time (2021November) and pyregion, which claims to parse ds9 region files and do some region computation, but does not suit this application.
This method has the advantage of resorting to the fundamental geometric mathematics and will not suffer from updates in any external package.
- class aces.obsplan.tile.EllipsoidTool[source]¶
Some stuff for playing with ellipsoids
- get_min_vol_ellipse(P=None, tolerance=0.01)[source]¶
Find the minimum volume ellipsoid which holds all the points
Based on work by Nima Moshtagh http://www.mathworks.com/matlabcentral/fileexchange/9542 and also by looking at: http://cctbx.sourceforge.net/current/python/scitbx.math.minimum_covering_ellipsoid.html Which is based on the first reference anyway!
Here, P is a numpy array of N dimensional points like this: .. code-block:
P = [[x,y,z,...], <-- one point per line [x,y,z,...], [x,y,z,...]]
Returns: (center, radii, rotation)