Filters¶
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
instanceNotes
Defines a FilterTrue
-
func
(target)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
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
-
label
¶ 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.
-
func
(*args)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
label
¶ Get label of applied filter(s)
-
obs
¶ 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) –-
func
(target)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.main.
FilterOR
(*filters)¶ Defines boolean OR operation between same type filters.
Parameters: filters (sequence of FilterGeneral
instances) –-
func
(target)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
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
-
obs
¶ 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.
-
func
(*args)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
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).
Parameters: - arg (int or float) – quantity to be tested for bounds
- lower_bound (int or float (default None)) –
- upper_bound (int or float (default None)) –
Returns: Return type: Boolean
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.
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.cells.
FilterCellIDbound
(lower_bound=None, upper_bound=None)¶ Test class
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.cells.
FilterCellIDparity
(parity='even')¶ Test whether identifier is odd or even
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.cells.
FilterCompleteCycle
(daughter_min=1)¶ Test whether a cell has a given parent and at least one daughter.
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.cells.
FilterCycleFrames
(lower_bound=None, upper_bound=None)¶ Check whether cell has got a minimal number of datapoints.
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.cells.
FilterCycleSpanIncluded
(lower_bound=None, upper_bound=None)¶ Check that cell cycle time interval is within valid bounds.
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.cells.
FilterData
¶ Default filter test only if cell exists and cell.data non empty.
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.cells.
FilterDaughters
(daughter_min=1, daughter_max=2)¶ Test whether a given cell as at least one daughter cell
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.cells.
FilterHasParent
¶ Test whether a cell has an identified parent cell
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
class
tunacell.filters.cells.
FilterLengthIncrement
(lower_bound=None, upper_bound=None)¶ Check increments are bounded.
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
-
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.
Parameters: - 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)) –
-
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-
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 -
func
(cell)¶ This is the boolean operation to define in specific Filter instances
Default operation returns True.
-