Ejemplo n.º 1
0
 def domain_length(self,face_1,face_2):
     r'''
     Calculate the distance between two faces of the network
     
     Parameters
     ----------
     face_1 and face_2 : array_like
         Lists of pores belonging to opposite faces of the network
         
     Returns
     -------
     The length of the domain in the specified direction
     
     Notes
     -----
     - Does not yet check if input faces are perpendicular to each other
     '''
     #Ensure given points are coplanar before proceeding
     if misc.iscoplanar(self['pore.coords'][face_1]) and misc.iscoplanar(self['pore.coords'][face_2]):
         #Find distance between given faces
         x = self['pore.coords'][face_1]
         y = self['pore.coords'][face_2]
         Ds = misc.dist(x,y)
         L = sp.median(sp.amin(Ds,axis=0))
     else:
         self._logger.warning('The supplied pores are not coplanar. Length will be approximate.')
         f1 = self['pore.coords'][face_1]
         f2 = self['pore.coords'][face_2]
         distavg = [0,0,0]
         distavg[0] = sp.absolute(sp.average(f1[:,0]) - sp.average(f2[:,0]))
         distavg[1] = sp.absolute(sp.average(f1[:,1]) - sp.average(f2[:,1]))
         distavg[2] = sp.absolute(sp.average(f1[:,2]) - sp.average(f2[:,2]))
         L = max(distavg)
     return L
Ejemplo n.º 2
0
    def domain_length(self,face_1,face_2):
        r'''
        Calculate the distance between two faces of the network

        Parameters
        ----------
        face_1 and face_2 : array_like
            Lists of pores belonging to opposite faces of the network

        Returns
        -------
        The length of the domain in the specified direction

        Notes
        -----
        - Does not yet check if input faces are perpendicular to each other
        '''
        #Ensure given points are coplanar before proceeding
        if misc.iscoplanar(self['pore.coords'][face_1]) and misc.iscoplanar(self['pore.coords'][face_2]):
            #Find distance between given faces
            x = self['pore.coords'][face_1]
            y = self['pore.coords'][face_2]
            Ds = misc.dist(x,y)
            L = sp.median(sp.amin(Ds,axis=0))
        else:
            logger.warning('The supplied pores are not coplanar. Length will be approximate.')
            f1 = self['pore.coords'][face_1]
            f2 = self['pore.coords'][face_2]
            distavg = [0,0,0]
            distavg[0] = sp.absolute(sp.average(f1[:,0]) - sp.average(f2[:,0]))
            distavg[1] = sp.absolute(sp.average(f1[:,1]) - sp.average(f2[:,1]))
            distavg[2] = sp.absolute(sp.average(f1[:,2]) - sp.average(f2[:,2]))
            L = max(distavg)
        return L