Exemplo n.º 1
0
 def all_descriptions():
     """ Returns descriptions for all objects defined here. """
     s = dict()
     items = chain(Stats.statistics.items())
     
     for k, v in items:
         s[k] = WithDescription(name=v.get_name(),
                                desc=v.get_desc(),
                                symbol=v.get_symbol())
         
     
     config = get_dp_config()
     
     for objspec in config.specs.values():
         if not objspec:
             logger.warning('No %s defined? Just wondering...' % 
                            objspec.name)
         for k, v in objspec.items():
             symbol, desc = symbol_desc_from_string(v['desc'])
             if desc is None:
                 logger.warning('No description entry %r.' % k)
             s[k] = WithDescription(name=k, desc=desc, symbol=symbol)
             # print k, s[k]
             
     s.update(Stats.misc_descriptions)            
     return s
 def _get_flat_structure(self, shape):
     if self.fs is None:
         def make_size(x):
             x = int(np.ceil(x))
             if x % 2 == 0:
                 x += 1
             return x
         
         ax = make_size(shape[0] * self.ratios[0])
         ay = make_size(shape[1] * self.ratios[1])
         area = (ax, ay)
         if np.min(area) == 1:
             logger.warning('Area is too small. Ratios: %s shape: %s area: %s' % 
                            (self.ratios, shape, area))
         logger.info('ratios: %s shape: %s area: %s' % (self.ratios,
                                                        shape, area))
         self.fs = FlatStructure(shape=tuple(shape), neighborarea=tuple(area))
     
     return self.fs
Exemplo n.º 3
0
    def _get_flat_structure(self, shape):
        if self.fs is None:

            def make_size(x):
                x = int(np.ceil(x))
                if x % 2 == 0:
                    x += 1
                return x

            ax = make_size(shape[0] * self.ratios[0])
            ay = make_size(shape[1] * self.ratios[1])
            area = (ax, ay)
            if np.min(area) == 1:
                logger.warning(
                    'Area is too small. Ratios: %s shape: %s area: %s' %
                    (self.ratios, shape, area))
            logger.info('ratios: %s shape: %s area: %s' %
                        (self.ratios, shape, area))
            self.fs = FlatStructure(shape=tuple(shape),
                                    neighborarea=tuple(area))

        return self.fs