LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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 36 of file quadsphere.py.

36 
37 def _rotNX(v, sin, cos):
return _rotX(v, -sin, cos)
def lsst.skypix.quadsphere._rotNY (   v,
  sin,
  cos 
)
private

Definition at line 38 of file quadsphere.py.

38 
39 def _rotNY(v, sin, cos):
return _rotY(v, -sin, cos)
def lsst.skypix.quadsphere._rotNZ (   v,
  sin,
  cos 
)
private

Definition at line 40 of file quadsphere.py.

40 
41 def _rotNZ(v, sin, cos):
42  return _rotZ(v, -sin, cos)
43 
def lsst.skypix.quadsphere._rotX (   v,
  sin,
  cos 
)
private

Definition at line 30 of file quadsphere.py.

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

Definition at line 32 of file quadsphere.py.

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

Definition at line 34 of file quadsphere.py.

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

Definition at line 755 of file quadsphere.py.

756 def createQuadSpherePixelization(policy=None):
757  policyFile = pexPolicy.DefaultPolicyFile(
758  "skypix", "QuadSpherePixelizationDictionary.paf", "policy")
759  defaults = pexPolicy.Policy.createPolicy(
760  policyFile, policyFile.getRepositoryPath())
761  if policy is None:
762  policy = pexPolicy.Policy()
763  policy.mergeDefaults(defaults)
764  # Obtain resolution and padding from policy
765  resolution = policy.get('resolutionPix')
766  padding = math.radians(policy.get('paddingArcsec') / 3600.0)
767  return QuadSpherePixelization(resolution, padding)
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 768 of file quadsphere.py.

769 def imageToPolygon(wcs, widthPix, heightPix, padRad=0.0):
770  """Computes and returns a spherical convex polygon approximation to the
771  region of the unit sphere covered by an image specified with a WCS and
772  a width/height (pixels). The polygon is computed by connecting the
773  world coordinates of the 4 image corners with great circles, and can
774  optionally be padded by padRad radians.
775  """
776  # Compute image corners
777  cd = wcs.getCDMatrix()
778  xpad = math.degrees(padRad) / math.sqrt(cd[0,0]**2 + cd[0,1]**2)
779  ypad = math.degrees(padRad) / math.sqrt(cd[1,0]**2 + cd[1,1]**2)
780  xmin, ymin = -0.5 - xpad, -0.5 - ypad
781  xmax, ymax = widthPix + xpad - 0.5, heightPix + ypad - 0.5
782  # Produce a lsst.afw.coord.coordLib.Coord object for each vertex
783  coords = [wcs.pixelToSky(xmin, ymin), wcs.pixelToSky(xmax, ymin),
784  wcs.pixelToSky(xmax, ymax), wcs.pixelToSky(xmin, ymax)]
785  # Map these to python tuples containing cartesian unit vectors
786  verts = []
787  for c in coords:
788  verts.append(tuple(c.getVector()))
789  # and turn them into a spherical convex polygon
790  convex, cc = geom.convex(verts)
791  if not convex:
792  raise RuntimeError('Image corners do not form a convex polygon: ' + cc)
793  elif not cc:
794  verts.reverse()
795  return geom.SphericalConvexPolygon(verts)
796