🍕🔥 Pizza is great! 🔥🍕

Ingredient Manipulation

The ingredient manipulation module provides tools for creating, modifying, and analyzing virtual ingredients in TomatoPy.

Creating Ingredients

Basic Ingredient Creation

from tomatopy import Ingredient

# Create a basic ingredient
tomato = Ingredient(
    name="tomato",
    amount=1,
    unit="whole",
    properties={
        "ripeness": 0.8,
        "water_content": 0.95,
        "sugar_content": 0.03
    }
)

Specialized Ingredient Classes

Modifying Ingredients

Property Updates

Unit Conversion

Ingredient Analysis

Physical Properties

Chemical Analysis

Ingredient Operations

Cutting and Chopping

Combining Ingredients

Quality Control

Freshness Check

Quality Assessment

Error Handling

Best Practices

  1. Always Check Ingredient State

  2. Use Type Hints

  3. Handle Unit Conversions Carefully

API Reference

Classes

  • Ingredient: Base class for all ingredients

  • Tomato: Specialized tomato ingredient

  • Garlic: Specialized garlic ingredient

  • Basil: Specialized basil ingredient

Methods

Ingredient Class

  • __init__(name, amount, unit, properties)

  • update_properties(properties)

  • convert_to_imperial()

  • convert_volume(from_unit, to_unit)

  • get_density()

  • get_volume()

  • get_surface_area()

  • get_ph()

  • get_water_content()

  • get_sugar_content()

  • cut(method, size, consistency)

  • chop(fineness, method)

  • combine(*ingredients, method, consistency)

  • is_fresh()

  • get_freshness_score()

  • assess_quality()

Next Steps

Last updated

Was this helpful?