larray.Session.filter

Session.filter(pattern=None, kind=None)[source]

Returns a new session with array objects which match some criteria.

Parameters:

pattern : str, optional

Only keep arrays whose key match pattern.

kind : type, optional

Only keep arrays which are instances of type kind.

Returns:

Session

The filtered session.

Examples

>>> axis = Axis('a=a0..a2')
>>> test1, test2, zero1 = ndtest((2, 2)), ndtest(4), zeros((3, 2))
>>> s = Session([('test1', test1), ('test2', test2), ('zero1', zero1), ('axis', axis)])

Filter using a pattern argument

>>> s.filter(pattern='test').names
['test1', 'test2']

Filter using kind argument

>>> s.filter(kind=Axis).names
['axis']