featuremapper/analysis/pinwheels.py
def normalize_polar_channel(self, polar_channel):
        """
        This functions normalizes an OR map (polar_channel) taking into
        account the region of interest (ROI). The ROI is specified by
        values set to 99. Note that this functionality is implemented to
        reproduce the experimental approach and has not been tested (not
        required for Topographica simulations)
        """

        def grad(r):
            (r_x, r_y) = np.gradient(r)
            (r_xx, r_xy) = np.gradient(r_x);
            (r_yx, r_yy) = np.gradient(r_y);
            return r_xx ** 2 + r_yy ** 2 + 2 * r_xy ** 2

        # Set ROI to 0 to ignore values of -99.
        roi = np.ones(polar_channel.shape)
        # In Matlab: roi(find(z==-99))=0
        roi[roi == -99] = 0

        fst_grad = grad(roi)
        snd_grad = grad(fst_grad)

        # Find non-zero elements in second grad and sets to unity
        snd_grad[snd_grad != 0] = 1
        # These elements now mask out ROI region (set to zero)
        roi[snd_grad == 1] = 0

        # Find the unmasked coordinates
        ind = (polar_channel != 99)
        # The complex abs of unmasked
        normalisation = np.mean(np.abs(polar_channel))
        # Only normalize with unmasked
        return polar_channel / normalisation

        This functions normalizes an OR map (polar_channel) taking into
        account the region of interest (ROI). The ROI is specified by
        values set to 99. Note that this functionality is implemented to
        reproduce the experimental approach and has not been tested (not
        required for Topographica simulations)
        
This functions normalizes an OR map (polar_channel) taking into
account the region of interest (ROI). The ROI is specified by
values set to 99. Note that this functionality is implemented to
reproduce the experimental approach and has not been tested (not
required for Topographica simulations)
This functions normalizes an OR map ( polar_channel ) taking into account the region of interest ( ROI ) . The ROI is specified by values set to 99 . Note that this functionality is implemented to reproduce the experimental approach and has not been tested ( not required for Topographica simulations )
def normalize_polar_channel(self, polar_channel):
        def grad(r):
            (r_x, r_y) = np.gradient(r)
            (r_xx, r_xy) = np.gradient(r_x);
            (r_yx, r_yy) = np.gradient(r_y);
            return r_xx ** 2 + r_yy ** 2 + 2 * r_xy ** 2
        roi = np.ones(polar_channel.shape)
        roi[roi == -99] = 0
        fst_grad = grad(roi)
        snd_grad = grad(fst_grad)
        snd_grad[snd_grad != 0] = 1
        roi[snd_grad == 1] = 0
        ind = (polar_channel != 99)
        normalisation = np.mean(np.abs(polar_channel))
        return polar_channel / normalisation
def normalize_polar_channel ( self , polar_channel ) : def grad ( r ) : ( r_x , r_y ) = np . gradient ( r ) ( r_xx , r_xy ) = np . gradient ( r_x ) ; ( r_yx , r_yy ) = np . gradient ( r_y ) ; return r_xx ** 2 + r_yy ** 2 + 2 * r_xy ** 2 roi = np . ones ( polar_channel . shape ) roi [ roi == - 99 ] = 0 fst_grad = grad ( roi ) snd_grad = grad ( fst_grad ) snd_grad [ snd_grad != 0 ] = 1 roi [ snd_grad == 1 ] = 0 ind = ( polar_channel != 99 ) normalisation = np . mean ( np . abs ( polar_channel ) ) return polar_channel / normalisation
This functions normalizes an OR map (polar_channel) taking into
account the region of interest (ROI).
This functions normalizes an OR map ( polar_channel ) taking into account the region of interest ( ROI ) .
"""
        This functions normalizes an OR map (polar_channel) taking into
        account the region of interest (ROI). The ROI is specified by
        values set to 99. Note that this functionality is implemented to
        reproduce the experimental approach and has not been tested (not
        required for Topographica simulations)
        """ # Set ROI to 0 to ignore values of -99. # In Matlab: roi(find(z==-99))=0 # Find non-zero elements in second grad and sets to unity # These elements now mask out ROI region (set to zero) # Find the unmasked coordinates # The complex abs of unmasked # Only normalize with unmasked
self
polar_channel