Example #1
0
 def x(cls):
     #arrind = func.unnest(cls.indices).label('arrind')
     #x = func.array_agg(arrind / cls.size).label('x')
     s = db.Session()
     arrind = (func.unnest(cls.indices) / cls.size).label('xarrind')
     #x = s.query(arrind).select_from(cls).subquery('xarr')
     #xagg = s.query(func.array_agg(x.c.xarrind))
     return arrind
Example #2
0
    def cubes(self):
        ''' Get all cubes on this plate '''

        session = db.Session()
        if self.drpver:
            cubes = session.query(Cube).join(PipelineInfo, PipelineVersion).\
                filter(Cube.plate == self.id, PipelineVersion.version == self.drpver).all()
        else:
            cubes = session.query(Cube).filter(Cube.plate == self.id).all()
        return cubes
Example #3
0
 def y(cls):
     #arrind = func.unnest(cls.indices).label('arrind')
     #x = arrind / cls.size
     #y = func.array_agg(arrind - x*cls.size).label('y')
     #return y
     s = db.Session()
     arrunnest = func.unnest(cls.indices)
     xarr = (func.unnest(cls.indices) / cls.size).label('xarrind')
     arrind = (arrunnest - xarr * cls.size).label('yarrind')
     #n.arrind-(n.arrind/n.size)*n.size
     y = s.query(arrind).select_from(cls).subquery('yarr')
     yagg = s.query(func.array_agg(y.c.yarrind))
     return yagg.as_scalar()