[Numpy-discussion] ma feature request (log2)

Robin robince@gmail....
Sun Dec 13 09:18:03 CST 2009


Hi,

Could we have a ma aware numpy.ma.log2 please, similar to np.ma.log
and np.ma.log10?

I think it should be as simple as the patch below but perhaps I've
missed something:

Thanks,

Robin

--- core.py.orig        2009-12-13 15:14:14.000000000 +0000
+++ core.py     2009-12-13 15:14:53.000000000 +0000
@@ -66,7 +66,7 @@
            'identity', 'ids', 'indices', 'inner', 'innerproduct',
            'isMA', 'isMaskedArray', 'is_mask', 'is_masked', 'isarray',
            'left_shift', 'less', 'less_equal', 'load', 'loads', 'log', 'log10',
-           'logical_and', 'logical_not', 'logical_or', 'logical_xor',
+           'log2', 'logical_and', 'logical_not', 'logical_or', 'logical_xor',
            'make_mask', 'make_mask_descr', 'make_mask_none', 'mask_or',
            'masked', 'masked_array', 'masked_equal', 'masked_greater',
            'masked_greater_equal', 'masked_inside', 'masked_invalid',
@@ -1124,6 +1124,8 @@
                             _DomainGreater(0.0))
 log10 = _MaskedUnaryOperation(umath.log10, 1.0,
                               _DomainGreater(0.0))
+log2 = _MaskedUnaryOperation(umath.log2, 1.0,
+                              _DomainGreater(0.0))
 tan = _MaskedUnaryOperation(umath.tan, 0.0,
                             _DomainTan(1e-35))
 arcsin = _MaskedUnaryOperation(umath.arcsin, 0.0,


More information about the NumPy-Discussion mailing list