Design of experiments library for Python with comprehensive experimental design capabilities
—
Designs optimized for fitting response surface models and process optimization. These designs efficiently estimate quadratic effects and interaction terms, making them ideal for modeling non-linear relationships and finding optimal factor settings.
Three-level designs that efficiently estimate quadratic response surfaces using fewer experimental runs than full factorial designs.
def bbdesign(n, center=None):
"""
Create a Box-Behnken design
Parameters:
- n: int, number of factors in the design (minimum 3)
- center: int, optional, number of center points to include (default 1)
Returns:
- mat: 2d-array, design matrix with levels -1, 0, +1
"""Key Features:
Usage Example:
import pyDOE3
# 3-factor Box-Behnken design
design = pyDOE3.bbdesign(3)
print(f"Design shape: {design.shape}") # (13, 3) - 12 edge points + 1 center point
# 4-factor design with 3 center points
design = pyDOE3.bbdesign(4, center=3)
print(f"Design shape: {design.shape}") # (27, 4) - 24 edge points + 3 center pointsComprehensive response surface designs combining factorial points, star points, and center points for quadratic model estimation.
def ccdesign(n, center=(4, 4), alpha="orthogonal", face="circumscribed"):
"""
Create a Central Composite Design (CCD)
Parameters:
- n: int, number of factors in the design
- center: tuple of 2 ints, number of center points in (factorial, star) blocks
- alpha: str, design property - "orthogonal" or "rotatable"
- face: str, star point placement - "circumscribed", "inscribed", or "faced"
Returns:
- mat: 2d-array, design matrix with factorial, star, and center points
"""Alpha Options:
Face Options:
Usage Example:
import pyDOE3
# Standard 3-factor CCD with orthogonal design
design = pyDOE3.ccdesign(3)
print(f"Design shape: {design.shape}") # (20, 3)
# Rotatable design with face-centered star points
design = pyDOE3.ccdesign(3, alpha="rotatable", face="faced")
# Custom center points: 2 in factorial block, 6 in star block
design = pyDOE3.ccdesign(4, center=(2, 6))Uniform space-filling designs for response surface methodology with efficient coverage of spherical experimental regions.
Builds designs by adding concentric shells of points around the center for uniform space coverage.
def doehlert_shell_design(num_factors, num_center_points=1):
"""
Generate a Doehlert shell design matrix
Parameters:
- num_factors: int, number of factors (minimum 1)
- num_center_points: int, number of center points (default 1)
Returns:
- design: 2d-array, design matrix with N = k² + k + C points
where k = factors, C = center points
"""Creates simplex-based Doehlert designs for efficient response surface exploration.
def doehlert_simplex_design(num_factors):
"""
Generate a Doehlert simplex design matrix
Parameters:
- num_factors: int, number of factors in the design
Returns:
- design: 2d-array, design matrix with k² + k + 1 points
where k = number of factors
"""Key Features of Doehlert Designs:
Usage Example:
import pyDOE3
# 3-factor Doehlert shell design with 2 center points
shell_design = pyDOE3.doehlert_shell_design(3, num_center_points=2)
print(f"Shell design shape: {shell_design.shape}") # (13, 3)
# 4-factor Doehlert simplex design
simplex_design = pyDOE3.doehlert_simplex_design(4)
print(f"Simplex design shape: {simplex_design.shape}") # (21, 4)Box-Behnken Designs:
Central Composite Designs:
Doehlert Designs:
| Design Type | Factors | Levels | Runs (3 factors) | Best For |
|---|---|---|---|---|
| Box-Behnken | 3+ | 3 | 13-15 | Constrained regions |
| Central Composite | 2+ | 3-5 | 15-20 | General RSM |
| Doehlert Shell | 1+ | Continuous | 10-13 | Space-filling |
| Doehlert Simplex | 1+ | Continuous | 13 | Sequential optimization |
All RSM designs support fitting second-order polynomial models:
y = β₀ + Σβᵢxᵢ + Σβᵢᵢxᵢ² + ΣΣβᵢⱼxᵢxⱼ + εWhere:
import numpy as np
from typing import Union, Tuple
# Type aliases for RSM designs
DesignMatrix = np.ndarray
CenterPoints = Union[int, Tuple[int, int]]
AlphaType = str # "orthogonal" or "rotatable"
FaceType = str # "circumscribed", "inscribed", or "faced"Install with Tessl CLI
npx tessl i tessl/pypi-pydoe3