featuremapper/analysis/pinwheels.py
def polarmap_contours(self, polarmap, bounds):
        """
        Identifies the real and imaginary contours in a polar map.
        Returns the real and imaginary contours as 2D vertex arrays
        together with the pairs of contours known to intersect. The
        coordinate system used is specified by the supplied bounds.

        Contour plotting requires origin='upper' for consistency with
        image coordinate system.
        """
        l,b,r,t = bounds.lbrt()
        # Convert to polar and normalise
        normalized_polar = self.normalize_polar_channel(polarmap)
        figure_handle = plt.figure()
        # Real component
        re_contours_plot = plt.contour(normalized_polar.real, 0, origin='upper',
                                       extent=[l,r,b,t])
        re_path_collections = re_contours_plot.collections[0]
        re_contour_paths = re_path_collections.get_paths()
        # Imaginary component
        im_contours_plot = plt.contour(normalized_polar.imag, 0, origin='upper',
                                       extent=[l,r,b,t])

        im_path_collections = im_contours_plot.collections[0]
        im_contour_paths = im_path_collections.get_paths()
        plt.close(figure_handle)

        intersections = [(re_ind, im_ind)
                         for (re_ind, re_path) in enumerate(re_contour_paths)
                         for (im_ind, im_path) in enumerate(im_contour_paths)
                         if im_path.intersects_path(re_path)]

        # Contour vertices  0.5 pixel inset. Eg. (0,0)-(48,48)=>(0.5, 0.5)-(47.5,  47.5)
        # Returned values will not therefore reach limits of 0.0 and 1.0
        re_contours = [self.remove_path_duplicates(re_path.vertices) for re_path in re_contour_paths]
        im_contours = [self.remove_path_duplicates(im_path.vertices) for im_path in im_contour_paths]
        return (re_contours, im_contours, intersections)

        Identifies the real and imaginary contours in a polar map.
        Returns the real and imaginary contours as 2D vertex arrays
        together with the pairs of contours known to intersect. The
        coordinate system used is specified by the supplied bounds.

        Contour plotting requires origin='upper' for consistency with
        image coordinate system.
        
Identifies the real and imaginary contours in a polar map.
Returns the real and imaginary contours as 2D vertex arrays
together with the pairs of contours known to intersect. The
coordinate system used is specified by the supplied bounds.

Contour plotting requires origin='upper' for consistency with
image coordinate system.
Identifies the real and imaginary contours in a polar map . Returns the real and imaginary contours as 2D vertex arrays together with the pairs of contours known to intersect . The coordinate system used is specified by the supplied bounds . Contour plotting requires origin = ' upper ' for consistency with image coordinate system .
def polarmap_contours(self, polarmap, bounds):
        l,b,r,t = bounds.lbrt()
        normalized_polar = self.normalize_polar_channel(polarmap)
        figure_handle = plt.figure()
        re_contours_plot = plt.contour(normalized_polar.real, 0, origin='upper',
                                       extent=[l,r,b,t])
        re_path_collections = re_contours_plot.collections[0]
        re_contour_paths = re_path_collections.get_paths()
        im_contours_plot = plt.contour(normalized_polar.imag, 0, origin='upper',
                                       extent=[l,r,b,t])
        im_path_collections = im_contours_plot.collections[0]
        im_contour_paths = im_path_collections.get_paths()
        plt.close(figure_handle)
        intersections = [(re_ind, im_ind)
                         for (re_ind, re_path) in enumerate(re_contour_paths)
                         for (im_ind, im_path) in enumerate(im_contour_paths)
                         if im_path.intersects_path(re_path)]
        re_contours = [self.remove_path_duplicates(re_path.vertices) for re_path in re_contour_paths]
        im_contours = [self.remove_path_duplicates(im_path.vertices) for im_path in im_contour_paths]
        return (re_contours, im_contours, intersections)
def polarmap_contours ( self , polarmap , bounds ) : l , b , r , t = bounds . lbrt ( ) normalized_polar = self . normalize_polar_channel ( polarmap ) figure_handle = plt . figure ( ) re_contours_plot = plt . contour ( normalized_polar . real , 0 , origin = 'upper' , extent = [ l , r , b , t ] ) re_path_collections = re_contours_plot . collections [ 0 ] re_contour_paths = re_path_collections . get_paths ( ) im_contours_plot = plt . contour ( normalized_polar . imag , 0 , origin = 'upper' , extent = [ l , r , b , t ] ) im_path_collections = im_contours_plot . collections [ 0 ] im_contour_paths = im_path_collections . get_paths ( ) plt . close ( figure_handle ) intersections = [ ( re_ind , im_ind ) for ( re_ind , re_path ) in enumerate ( re_contour_paths ) for ( im_ind , im_path ) in enumerate ( im_contour_paths ) if im_path . intersects_path ( re_path ) ] re_contours = [ self . remove_path_duplicates ( re_path . vertices ) for re_path in re_contour_paths ] im_contours = [ self . remove_path_duplicates ( im_path . vertices ) for im_path in im_contour_paths ] return ( re_contours , im_contours , intersections )
Identifies the real and imaginary contours in a polar map.
Identifies the real and imaginary contours in a polar map .
"""
        Identifies the real and imaginary contours in a polar map.
        Returns the real and imaginary contours as 2D vertex arrays
        together with the pairs of contours known to intersect. The
        coordinate system used is specified by the supplied bounds.

        Contour plotting requires origin='upper' for consistency with
        image coordinate system.
        """ # Convert to polar and normalise # Real component # Imaginary component # Contour vertices  0.5 pixel inset. Eg. (0,0)-(48,48)=>(0.5, 0.5)-(47.5,  47.5) # Returned values will not therefore reach limits of 0.0 and 1.0
self
polarmap
bounds