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


Python bottleneck.nanmin方法代码示例

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


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

示例1: quickMinMax

# 需要导入模块: import bottleneck [as 别名]
# 或者: from bottleneck import nanmin [as 别名]
def quickMinMax(self, data):
        """
        Estimate the min/max values of *data* by subsampling.
        Returns [(min, max), ...] with one item per channel
        """
        while data.size > 1e6:
            ax = np.argmax(data.shape)
            sl = [slice(None)] * data.ndim
            sl[ax] = slice(None, None, 2)
            data = data[sl]
            
        cax = self.axes['c']
        if cax is None:
            return [(float(nanmin(data)), float(nanmax(data)))]
        else:
            return [(float(nanmin(data.take(i, axis=cax))), 
                     float(nanmax(data.take(i, axis=cax)))) for i in range(data.shape[-1])] 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:19,代码来源:ImageView.py

示例2: reduce_to_array

# 需要导入模块: import bottleneck [as 别名]
# 或者: from bottleneck import nanmin [as 别名]
def reduce_to_array(self, reduce_func_nb, *args, **kwargs):
        """See `vectorbt.tseries.nb.reduce_to_array_nb`.

        `**kwargs` will be passed to `vectorbt.tseries.common.TSArrayWrapper.wrap_reduced`.

        Example:
            ```python-repl
            >>> min_max_nb = njit(lambda col, a: np.array([np.nanmin(a), np.nanmax(a)]))
            >>> print(df.vbt.tseries.reduce_to_array(min_max_nb, index=['min', 'max']))
                   a    b    c
            min  1.0  1.0  1.0
            max  5.0  5.0  3.0
            ```"""
        checks.assert_numba_func(reduce_func_nb)

        result = nb.reduce_to_array_nb(self.to_2d_array(), reduce_func_nb, *args)
        return self.wrap_reduced(result, **kwargs) 
开发者ID:polakowo,项目名称:vectorbt,代码行数:19,代码来源:accessors.py

示例3: min

# 需要导入模块: import bottleneck [as 别名]
# 或者: from bottleneck import nanmin [as 别名]
def min(self, **kwargs):
        """Return min of non-NaN elements."""
        return self.wrap_reduced(nanmin(self.to_2d_array(), axis=0), **kwargs) 
开发者ID:polakowo,项目名称:vectorbt,代码行数:5,代码来源:accessors.py

示例4: quickMinMax

# 需要导入模块: import bottleneck [as 别名]
# 或者: from bottleneck import nanmin [as 别名]
def quickMinMax(self, data):
        """
        Estimate the min/max values of *data* by subsampling.
        """
        while data.size > 1e6:
            ax = np.argmax(data.shape)
            sl = [slice(None)] * data.ndim
            sl[ax] = slice(None, None, 2)
            data = data[sl]
        return nanmin(data), nanmax(data) 
开发者ID:AOtools,项目名称:soapy,代码行数:12,代码来源:ImageView.py

示例5: _phase2

# 需要导入模块: import bottleneck [as 别名]
# 或者: from bottleneck import nanmin [as 别名]
def _phase2(self):
		"""
		Execute phase 2 of the SP region. This phase is used to compute the
		active columns.
		
		Note - This should only be called after phase 1 has been called and
		after the inhibition radius and neighborhood have been updated.
		"""
		
		# Shift the outputs
		self.y[:, 1:] = self.y[:, :-1]
		self.y[:, 0] = 0
		
		# Calculate k
		#   - For a column to be active its overlap must be at least as large
		#     as the overlap of the k-th largest column in its neighborhood.
		k = self._get_num_cols()
		
		if self.global_inhibition:
			# The neighborhood is all columns, thus the set of active columns
			# is simply columns that have an overlap >= the k-th largest in the
			# entire region
			
			# Compute the winning column indexes
			ix = np.argpartition(-self.overlap[:, 0], k - 1)[:k]
			
			# Set the active columns
			self.y[ix, 0] = self.overlap[ix, 0] > 0
		else:
			# The neighborhood is bounded by the inhibition radius, therefore
			# each column's neighborhood must be considered
			
			for i in xrange(self.ncolumns):
				# Get the neighbors
				ix = np.where(self.neighbors[i])[0]
				
				# Compute the minimum top overlap
				if ix.shape[0] <= k:
					# Desired number of candidates is at or below the desired
					# activity level, so find the overall min
					m = max(bn.nanmin(self.overlap[ix, 0]), 1)
				else:
					# Desired number of candidates is above the desired
					# activity level, so find the k-th largest
					m = max(-np.partition(-self.overlap[ix, 0], k - 1)[k - 1],
						1)
				
				# Set the column activity
				if self.overlap[i, 0] >= m: self.y[i, 0] = True 
开发者ID:tehtechguy,项目名称:mHTM,代码行数:51,代码来源:region.py


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