Ignore:
Timestamp:
12/26/24 01:43:47 (3 days ago)
Author:
Maciej Komosinski
Message:

Cosmetic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • framspy/dissimilarity/density_distribution.py

    r1325 r1329  
    66
    77class DensityDistribution:
    8     """Two dissimilarity measures based on the spatial distribution of two Models. The Model bounding box is divided into a grid of equally-sized cuboids, the number of which is the 'resolution' parameter cubed. Then the Model surface is covered with points; the density of the surface sampling is determined by the 'density' parameter. There are two versions of the measure. In the default version ('frequency'=False), a signature of each cuboid is the centroid and the number of samples. In the 'frequency'=True version, FFT is computed from the vector containing the number of samples in each cuboid. The final result of the dissimilarity measure is the distance between the signatures and it can be computed using EMD, L1, or L2 norms (the 'metric' parameter).
     8    """Two dissimilarity measures based on the spatial distribution of two Models. The Model bounding box is divided into a grid of equally-sized cuboids, the number of which is the 'resolution' parameter cubed. Then the Model surface is covered with points; the density of the surface sampling is determined by the 'density' parameter. There are two versions of the measure. In the default version ('frequency'=False), the signature of each cuboid is the centroid and the number of samples. In the 'frequency'=True version, FFT is computed from the vector containing the number of samples in each cuboid. The final result of the dissimilarity measure is the distance between the signatures and it can be computed using EMD, L1, or L2 norms (the 'metric' parameter).
    99    """
    1010
     
    4343    def calculateNeighborhood(self,array,mean_coords):
    4444        """ Calculates number of elements for given sample and set ups the center of this sample
    45         to the center of mass (calculated by mean of every coordinate)
     45        to the center of mass (calculated by mean of every coordinate).
    4646        Args:
    4747            array ([[float,float,float],...,[float,float,float]]): array of voxels that belong to given sample.
     
    6161
    6262
    63     def calculateDistPoints(self,point1, point2):
    64         """ Returns Euclidean distance between two points
    65         Args (distribution):
    66             point1 ([float,float,float]) - coordinates of first point
    67             point2 ([float,float,float]) - coordinates of second point
     63    def calculateDistPoints(self, point1, point2):
     64        """ Returns Euclidean distance between two samples (1D for frequency) or points (3D for distribution).
    6865        Args (frequency):
    6966            point1 (float) - value of the first sample
    7067            point2 (float) - value of the second sample
     68        Args (distribution):
     69            point1 ([float,float,float]) - coordinates of the first point
     70            point2 ([float,float,float]) - coordinates of the second point
    7171
    7272        Returns:
     
    7474        """
    7575        if self.frequency:
    76             return abs(point1-point2) # TODO vector instead of scalar returned?
     76            return abs(point1-point2)
    7777        else:
    7878            return np.linalg.norm(point1-point2, ord=2)
    7979
    8080
    81     def calculateDistanceMatrix(self,array1, array2):
     81    def calculateDistanceMatrix(self, array1, array2):
    8282        """
    8383        Args:
     
    138138            steps3 ([float,float,float]): [size of interval for x axis, size of interval for y axis, size of interval for y axis]
    139139
     140        Returns (frequency):
     141           signature np.array(,dtype=np.float64): returns signatuere np.array of coefficients
    140142        Returns (distribution):
    141143           signature [np.array(,dtype=np.float64),np.array(,dtype=np.float64)]: returns signatuere [np.array of points, np.array of weights]
    142         Returns (frequency):
    143            signature np.array(,dtype=np.float64): returns signatuere np.array of coefficients
    144144        """
    145145        edges_x,edges_y,edges_z = edges3
     
    212212
    213213    def getVoxels(self,geno):
    214         """Generates voxels for genotype using frams.ModelGeometry
     214        """Generates voxels for genotype using frams.ModelGeometry.
    215215
    216216        Args:
Note: See TracChangeset for help on using the changeset viewer.