def test_split_error(): with puddle.mk_session(split_error=0.1) as session: a = session.input(None, 1.0) a1, a2 = a.split() droplets = session.droplets() # with any error, these should not be precisely the same assert droplets[a1._id]['volume'] != droplets[a2._id]['volume']
mass1 = self.concentration * self.volume mass2 = other.concentration * other.volume result.concentration = (mass1 + mass2) / result.volume return result def split(self): d1, d2 = super().split() d1.volume = self.volume / 2 d2.volume = self.volume / 2 d1.concentration = self.concentration d2.concentration = self.concentration return d1, d2 arch_path = project_path('tests/arches/arch-big.json') with mk_session(arch_path) as session: # FIXME this needs arch big for now because place and route is bad # also, you just can't do that many iterations c_low = 0 c_high = 1 c_target = .37 eps = 0.1 def d_low_factory(): return session.create( location=None, volume=1, dimensions=None, concentration=c_low,
def session(): with puddle.mk_session() as sess: yield sess
result.volume = self.volume + other.volume mass1 = self.concentration * self.volume mass2 = other.concentration * other.volume result.concentration = (mass1 + mass2) / result.volume return result def split(self): d1, d2 = super().split() d1.volume = self.volume / 2 d2.volume = self.volume / 2 d1.concentration = self.concentration d2.concentration = self.concentration return d1, d2 with mk_session('../../tests/arches/arch-big.json') as session: # FIXME this needs arch big for now because place and route is bad # also, you just can't do that many iterations c_low = 0 c_high = 1 c_target = .37 eps = 0.01 def d_low_factory(): return session.input( location=None, volume=1, concentration=c_low, droplet_class=VolConcDroplet,
corner.pop(0) d._id = old_id d.valid = True print("python: ERROR") arch_path = puddle.project_path('tests/arches/purpledrop.yaml') def endurance(session): d = session.create((6, 6)) for i in range(100): for j, c in enumerate(corners): if not c: print("python: corners{} is empty!".format(j)) return try_move(d, corner1) try_move(d, corner2) try_move(d, corner3) try_move(d, corner4) print("python: Completed cycle {}".format(i)) if __name__ == '__main__': # endurance(puddle.Session('http://localhost:3000', 'test')) with puddle.mk_session(arch_path) as session: endurance(session)
def session(): arch_path = puddle.project_path('tests/arches/arch01.json') with puddle.mk_session(arch_path) as sess: yield sess
def setUp(self): arch_path = puddle.project_path('tests/arches/arch01.yaml') session = puddle.mk_session(arch_path) self.session = session.__enter__() self.addCleanup(session.__exit__, None, None, None)