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


Python ma.make_mask_none方法代码示例

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


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

示例1: __array_finalize__

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import make_mask_none [as 别名]
def __array_finalize__(self, obj):
        # Make sure we have a _fieldmask by default
        _mask = getattr(obj, '_mask', None)
        if _mask is None:
            objmask = getattr(obj, '_mask', nomask)
            _dtype = ndarray.__getattribute__(self, 'dtype')
            if objmask is nomask:
                _mask = ma.make_mask_none(self.shape, dtype=_dtype)
            else:
                mdescr = ma.make_mask_descr(_dtype)
                _mask = narray([tuple([m] * len(mdescr)) for m in objmask],
                               dtype=mdescr).view(recarray)
        # Update some of the attributes
        _dict = self.__dict__
        _dict.update(_mask=_mask)
        self._update_from(obj)
        if _dict['_baseclass'] == ndarray:
            _dict['_baseclass'] = recarray
        return 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:21,代码来源:mrecords.py

示例2: test_hardmask

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import make_mask_none [as 别名]
def test_hardmask(self):
        # Test hardmask
        base = self.base.copy()
        mbase = base.view(mrecarray)
        mbase.harden_mask()
        assert_(mbase._hardmask)
        mbase.mask = nomask
        assert_equal_records(mbase._mask, base._mask)
        mbase.soften_mask()
        assert_(not mbase._hardmask)
        mbase.mask = nomask
        # So, the mask of a field is no longer set to nomask...
        assert_equal_records(mbase._mask,
                             ma.make_mask_none(base.shape, base.dtype))
        assert_(ma.make_mask(mbase['b']._mask) is nomask)
        assert_equal(mbase['a']._mask, mbase['b']._mask) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:18,代码来源:test_mrecords.py

示例3: test_hardmask

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import make_mask_none [as 别名]
def test_hardmask(self):
        # Test hardmask
        base = self.base.copy()
        mbase = base.view(mrecarray)
        mbase.harden_mask()
        self.assertTrue(mbase._hardmask)
        mbase.mask = nomask
        assert_equal_records(mbase._mask, base._mask)
        mbase.soften_mask()
        self.assertTrue(not mbase._hardmask)
        mbase.mask = nomask
        # So, the mask of a field is no longer set to nomask...
        assert_equal_records(mbase._mask,
                             ma.make_mask_none(base.shape, base.dtype))
        self.assertTrue(ma.make_mask(mbase['b']._mask) is nomask)
        assert_equal(mbase['a']._mask, mbase['b']._mask) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:18,代码来源:test_mrecords.py

示例4: __array_finalize__

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import make_mask_none [as 别名]
def __array_finalize__(self, obj):
        # Make sure we have a _fieldmask by default ..
        _mask = getattr(obj, '_mask', None)
        if _mask is None:
            objmask = getattr(obj, '_mask', nomask)
            _dtype = ndarray.__getattribute__(self, 'dtype')
            if objmask is nomask:
                _mask = ma.make_mask_none(self.shape, dtype=_dtype)
            else:
                mdescr = ma.make_mask_descr(_dtype)
                _mask = narray([tuple([m] * len(mdescr)) for m in objmask],
                               dtype=mdescr).view(recarray)
        # Update some of the attributes
        _dict = self.__dict__
        _dict.update(_mask=_mask)
        self._update_from(obj)
        if _dict['_baseclass'] == ndarray:
            _dict['_baseclass'] = recarray
        return 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:21,代码来源:mrecords.py

示例5: test_hardmask

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import make_mask_none [as 别名]
def test_hardmask(self):
        "Test hardmask"
        base = self.base.copy()
        mbase = base.view(mrecarray)
        mbase.harden_mask()
        self.assertTrue(mbase._hardmask)
        mbase.mask = nomask
        assert_equal_records(mbase._mask, base._mask)
        mbase.soften_mask()
        self.assertTrue(not mbase._hardmask)
        mbase.mask = nomask
        # So, the mask of a field is no longer set to nomask...
        assert_equal_records(mbase._mask,
                             ma.make_mask_none(base.shape, base.dtype))
        self.assertTrue(ma.make_mask(mbase['b']._mask) is nomask)
        assert_equal(mbase['a']._mask, mbase['b']._mask)
    # 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:test_mrecords.py


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