code: def meanangledAngle(self,dangle,smallest=False):
          
          if smallest: eigIndx= 0
          else: eigIndx= 1
          aplow= numpy.amax([numpy.sqrt(self._sortedSigOEig[eigIndx])\
                                 *self._tdisrupt*5.,
                             self._sigangle])
          num= integrate.quad(lambda x: x*self.pangledAngle(x,dangle,smallest),
                              aplow,-aplow)[0]
          denom= integrate.quad(self.pangledAngle,aplow,-aplow,
                                (dangle,smallest))[0]
          if denom == 0.: return numpy.nan
          else: return num/denom
docs: NAME:
  
             meanangledAngle
  
          PURPOSE:
  
             calculate the mean perpendicular angle at a given angle
  
          INPUT:
  
             dangle - angle offset along the stream
  
             smallest= (False) calculate for smallest eigenvalue direction rather than for middle
  
          OUTPUT:
  
             mean perpendicular angle
  
          HISTORY:
  
             2013-12-06 - Written - Bovy (IAS)