terpene_engineο
Terpene Engine β Cannabis phytochemistry modulation layer.
Loads terpene profiles and strain definitions from terpene_profiles.yaml, computes composite NCM deltas per strain, resolves entourage synergies, and provides the sativa/indica gradient interpolation used by the cascade engine for bipolar ENDOCANNABINOID_DRIFT staging.
# π₯ the stoner goddess gets her pharmacology right π
- class terpene_engine.TerpeneProfile(name, polarity, boiling_point_c, aroma, ncm_deltas, flavor_mods, effects)[source]ο
Bases:
objectA single cannabis terpene with pharmacological properties.
- Parameters:
- class terpene_engine.StrainProfile(name, strain_gradient, classification, thc_pct, description, terpene_weights)[source]ο
Bases:
objectA cannabis strain with its terpene composition.
- Parameters:
- class terpene_engine.StrainEffect(strain_name, strain_gradient, composite_deltas, entourage_bonuses, total_deltas, flavor_shifts, dominant_terpene, pole_label, active_entourage_rules)[source]ο
Bases:
objectComputed pharmacological effect of a strain.
- Parameters:
- class terpene_engine.TerpeneEngine(yaml_path=None)[source]ο
Bases:
objectCannabis phytochemistry computation engine.
Loads terpene profiles and strains from YAML, computes composite NCM effects, resolves entourage synergies, and provides the bipolar sativa/indica gradient for cascade interpolation.
- Parameters:
yaml_path (Optional[str])
- get_terpene(name)[source]ο
Look up a terpene by name (case-insensitive).
- Return type:
- Parameters:
name (str)
- get_strain(name)[source]ο
Look up a strain by name (case-insensitive, underscore-normalized).
- Return type:
- Parameters:
name (str)
- compute_strain_effect(strain_name)[source]ο
Compute the full pharmacological effect of a cannabis strain.
Resolves terpene weights to composite NCM deltas, applies entourage synergy rules, computes flavor axis shifts, and determines the sativa/indica pole label.
- Parameters:
strain_name (
str) β Name of the strain to compute.- Return type:
- Returns:
StrainEffect dataclass or None if strain not found.
- compute_gradient_blend(gradient)[source]ο
Interpolate between sativa and indica NCM pole signatures.
Used by the cascade engine to lerp ENDOCANNABINOID_DRIFT stage deltas based on strain_gradient position.