larray.Session.compact

Session.compact(display=False) Session[source]

Detect and remove “useless” axes (ie axes for which values are constant over the whole axis) for all array objects in session.

Parameters
displaybool, optional

Whether to display a message for each array that is compacted

Returns
Session

A new session containing all compacted arrays

Examples

>>> arr1 = sequence('b=b0..b2', ndtest(3), zeros_like(ndtest(3)))
>>> arr1
a\b  b0  b1  b2
 a0   0   0   0
 a1   1   1   1
 a2   2   2   2
>>> compact_ses = Session(arr1=arr1).compact(display=True)
arr1 was constant over: b
>>> compact_ses.arr1
a  a0  a1  a2
    0   1   2