LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
Classes | Functions
lsst.skypix.quadsphere Namespace Reference

Classes

class  QuadSpherePixelization
 

Functions

def _rotX
 
def _rotY
 
def _rotZ
 
def _rotNX
 
def _rotNY
 
def _rotNZ
 
def createQuadSpherePixelization
 
def imageToPolygon
 

Function Documentation

def lsst.skypix.quadsphere._rotNX (   v,
  sin,
  cos 
)
private

Definition at line 47 of file quadsphere.py.

47 
48 def _rotNX(v, sin, cos):
49  return _rotX(v, -sin, cos)
50 
def lsst.skypix.quadsphere._rotNY (   v,
  sin,
  cos 
)
private

Definition at line 51 of file quadsphere.py.

51 
52 def _rotNY(v, sin, cos):
53  return _rotY(v, -sin, cos)
54 
def lsst.skypix.quadsphere._rotNZ (   v,
  sin,
  cos 
)
private

Definition at line 55 of file quadsphere.py.

55 
56 def _rotNZ(v, sin, cos):
57  return _rotZ(v, -sin, cos)
58 
def lsst.skypix.quadsphere._rotX (   v,
  sin,
  cos 
)
private

Definition at line 35 of file quadsphere.py.

35 
36 def _rotX(v, sin, cos):
37  return (v[0], v[1] * cos - v[2] * sin, v[1] * sin + v[2] * cos)
38 
def lsst.skypix.quadsphere._rotY (   v,
  sin,
  cos 
)
private

Definition at line 39 of file quadsphere.py.

39 
40 def _rotY(v, sin, cos):
41  return (v[0] * cos + v[2] * sin, v[1], -v[0] * sin + v[2] * cos)
42 
def lsst.skypix.quadsphere._rotZ (   v,
  sin,
  cos 
)
private

Definition at line 43 of file quadsphere.py.

43 
44 def _rotZ(v, sin, cos):
45  return (v[0] * cos - v[1] * sin, v[0] * sin + v[1] * cos, v[2])
46 
def lsst.skypix.quadsphere.createQuadSpherePixelization (   policy = None)

Definition at line 773 of file quadsphere.py.

774 def createQuadSpherePixelization(policy=None):
775  policyFile = pexPolicy.DefaultPolicyFile(
776  "skypix", "QuadSpherePixelizationDictionary.paf", "policy")
777  defaults = pexPolicy.Policy.createPolicy(
778  policyFile, policyFile.getRepositoryPath())
779  if policy is None:
780  policy = pexPolicy.Policy()
781  policy.mergeDefaults(defaults)
782  # Obtain resolution and padding from policy
783  resolution = policy.get('resolutionPix')
784  padding = math.radians(policy.get('paddingArcsec') / 3600.0)
785  return QuadSpherePixelization(resolution, padding)
786 
a container for holding hierarchical configuration data in memory.
Definition: Policy.h:169
a representation of a default Policy file that is stored as a file in the installation directory of a...
def lsst.skypix.quadsphere.imageToPolygon (   wcs,
  widthPix,
  heightPix,
  padRad = 0.0 
)
Computes and returns a spherical convex polygon approximation to the
region of the unit sphere covered by an image specified with a WCS and
a width/height (pixels). The polygon is computed by connecting the 
world coordinates of the 4 image corners with great circles, and can
optionally be padded by padRad radians.

Definition at line 787 of file quadsphere.py.

788 def imageToPolygon(wcs, widthPix, heightPix, padRad=0.0):
789  """Computes and returns a spherical convex polygon approximation to the
790  region of the unit sphere covered by an image specified with a WCS and
791  a width/height (pixels). The polygon is computed by connecting the
792  world coordinates of the 4 image corners with great circles, and can
793  optionally be padded by padRad radians.
794  """
795  # Compute image corners
796  cd = wcs.getCDMatrix()
797  xpad = math.degrees(padRad) / math.sqrt(cd[0, 0]**2 + cd[0, 1]**2)
798  ypad = math.degrees(padRad) / math.sqrt(cd[1, 0]**2 + cd[1, 1]**2)
799  xmin, ymin = -0.5 - xpad, -0.5 - ypad
800  xmax, ymax = widthPix + xpad - 0.5, heightPix + ypad - 0.5
801  # Produce a lsst.afw.coord.coordLib.Coord object for each vertex
802  coords = [wcs.pixelToSky(xmin, ymin), wcs.pixelToSky(xmax, ymin),
803  wcs.pixelToSky(xmax, ymax), wcs.pixelToSky(xmin, ymax)]
804  # Map these to python tuples containing cartesian unit vectors
805  verts = []
806  for c in coords:
807  verts.append(tuple(c.getVector()))
808  # and turn them into a spherical convex polygon
809  convex, cc = geom.convex(verts)
810  if not convex:
811  raise RuntimeError('Image corners do not form a convex polygon: ' + cc)
812  elif not cc:
813  verts.reverse()
814  return geom.SphericalConvexPolygon(verts)