This tutorial will guide you through advanced techniques for analyzing and optimizing flavor profiles using TomatoPy's taste testing capabilities.
Prerequisites
Before starting, make sure you have:
Basic understanding of Python
Understanding of basic taste concepts
Experience with basic flavor analysis
Step 1: Setting Up the Taste Testing Environment
First, let's initialize our taste testing environment:
Copy from tomatopy import TasteTester , TasteProfile
# Initialize taste tester
tester = TasteTester ()
# Configure testing environment
tester . configure (
temperature = 22 , # Celsius
humidity = 0.65 ,
lighting = "standard" ,
background_noise = "minimal"
)
Step 2: Basic Flavor Analysis
Let's start with a comprehensive flavor analysis:
Copy # Create a test ingredient
from tomatopy import Tomato
test_tomato = Tomato(
ripeness=0.9,
variety="San Marzano",
weight=150 # grams
)
# Perform comprehensive analysis
profile = tester.analyze(
test_tomato,
depth="comprehensive",
include_aroma=True,
include_texture=True
)
# Access basic metrics
print(f"Sweetness: {profile.sweetness}")
print(f"Acidity: {profile.acidity}")
print(f"Umami: {profile.umami}")
Step 3: Advanced Aroma Analysis
Let's dive deep into aroma profiling:
Copy # Get detailed aroma profile
aroma_profile = tester.analyze_aroma(
test_tomato,
include_secondary_notes=True,
include_tertiary_notes=True
)
# Access aroma metrics
print("Primary Notes:")
for note in aroma_profile.primary_notes:
print(f"- {note.name}: {note.intensity}")
print("\nSecondary Notes:")
for note in aroma_profile.secondary_notes:
print(f"- {note.name}: {note.intensity}")
print("\nTertiary Notes:")
for note in aroma_profile.tertiary_notes:
print(f"- {note.name}: {note.intensity}")
Step 4: Texture Analysis
Let's analyze the texture profile:
Copy # Get detailed texture profile
texture_profile = tester.analyze_texture(
test_tomato,
include_mouthfeel=True,
include_structural_analysis=True
)
# Access texture metrics
print(f"Firmness: {texture_profile.firmness}")
print(f"Juiciness: {texture_profile.juiciness}")
print(f"Mouthfeel: {texture_profile.mouthfeel}")
print(f"Structural integrity: {texture_profile.structural_integrity}")
Step 5: Flavor Balance Analysis
Let's analyze the balance of flavors:
Copy # Analyze flavor balance
balance = tester.analyze_balance(test_tomato)
# Access balance metrics
print(f"Overall balance: {balance.overall_score}")
print(f"Sweet-sour ratio: {balance.sweet_sour_ratio}")
print(f"Umami enhancement: {balance.umami_enhancement}")
print(f"Flavor complexity: {balance.complexity}")
Step 6: Comparative Analysis
Let's compare multiple ingredients:
Copy # Create multiple test ingredients
tomato1 = Tomato(ripeness=0.8, variety="San Marzano")
tomato2 = Tomato(ripeness=0.9, variety="Roma")
tomato3 = Tomato(ripeness=0.7, variety="Cherry")
# Perform comparative analysis
comparison = tester.compare(
[tomato1, tomato2, tomato3],
metrics=["sweetness", "acidity", "umami", "aroma"]
)
# Access comparison results
print("\nSweetness Comparison:")
for tomato, score in comparison.get_rankings("sweetness"):
print(f"- {tomato.variety}: {score}")
print("\nAcidity Comparison:")
for tomato, score in comparison.get_rankings("acidity"):
print(f"- {tomato.variety}: {score}")
Step 7: Flavor Optimization
Let's optimize the flavor profile:
Copy # Create a target profile
target_profile = TasteProfile(
sweetness=0.7,
acidity=0.6,
umami=0.8,
aroma_intensity=0.75
)
# Analyze current profile
current_profile = tester.analyze(test_tomato)
# Get optimization recommendations
recommendations = tester.get_optimization_recommendations(
current_profile,
target_profile
)
# Print recommendations
print("\nOptimization Recommendations:")
for rec in recommendations:
print(f"- {rec}")
Step 8: Advanced Visualization
Let's create detailed visualizations of our flavor profiles:
Copy # Create basic visualization
viz = tester.visualize_profile(profile)
# Customize visualization
viz.set_color_scheme("tomato")
viz.set_scale("logarithmic")
viz.set_style("radar")
# Add additional metrics
viz.add_metrics(["aroma", "texture"])
# Display visualization
viz.show()
Advanced Techniques
Multi-Dimensional Analysis
Copy # Perform multi-dimensional analysis
analysis = tester.analyze_multi_dimensional(
test_tomato,
dimensions=[
"taste",
"aroma",
"texture",
"mouthfeel",
"aftertaste"
]
)
# Access multi-dimensional results
print("\nMulti-Dimensional Analysis:")
for dimension, metrics in analysis.items():
print(f"\n{dimension.upper()}:")
for metric, value in metrics.items():
print(f"- {metric}: {value}")
Time-Based Analysis
Copy # Analyze flavor development over time
time_analysis = tester.analyze_time_development(
test_tomato,
duration="5m",
interval="30s"
)
# Plot time-based development
viz = tester.visualize_time_development(time_analysis)
viz.show()
Statistical Analysis
Copy # Perform statistical analysis
stats = tester.analyze_statistics(
[tomato1, tomato2, tomato3],
metrics=["sweetness", "acidity", "umami"]
)
# Access statistical results
print("\nStatistical Analysis:")
print(f"Mean sweetness: {stats.mean('sweetness')}")
print(f"Standard deviation: {stats.std('sweetness')}")
print(f"Correlation matrix: {stats.correlation_matrix}")
Best Practices
Proper Sample Preparation
Copy # Ensure consistent sample preparation
if not tester.validate_sample(test_tomato):
print("Warning: Sample may not be suitable for analysis")
Comprehensive Analysis
Copy # Use comprehensive analysis for detailed results
profile = tester.analyze(
ingredient,
depth="comprehensive",
include_all_metrics=True
)
Data Validation
Copy # Validate analysis results
if profile.is_valid():
# Proceed with analysis
print(profile.get_summary())
else:
print("Warning: Analysis may be incomplete")
Next Steps
Recipes Library - Try more recipes