当前位置: 首页>>代码示例>>Python>>正文


Python Grid.updateGridAttribute方法代码示例

本文整理汇总了Python中Grid.Grid.updateGridAttribute方法的典型用法代码示例。如果您正苦于以下问题:Python Grid.updateGridAttribute方法的具体用法?Python Grid.updateGridAttribute怎么用?Python Grid.updateGridAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Grid.Grid的用法示例。


在下文中一共展示了Grid.updateGridAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: mapDataToGrid

# 需要导入模块: from Grid import Grid [as 别名]
# 或者: from Grid.Grid import updateGridAttribute [as 别名]
    def mapDataToGrid(self, dataInfo):
        datalength = len(dataInfo)
        if datalength != self.DIMENSION:
            return
        grid_coords = list()
        data_coords = list()
        data = 0.0
        grid_Width = 0.0
        dim_index = 0
        i = 0
        while i < datalength:
            data = float(dataInfo[i])
            data_coords.append(data)
            if data >= self.DIMENSION_UPPER_RANGE[i] or data < self.DIMENSION_LOWER_RANGE[i]:
                return
            grid_Width = float(self.DIMENSION_UPPER_RANGE[i] - self.DIMENSION_LOWER_RANGE[i]) / float(self.DIMENSION_PARTITION[i])
            dim_index = int(math.floor((data - self.DIMENSION_LOWER_RANGE[i]) / grid_Width))
            grid_coords.append(dim_index)
            i += 1

        
        gridCoords = Coordinates(grid_coords)

       # check if the grid object is already created or not. 
        if not gridCoords in self.gridList:
            g = Grid(False,0,self.time,1,ATTRIBUTE.SPARSE, self.DIMENSION, self.DIMENSION_UPPER_RANGE, self.DIMENSION_LOWER_RANGE, self.DIMENSION_PARTITION, self.TOTAL_GRIDS, self.decay_factor, self.dense_threshold, self.sparse_threshold, self.correlation_threshold)
            attrL = g.getAttraction(data_coords, grid_coords)
            g.setInitialAttraction(attrL)
            self.gridList[gridCoords] = g
        else:
            g = self.gridList[gridCoords]
            gridCoords = None
            g.updateGridDensity(self.time)
            g.updateGridAttribute()
            attrL = g.getAttraction(data_coords, grid_coords)
            g.updateGridAttraction(attrL, self.time)
            g.setLastTimeUpdated(self.time)
开发者ID:BerkeleyVogelheim,项目名称:ContextEngine27,代码行数:39,代码来源:DStreamII.py


注:本文中的Grid.Grid.updateGridAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。