🍕🔥 Pizza is great! 🔥🍕

Cooking Operations

The cooking operations module provides a comprehensive set of tools for simulating various cooking methods and processes in TomatoPy.

Kitchen Setup

Basic Kitchen Configuration

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)

Advanced Kitchen Settings

# 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"}
})

Basic Cooking Methods

Simmering

# Simmer ingredients
sauce = kitchen.cook(
    tomato,
    method="simmer",
    temperature=100,
    duration="30m",
    stirring_frequency="occasional"
)

Boiling

# Boil ingredients
pasta = kitchen.cook(
    spaghetti,
    method="boil",
    temperature=100,
    duration="8m",
    salt_concentration=0.02  # 2% salt
)

Roasting

# Roast ingredients
roasted_tomatoes = kitchen.cook(
    tomatoes,
    method="roast",
    temperature=200,
    duration="45m",
    turning_frequency="every_15m"
)

Advanced Cooking Techniques

Pressure Cooking

# Pressure cook ingredients
beans = kitchen.cook(
    dried_beans,
    method="pressure_cook",
    pressure=103.4,  # kPa
    temperature=121,  # Celsius
    duration="30m"
)

Sous Vide

# Sous vide cooking
steak = kitchen.cook(
    beef,
    method="sous_vide",
    temperature=55,
    duration="2h",
    vacuum_sealed=True
)

Smoking

# Smoke ingredients
smoked_tomatoes = kitchen.cook(
    tomatoes,
    method="smoke",
    temperature=100,
    duration="4h",
    wood_type="hickory",
    smoke_intensity="medium"
)

Recipe Management

Creating Recipes

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)

Batch Cooking

# 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}")

Temperature Control

Temperature Monitoring

# 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")

Temperature Alerts

# Set up temperature alerts
kitchen.set_temperature_alert(
    min_temp=95,
    max_temp=105,
    callback=lambda temp: print(f"Temperature alert: {temp}°C")
)

Cooking Validation

Safety Checks

# 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")

Quality Assessment

# Assess cooking results
quality_report = kitchen.assess_cooking_result(sauce)
print(f"Overall quality: {quality_report.score}")
print(f"Recommendations: {quality_report.recommendations}")

Error Handling

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"

Best Practices

  1. Always Validate Parameters

    if kitchen.validate_cooking_parameters(
        temperature=temp,
        duration=duration,
        pressure=pressure
    ):
        # Proceed with cooking
  2. Monitor Temperature

    with kitchen.temperature_monitor() as monitor:
        result = kitchen.cook(...)
        if monitor.get_max() > safety_threshold:
            print("Warning: Temperature exceeded safety threshold")
  3. Use Appropriate Methods

    # Choose method based on ingredient
    if ingredient.requires_gentle_cooking:
        method = "simmer"
    else:
        method = "boil"

API Reference

Classes

  • Kitchen: Main class for cooking operations

  • Recipe: Recipe management class

  • TemperatureMonitor: Temperature monitoring class

  • QualityReport: Cooking quality assessment class

Methods

Kitchen 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()

Next Steps

Last updated

Was this helpful?