The cooking operations module provides a comprehensive set of tools for simulating various cooking methods and processes in TomatoPy.
from tomatopy import Kitchen
# Initialize a kitchen
kitchen = Kitchen()
# Configure basic settings
kitchen.set_temperature(180) # Celsius
kitchen.set_humidity(65) # Percentage
kitchen.set_pressure(101.3) # kPa (atmospheric pressure)
# Configure advanced settings
kitchen.set_ventilation("high")
kitchen.set_lighting("bright")
kitchen.set_equipment({
"stove": {"type": "gas", "burners": 4},
"oven": {"type": "convection", "capacity": "large"},
"blender": {"type": "high_speed", "capacity": "1.5L"}
})
# Simmer ingredients
sauce = kitchen.cook(
tomato,
method="simmer",
temperature=100,
duration="30m",
stirring_frequency="occasional"
)
# Boil ingredients
pasta = kitchen.cook(
spaghetti,
method="boil",
temperature=100,
duration="8m",
salt_concentration=0.02 # 2% salt
)
# Roast ingredients
roasted_tomatoes = kitchen.cook(
tomatoes,
method="roast",
temperature=200,
duration="45m",
turning_frequency="every_15m"
)
# Pressure cook ingredients
beans = kitchen.cook(
dried_beans,
method="pressure_cook",
pressure=103.4, # kPa
temperature=121, # Celsius
duration="30m"
)
# Sous vide cooking
steak = kitchen.cook(
beef,
method="sous_vide",
temperature=55,
duration="2h",
vacuum_sealed=True
)
# Smoke ingredients
smoked_tomatoes = kitchen.cook(
tomatoes,
method="smoke",
temperature=100,
duration="4h",
wood_type="hickory",
smoke_intensity="medium"
)
from tomatopy import Recipe
# Create a recipe
marinara = Recipe("Classic Marinara")
marinara.add_ingredient(tomato)
marinara.add_ingredient(garlic)
marinara.add_ingredient(basil)
# Set cooking parameters
marinara.set_cooking_method("simmer")
marinara.set_duration("30m")
marinara.set_temperature(100)
# Cook multiple recipes
recipes = [marinara, pizza_sauce, tomato_soup]
results = kitchen.cook_batch(recipes)
# Process results
for recipe, result in zip(recipes, results):
print(f"{recipe.name}: {result.consistency}")
# Monitor temperature during cooking
with kitchen.temperature_monitor() as monitor:
sauce = kitchen.cook(tomato, method="simmer")
temperature_history = monitor.get_history()
print(f"Average temperature: {monitor.get_average()}°C")
# Set up temperature alerts
kitchen.set_temperature_alert(
min_temp=95,
max_temp=105,
callback=lambda temp: print(f"Temperature alert: {temp}°C")
)
# Perform safety checks
if kitchen.validate_cooking_parameters(
temperature=200,
duration="2h",
pressure=103.4
):
# Proceed with cooking
result = kitchen.cook(...)
else:
print("Invalid cooking parameters")
# Assess cooking results
quality_report = kitchen.assess_cooking_result(sauce)
print(f"Overall quality: {quality_report.score}")
print(f"Recommendations: {quality_report.recommendations}")
try:
# Attempt invalid cooking operation
kitchen.cook(
tomato,
method="invalid_method",
temperature=1000 # Too hot!
)
except CookingError as e:
print(f"Error: {e}") # "Invalid cooking method"
try:
# Attempt unsafe temperature
kitchen.set_temperature(500) # Too hot!
except TemperatureError as e:
print(f"Error: {e}") # "Temperature exceeds safe range"
Always Validate Parameters
if kitchen.validate_cooking_parameters(
temperature=temp,
duration=duration,
pressure=pressure
):
# Proceed with cooking
Monitor Temperature
with kitchen.temperature_monitor() as monitor:
result = kitchen.cook(...)
if monitor.get_max() > safety_threshold:
print("Warning: Temperature exceeded safety threshold")
Use Appropriate Methods
# Choose method based on ingredient
if ingredient.requires_gentle_cooking:
method = "simmer"
else:
method = "boil"
Kitchen
: Main class for cooking operations
Recipe
: Recipe management class
TemperatureMonitor
: Temperature monitoring class
QualityReport
: Cooking quality assessment class
__init__()
set_temperature(temp)
set_humidity(humidity)
set_pressure(pressure)
set_ventilation(level)
set_lighting(level)
set_equipment(equipment)
cook(ingredient, method, **params)
cook_batch(recipes)
validate_cooking_parameters(**params)
assess_cooking_result(result)
temperature_monitor()
Pizza Creation System - Create delicious pizzas
Taste Testing Module - Analyze cooking results
API Reference - Explore the full API