def test_comfort_matrix(): """py.test for comfort_matrix""" data = (# ([[22,27], # [23,28], # [30,32], # [32,30], # [28,23], # [27,22]], # comfort.comfort, # 1,1, # #- # [[22,27,24,28.74,1.74], # [23,28,25,29.05,1.05], # [30,32,28.33333333,30.08333333,-1.916666667], # [32,30,30,30.6,0.6], # [28,23,29,30.29,7.29], # [27,22,25.66666667,29.25666667,7.256666667]]), # inmat, comfunc, upspan, downspan, outmat ([[22,27], [23,28], [30,32], [32,30], [28,23], [27,22]], comfort.comfortET, 1,1, #- [[22.0, 27.0, 24.0, 28.52, 1.52], [23.0, 28.0, 25.0, 28.774999999999999, 0.77500000000000002], [30.0, 32.0, 28.333333329999999, 29.625, -2.375], [32.0, 30.0, 30.0, 30.050000000000001, 0.050000000000000003], [28.0, 23.0, 29.0, 29.795000000000002, 6.7949999999999999], [27.0, 22.0, 25.666666670000001, 28.945, 6.9450000000000003]]), # inmat, comfunc, upspan, downspan, outmat ) for inmat, comfunc, upspan, downspan, outmat in data: result = comfort.comfort_matrix(inmat, comfunc, upspan, downspan) for row1, row2 in zip(result, outmat): for c1, c2 in zip(row1, row2): assert almostequal(c1, c2)
def comfort_fromsql(cursor, etrows, tzoneId, windinc, comforttype): """docstring for comfort_fromsql""" roomtemps = eplussql.get_manyvariables(cursor, [tzoneId]) inmat = [et + rm for et, rm in zip(etrows, roomtemps)] outmat = comfort.comfort_matrix(inmat, comfort.comfortET, limit=comforttype, windinc=windinc) return outmat
def comfort_fromsql(cursor, dbtId, tzoneId, windinc, comforttype): """docstring for comfort_fromsql""" inmat = eplussql.get_manyvariables(cursor, [dbtId, tzoneId]) outmat = comfort.comfort_matrix(inmat, comfort.comfort, limit=comforttype, windinc=windinc) return outmat