本文整理汇总了Python中protoclass.data_management.DCEModality.data_[0,20:40,:,:]方法的典型用法代码示例。如果您正苦于以下问题:Python DCEModality.data_[0,20:40,:,:]方法的具体用法?Python DCEModality.data_[0,20:40,:,:]怎么用?Python DCEModality.data_[0,20:40,:,:]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protoclass.data_management.DCEModality
的用法示例。
在下文中一共展示了DCEModality.data_[0,20:40,:,:]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_histogram_fix_bins
# 需要导入模块: from protoclass.data_management import DCEModality [as 别名]
# 或者: from protoclass.data_management.DCEModality import data_[0,20:40,:,:] [as 别名]
def test_update_histogram_fix_bins():
""" Test that the function properly update the value of the histogram
and fixing the number of bins. """
# Load the data and then call the function independently
currdir = os.path.dirname(os.path.abspath(__file__))
path_data = os.path.join(currdir, 'data', 'dce')
# Create an object to handle the data
dce_mod = DCEModality()
dce_mod.read_data_from_path(path_data)
# Change something in the data to check that the computation
# is working
dce_mod.data_[0, 20:40, :, :] = 1000.
nb_bins = [100, 100]
dce_mod.update_histogram(nb_bins=nb_bins)
# We need to check that the minimum and maximum were proprely computed
assert_equal(dce_mod.min_series_, 0.)
assert_equal(dce_mod.max_series_, 1000.)
# Check that bin is what we expect
data = np.load(os.path.join(currdir, 'data',
'bin_dce_data_update_100_bins.npy'))
# Check that each array are the same
for exp, gt in zip(dce_mod.bin_series_, data):
assert_array_equal(exp, gt)
# Check that pdf is what we expect
data = np.load(os.path.join(currdir, 'data',
'pdf_dce_data_update_100_bins.npy'))
# Check that each array are the same
for exp, gt in zip(dce_mod.pdf_series_, data):
assert_array_equal(exp, gt)