Changeset 1214 for framspy/dissimilarity
- Timestamp:
- 04/15/23 03:33:20 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/dissimilarity/density-distribution.py
r1210 r1214 12 12 Args: 13 13 density (int, optional): density of samplings for frams.ModelGeometry . Defaults to 10. 14 steps (int, optional): How many steps is used for samplingspace of voxels,15 The higher value the more accurate sampling and the longercalculations. Defaults to 3.14 steps (int, optional): How many steps are used for sampling the space of voxels, 15 The higher the value, the more accurate the sampling and the longer the calculations. Defaults to 3. 16 16 reduce (bool, optional): If we should use reduction to remove blank samples. Defaults to True. 17 17 frequency (bool, optional): If we should use frequency distribution. Defaults to False. … … 73 73 def calculateDistanceMatrix(self,array1, array2): 74 74 """ 75 76 75 Args: 77 76 array1 ([type]): array of size n with points representing firsts model … … 173 172 174 173 def getSignaturesForPair(self,array1,array2): 175 """ generates signatures for given pair of models represented by array of voxels.174 """Generates signatures for given pair of models represented by array of voxels. 176 175 We calculate space for given models by taking the extremas for each axis and dividing the space by the number of steps. 177 176 This divided space generate us samples which contains points. Each sample will have new coordinates which are mean of all points from it and weight … … 182 181 array2 (np.array(np.array(,dtype=float))): array with voxels representing model2 183 182 steps (int, optional): How many steps is used for sampling space of voxels. Defaults to self.steps (3). 184 183 185 184 Returns: 186 185 s1 ([np.array(,dtype=np.float64),np.array(,dtype=np.float64)]): [coordinates of samples, weights] … … 188 187 """ 189 188 190 min_x = np.min([np.min(array1[:,0]),np.min(array2[:,0])]) 189 min_x = np.min([np.min(array1[:,0]),np.min(array2[:,0])]) 191 190 max_x = np.max([np.max(array1[:,0]),np.max(array2[:,0])]) 192 191 min_y = np.min([np.min(array1[:,1]),np.min(array2[:,1])]) … … 195 194 max_z = np.max([np.max(array1[:,2]),np.max(array2[:,2])]) 196 195 197 x_steps,x_step = np.linspace(min_x,max_x,self.steps,retstep=True) 198 y_steps,y_step = np.linspace(min_y,max_y,self.steps,retstep=True) 199 z_steps,z_step = np.linspace(min_z,max_z,self.steps,retstep=True) 196 # We request self.steps+1 samples since we need self.steps intervals 197 x_steps,x_step = np.linspace(min_x,max_x,self.steps+1,retstep=True) 198 y_steps,y_step = np.linspace(min_y,max_y,self.steps+1,retstep=True) 199 z_steps,z_step = np.linspace(min_z,max_z,self.steps+1,retstep=True) 200 200 201 201 for intervals in (x_steps, y_steps, z_steps): # EPSILON subtracted to deal with boundary voxels (one-sided open intervals and comparisons in loops in function getSignatures()) … … 212 212 213 213 def getVoxels(self,geno): 214 """ 214 """Generates voxels for genotype using frams.ModelGeometry 215 215 216 216 Args: … … 230 230 231 231 def calculateDissimforVoxels(self, voxels1, voxels2): 232 """ CalculateEMD for pair of voxels representing models.232 """Calculates EMD for pair of voxels representing models. 233 233 Args: 234 234 voxels1 np.array([np.array(,dtype=float)]: list of voxels representing model1. … … 296 296 297 297 def calculateDissimforGeno(self, geno1, geno2): 298 """ CalculateEMD for pair of genos.298 """Calculates EMD for pair of genos. 299 299 Args: 300 300 geno1 (string): representation of model1 in one of the formats handled by frams http://www.framsticks.com/a/al_genotype.html … … 322 322 def getDissimilarityMatrix(self,listOfGeno): 323 323 """ 324 325 324 Args: 326 325 listOfGeno ([string]): list of strings representing genotypes in one of the formats handled by frams http://www.framsticks.com/a/al_genotype.html
Note: See TracChangeset
for help on using the changeset viewer.