str2d.Str2D.alpha

property Str2D.alpha: ndarray

Return the alpha data. Alternatively, you can access the ‘alpha’ field directly by using the ‘data’ attribute and the ‘alpha’ key.

Examples

Let’s create an instance of Str2D and assign it to the variable a.

from str2d import Str2D

a = Str2D('a b c d\ne f g\nh i\nj')

We can access the ‘alpha’ field directly by using the ‘data’ attribute and the

a.data['alpha']
array([[1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 0, 0],
       [1, 1, 1, 0, 0, 0, 0],
       [1, 0, 0, 0, 0, 0, 0]], dtype=int8)

This property is a shortcut to the above.

a.alpha
array([[1, 1, 1, 1, 1, 1, 1],
       [1, 1, 1, 1, 1, 0, 0],
       [1, 1, 1, 0, 0, 0, 0],
       [1, 0, 0, 0, 0, 0, 0]], dtype=int8)