Next / Previous / Contents / NM Tech homepage

6.33. CBCData.__circleSep(): Compute the separation of two circles

pycbc.py
# - - -   C B C D a t a . _ _ c i r c l e S e p

    def __circleSep ( self, fromCircle, toCircle):
        '''How many circle diameters separate these circles?

          [ fromCircle and toCircle are Circle instances ->
              return the distance between their centers as a
              fraction of CIRCLE_DIAMETER ]
        '''

For the interface to the author's mapping package, refer to Section 6.2, “Imports”. The terrapos.LatLon() constructor accepts two arguments, each of which is a tuple (D, M) where D is degrees and M is minutes. For the conversion from string coordinates to positions in the terrapos package, see Section 6.34, “CBCData.__terraCircle(): Convert a circle center to a terrestrial position”.

pycbc.py
        #-- 1 --
        # [ fromPos  :=  fromCircle's center as a terrapos.LatLon
        #   toPos  :=  toCircle's center as a terrapos.LatLon ]
        fromPos = self.__terraCircle ( fromCircle )
        toPos = self.__terraCircle ( toCircle )

In the terrapos package, the method LatLon.crowFeet() gives the distance in feet between two positions. We divide that by the number of feet in a circle diameter to normalize the value to diameters.

pycbc.py
        #-- 2 --
        # [ sep  :=  (distance between fromPos and toPos in miles) /
        #            CIRCLE_DIAMETER ]
        sep = (fromPos.crowFeet(toPos) / FEET_PER_MILE)/CIRCLE_DIAMETER

        #-- 3 --
        return sep