Пример #1
0
 def func(self, cell):
     import collections
     boo = False
     if self.tref is not None:
         filt = FilterAND(FilterData(),
                          FilterTimeInCycle(tref=self.tref))
     else:
         filt = FilterData()
     label = self.obs_to_test.label
     if filt(cell):
         # retrieve data
         array = cell._sdata[label]  # two cases: array, or single value
         raw_time = cell.data['time']
         if len(raw_time) > 1:
             dt = np.amin(raw_time[1:] - raw_time[:-1])
         else:
             dt = cell.container.period
         if array is None:
             return False
         if isinstance(array, collections.Iterable):
             if self.tref is None:
                 # data may be one value (for cycle observables), or array
                 boo = bounded(array[label], self.lower_bound, self.upper_bound)
             else:
                 # find data closest to tref (-> round to closest time)
                 # for now return closest time to tref
                 index = np.argmin(np.abs(array['time'] - self.tref))
                 # check that it's really close:
                 if np.abs(array['time'][index] - self.tref) < dt:
                     value = array[label][index]
                     boo = bounded(value, self.lower_bound, self.upper_bound)
         # otherwise it's a number
         else:
             boo = bounded(array, self.lower_bound, self.upper_bound)
     return boo
Пример #2
0
 def func(self, cell):
     boo = False
     filtData = FilterData()
     if filtData(cell):
         ell = np.array(cell.data['length'])
         incr = multiplicative_increments(ell)
         lower = bounded(np.amin(incr), lower_bound=self.lower_bound)
         upper = bounded(np.amax(incr), upper_bound=self.upper_bound)
         boo = lower and upper
     return boo
Пример #3
0
 def func(self, cell):
     boo = False
     filtData = FilterData()
     if filtData(cell):
         ell = np.array(cell.data['length'])
         incr = multiplicative_increments(ell)
         lower = bounded(np.amin(incr), lower_bound=self.lower_bound)
         upper = bounded(np.amax(incr), upper_bound=self.upper_bound)
         boo = lower and upper
     return boo
Пример #4
0
 def func(self, lineage):
     if bounded(len(lineage.idseq),
                lower_bound=self.lower_bound,
                upper_bound=self.upper_bound):
         return True
     else:
         return False
Пример #5
0
 def func(self, lineage):
     boo = False
     filtData = FilterLineageData()
     if filtData(lineage):
         boo = bounded(lineage.data['time'],
                       lower_bound=self.lower_bound,
                       upper_bound=self.upper_bound)
     return boo
Пример #6
0
 def func(self, cell):
     # check whether data exists
     boo = False
     filtData = FilterData()
     if filtData.func(cell):
         boo = bounded(len(cell.data),
                       lower_bound=self.lower_bound,
                       upper_bound=self.upper_bound)
     return boo
Пример #7
0
 def func(self, cell):
     # check whether data exists
     boo = False
     filtData = FilterData()
     if filtData.func(cell):
         boo = bounded(len(cell.data),
                       lower_bound=self.lower_bound,
                       upper_bound=self.upper_bound
                       )
     return boo
Пример #8
0
 def func(self, tree):
     import treelib
     boo = False
     if isinstance(tree, treelib.Tree):
         boo = bounded(tree.depth(),
                       lower_bound=self.lower_bound,
                       upper_bound=self.upper_bound)
     else:
         warnings.warn('Argument is not a tree...')
     return boo
Пример #9
0
 def func(self, lineage):
     times = lineage.data['time']
     tmin = np.amin(times)
     tmax = np.amax(times)
     if bounded(tmax - tmin,
                lower_bound=self.lower_bound,
                upper_bound=self.upper_bound):
         return True
     else:
         return False
Пример #10
0
 def func(self, tree):
     import treelib
     boo = False
     if isinstance(tree, treelib.Tree):
         boo = bounded(tree.depth(),
                       lower_bound=self.lower_bound,
                       upper_bound=self.upper_bound)
     else:
         warnings.warn('Argument is not a tree...')
     return boo
