parameters: (self, normals, fraction=1.)
return_statement: return intensity
docstring: Calculates the illumination intensity for the normal vectors of a
          surface using the defined azimuth and elevation for the light source.
          Imagine an artificial sun placed at infinity in some azimuth and
          elevation position illuminating our surface. The parts of the surface
          that slope toward the sun should brighten while those sides facing away
          should become darker.
          Parameters
          ----------
          fraction : number, optional
              Increases or decreases the contrast of the hillshade.  Values
              greater than one will cause intermediate values to move closer to
              full illumination or shadow (and clipping any values that move
              beyond 0 or 1). Note that this is not visually or mathematically
              the same as vertical exaggeration.
          Returns
          -------
          intensity : ndarray
              A 2d array of illumination values between 0-1, where 0 is
              completely in shadow and 1 is completely illuminated.
docstring_summary: Calculates the illumination intensity for the normal vectors of a
          surface using the defined azimuth and elevation for the light source.
          Imagine an artificial sun placed at infinity in some azimuth and
          elevation position illuminating our surface. The parts of the surface
          that slope toward the sun should brighten while those sides facing away
          should become darker.
          Parameters
          ----------
          fraction : number, optional
              Increases or decreases the contrast of the hillshade.  Values
              greater than one will cause intermediate values to move closer to
              full illumination or shadow (and clipping any values that move
              beyond 0 or 1). Note that this is not visually or mathematically
              the same as vertical exaggeration.
          Returns
          -------
          intensity : ndarray
              A 2d array of illumination values between 0-1, where 0 is
              completely in shadow and 1 is completely illuminated.
docstring_tokens: Calculates the illumination intensity for the normal vectors of a surface using the defined azimuth and elevation for the light source . Imagine an artificial sun placed at infinity in some azimuth and elevation position illuminating our surface . The parts of the surface that slope toward the sun should brighten while those sides facing away should become darker . Parameters ---------- fraction : number optional Increases or decreases the contrast of the hillshade . Values greater than one will cause intermediate values to move closer to full illumination or shadow ( and clipping any values that move beyond 0 or 1 ) . Note that this is not visually or mathematically the same as vertical exaggeration . Returns ------- intensity : ndarray A 2d array of illumination values between 0 - 1 where 0 is completely in shadow and 1 is completely illuminated .
function: def shade_normals(self, normals, fraction=1.):
          """
          Calculates the illumination intensity for the normal vectors of a
          surface using the defined azimuth and elevation for the light source.
          Imagine an artificial sun placed at infinity in some azimuth and
          elevation position illuminating our surface. The parts of the surface
          that slope toward the sun should brighten while those sides facing away
          should become darker.
          Parameters
          ----------
          fraction : number, optional
              Increases or decreases the contrast of the hillshade.  Values
              greater than one will cause intermediate values to move closer to
              full illumination or shadow (and clipping any values that move
              beyond 0 or 1). Note that this is not visually or mathematically
              the same as vertical exaggeration.
          Returns
          -------
          intensity : ndarray
              A 2d array of illumination values between 0-1, where 0 is
              completely in shadow and 1 is completely illuminated.
          """
  
          intensity = normals.dot(self.direction)
  
          # Apply contrast stretch
          imin, imax = intensity.min(), intensity.max()
          intensity *= fraction
  
          # Rescale to 0-1, keeping range before contrast stretch
          # If constant slope, keep relative scaling (i.e. flat should be 0.5,
          # fully occluded 0, etc.)
          if (imax - imin) > 1e-6:
              # Strictly speaking, this is incorrect. Negative values should be
              # clipped to 0 because they're fully occluded. However, rescaling
              # in this manner is consistent with the previous implementation and
              # visually appears better than a "hard" clip.
              intensity -= imin
              intensity /= (imax - imin)
          intensity = np.clip(intensity, 0, 1)
  
          return intensity
function_tokens: def shade_normals ( self , normals , fraction = 1. ) : intensity = normals . dot ( self . direction ) # Apply contrast stretch imin , imax = intensity . min ( ) , intensity . max ( ) intensity *= fraction # Rescale to 0-1, keeping range before contrast stretch # If constant slope, keep relative scaling (i.e. flat should be 0.5, # fully occluded 0, etc.) if ( imax - imin ) > 1e-6 : # Strictly speaking, this is incorrect. Negative values should be # clipped to 0 because they're fully occluded. However, rescaling # in this manner is consistent with the previous implementation and # visually appears better than a "hard" clip. intensity -= imin intensity /= ( imax - imin ) intensity = np . clip ( intensity , 0 , 1 ) return intensity