def many_with_pumps(settings, init_steps=tpid_cool_start): """ Make a LongRecipe for temp PID testing using the given settings. Settings is an iterable yielding valid inputs to full_test_with_pumps. A long recipe start is added to initialize the test. Settings must be 2-5 ints (or floats) long, yielding (Pgain, Itime, [Dtime, [set-point, [start_temp]]]), and will be passed to full_test_with_pumps directly without error checking. @param settings: list of settings to pass @type settings: collections.Iterable[collections.Iterable[int | float]] @return: recipe @rtype: LongRecipe """ long_recipe = LongRecipe() long_recipe.add_recipe(init_steps) for settings in settings: recipe = full_test_with_pumps(*settings) long_recipe.add_recipe(recipe) return long_recipe
def make_long_recipe(settings, init_steps=tpid_cool_start): """ @param settings: iterable of tuples of (p, i, d) settings. @type settings: collections.Iterable[(int | float, int | float, int | float)] @param init_steps: A recipe with steps used to initialize the test. This defaults to a short recipe warming water to ~29 before allowing it to settle at 28 degrees, the standard test start temp. If using many recipes in a row on a pbs bioreactor, it may be useful to use custom init steps to re-initialize behavior more quickly than the standard recipe does. @type init_steps: T <= Recipe @return: Recipe @rtype: LongRecipe """ recipes = [make_full_test_body(p, i, d, 37) for p, i, d in settings] long = LongRecipe() long.add_recipe(init_steps) long.extend_recipes(recipes) return long
def test_print_steps(self): r = Recipe() self.make_recipe1(r) buf = StringIO() r.print_steps(buf) result1 = buf.getvalue() r2 = LongRecipe() self.make_recipe1(r2) del buf buf = StringIO() r2.print_steps(buf) result2 = buf.getvalue() expected = """ Set "foo" to 5 Wait 45 seconds Set "temppv" to 16 Wait until "barbaz" != bazbar """ self.assertEqual(expected, result1) self.assertEqual(expected, result2)