This module defines the structure for filters objects (see FilterGeneral).

Various filters are then defined in submodules, by subclassing.

The subclass needs to define at least two things:
  • the attribute _label (string or unicode) which defines filter operation
  • the func method, that performs and outputs the boolean test

Some useful functions are defined here as well.

class tunacell.filters.main.FilterAND(*filters)

Defines boolean AND operation between same type filters.

Parameters:filters (sequence of FilterGeneral instances) –
Returns:will perform AND boolean operation between the various filters passed as arguments.
Return type:FilterGeneral instance


Defines a FilterTrue

exception tunacell.filters.main.FilterArgError

Exception raised when Argument format is not suitable.

class tunacell.filters.main.FilterBoolean

General class to implement Boolean operations between filters


Get label of applied filter(s)

exception tunacell.filters.main.FilterError

Superclass for errors while filtering

class tunacell.filters.main.FilterGeneral

General class for filtering cell (i.e. tunacell.base.cell.Cell) instances.

Important property is to make the instance callable, and define with a human readable label the action of filter.


This is the boolean operation to define in specific Filter instances

Default operation returns True.


Get label of applied filter(s)


Provides the list of hidden observables

exception tunacell.filters.main.FilterLabelError

Exception when label is not (properly) set.

class tunacell.filters.main.FilterNOT(filt)

Defines boolean NOT operation on filter.

Parameters:filter (FilterGeneral instance) –
class tunacell.filters.main.FilterOR(*filters)

Defines boolean OR operation between same type filters.

Parameters:filters (sequence of FilterGeneral instances) –
exception tunacell.filters.main.FilterParamsError

Exception when parameters are not set for a given test.

class tunacell.filters.main.FilterSet(label=None, filtercell=FilterTRUE(), filterlineage=FilterTRUE(), filtertree=FilterTRUE(), filtercontainer=FilterTRUE())

Collects filters of each type in a single object


Provides the list of hidden observables

class tunacell.filters.main.FilterTRUE

Returns True for argument of any type, can be used in Boolean filters

We need this artificial Filter to plug in defaults FilterSets.

exception tunacell.filters.main.FilterTypeError

Error raised when one tries to combine different types of filters

tunacell.filters.main.bounded(arg, lower_bound=None, upper_bound=None)

Function that test whether argument is bounded.

By convention, lower bound is included, upper bound is excluded. Thus it tests whether lower_bound <= arg < upper_bound. If arg is an iterable, the test must be satisfied for every element (hence the minimal value must be greater or equal to lower_bound and the maximal value must be lower than the upper bound).

  • arg (int or float) – quantity to be tested for bounds
  • lower_bound (int or float (default None)) –
  • upper_bound (int or float (default None)) –

Return type:


This module defines filters for Cell instances

class tunacell.filters.cells.FilterCell

General class for filtering cell objects (reader.Cell instances)

class tunacell.filters.cells.FilterCellAny

Class that does not filter anything.

class tunacell.filters.cells.FilterCellIDbound(lower_bound=None, upper_bound=None)

Test class

class tunacell.filters.cells.FilterCellIDparity(parity='even')

Test whether identifier is odd or even

class tunacell.filters.cells.FilterCompleteCycle(daughter_min=1)

Test whether a cell has a given parent and at least one daughter.

class tunacell.filters.cells.FilterCycleFrames(lower_bound=None, upper_bound=None)

Check whether cell has got a minimal number of datapoints.

class tunacell.filters.cells.FilterCycleSpanIncluded(lower_bound=None, upper_bound=None)

Check that cell cycle time interval is within valid bounds.

class tunacell.filters.cells.FilterData

Default filter test only if cell exists and non empty.

class tunacell.filters.cells.FilterDaughters(daughter_min=1, daughter_max=2)

Test whether a given cell as at least one daughter cell

class tunacell.filters.cells.FilterHasParent

Test whether a cell has an identified parent cell

class tunacell.filters.cells.FilterLengthIncrement(lower_bound=None, upper_bound=None)

Check increments are bounded.

class tunacell.filters.cells.FilterObservableBound(obs=Observable(name='undefined', raw='undefined', scale='linear', differentiate=False, local_fit=False, time_window=0.0, join_points=3, mode='dynamics', timing='t', tref=None, ), tref=None, lower_bound=None, upper_bound=None)

Check that a given observable is bounded.

  • obs (Observable instance) – observable that will be tested for bounds works only for continuous observable (mode=’dynamics’)
  • tref (float (default None)) – Time of reference at which to test dynamics observable value
  • lower_bound (float (default None)) –
  • upper_bound (float (default None)) –
class tunacell.filters.cells.FilterSymmetricDivision(raw='area', lower_bound=0.4, upper_bound=0.6)

Check that cell division is (roughly) symmetric.

Parameters:raw (str) – column label of raw observable to test for symmetric division (usually one of ‘length’, ‘area’). This quantity will be approximated
class tunacell.filters.cells.FilterTimeInCycle(tref=0.0)

Check that tref is within cell birth and division time