Пример #11
0
 def func(self, cell):
     boo = False
     filtData = FilterData()
     if cell.parent is None:
         # birth is not reported, impossible to test, cannot exclude from data
         boo = True
     else:
         if filtData(cell):
             csize = cell._sdata[self._obs[0].label]
             if filtData(cell.parent):
                 psize = cell.parent._sdata[self._obs[1].label]
                 boo = bounded(csize/psize,
                               lower_bound=self.lower_bound,
                               upper_bound=self.upper_bound
                               )
             else:
                 # parent exists, but without data.
                 # this is a weird scenario, that should not exist
                 # TODO: warn user?
                 # but we can check with sibling
                 sibs = copy.deepcopy(cell.parent.childs)
                 for item in sibs:
                     if item.identifier == cell.identifier:
                         sibs.remove(item)
                 if sibs:
                     if len(sibs) > 1:
                         from ..base.cell import CellChildsError
                         raise CellChildsError('>2 daughters')
                     sib = sibs[0]  # there should be only one cell
                     if sib.data is not None:
                         sibsize = sib._sdata[self._obs[0].label()]
                         boo = bounded(csize/sibsize,
                                       lower_bound=self.lower_bound,
                                       upper_bound=self.upper_bound
                                       )
                     else:
                         boo = True  # sibling cell: no data, accept this cell
                 else:
                     boo = True  # no sibling, accept this cell
     return boo
Пример #12
0
 def func(self, cell):
     boo = False
     filtData = FilterData()
     if cell.parent is None:
         # birth is not reported, impossible to test, cannot exclude from data
         boo = True
     else:
         if filtData(cell):
             csize = cell._sdata[self._obs[0].label]
             if filtData(cell.parent):
                 psize = cell.parent._sdata[self._obs[1].label]
                 boo = bounded(csize / psize,
                               lower_bound=self.lower_bound,
                               upper_bound=self.upper_bound)
             else:
                 # parent exists, but without data.
                 # this is a weird scenario, that should not exist
                 # TODO: warn user?
                 # but we can check with sibling
                 sibs = copy.deepcopy(cell.parent.childs)
                 for item in sibs:
                     if item.identifier == cell.identifier:
                         sibs.remove(item)
                 if sibs:
                     if len(sibs) > 1:
                         from ..base.cell import CellChildsError
                         raise CellChildsError('>2 daughters')
                     sib = sibs[0]  # there should be only one cell
                     if sib.data is not None:
                         sibsize = sib._sdata[self._obs[0].label()]
                         boo = bounded(csize / sibsize,
                                       lower_bound=self.lower_bound,
                                       upper_bound=self.upper_bound)
                     else:
                         boo = True  # sibling cell: no data, accept this cell
                 else:
                     boo = True  # no sibling, accept this cell
     return boo
Пример #13
0
 def func(self, cell):
     import collections
     boo = False
     if self.tref is not None:
         filt = FilterAND(FilterData(), FilterTimeInCycle(tref=self.tref))
     else:
         filt = FilterData()
     label = self.obs_to_test.label
     if filt(cell):
         # retrieve data
         array = cell._sdata[label]  # two cases: array, or single value
         raw_time = cell.data['time']
         if len(raw_time) > 1:
             dt = np.amin(raw_time[1:] - raw_time[:-1])
         else:
             dt = cell.container.period
         if array is None:
             return False
         if isinstance(array, collections.Iterable):
             if self.tref is None:
                 # data may be one value (for cycle observables), or array
                 boo = bounded(array[label], self.lower_bound,
                               self.upper_bound)
             else:
                 # find data closest to tref (-> round to closest time)
                 # for now return closest time to tref
                 index = np.argmin(np.abs(array['time'] - self.tref))
                 # check that it's really close:
                 if np.abs(array['time'][index] - self.tref) < dt:
                     value = array[label][index]
                     boo = bounded(value, self.lower_bound,
                                   self.upper_bound)
         # otherwise it's a number
         else:
             boo = bounded(array, self.lower_bound, self.upper_bound)
     return boo
Пример #14
0
 def func(self, cell):
     return bounded(len(cell.childs),
                    lower_bound=self.lower_bound,
                    upper_bound=self.upper_bound)
Пример #15
0
 def func(self, cell):
     return bounded(int(cell.identifier), self.lower_bound,
                    self.upper_bound)
Пример #16
0
 def func(self, cell):
     return bounded(int(cell.identifier),
                    self.lower_bound, self.upper_bound)
Пример #17
0
 def func(self, cell):
     return bounded(len(cell.childs),
                    lower_bound=self.lower_bound,
                    upper_bound=self.upper_bound)