當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。