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
Always Check Ingredient State
Use Type Hints
Handle Unit Conversions Carefully
API Reference
Classes
Ingredient: Base class for all ingredientsTomato: Specialized tomato ingredientGarlic: Specialized garlic ingredientBasil: 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
Cooking Operations - Learn about cooking methods
Pizza Creation System - Create delicious pizzas
API Reference - Explore the full API
Last updated
Was this helpful?