Module documentation¶
- main.get_design(n_runs: int, index: str)¶
Generate the full design matrix given the number of runs and the specific index of the design.
- Parameters:
n_runs (int) – Number of runs.
index (str) – Index of the design. Equivalent to the first column in the tables of Chen, Sun and Wu (1993)
- Raises:
ValueError – Number of runs must be a power of 2. Index must correspond to a design in the paper.
- Returns:
mat – Full design matrix.
- Return type:
np.array
Examples
Generate the design matrix of the 16-run design with index “8-4.1” from Table 2 of Chen, Sun and Wu (1993)
>>> get_design(16, "8-4.3") array([[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 1, 1, 0, 0, 1], [0, 0, 0, 1, 1, 1, 1, 0], [0, 1, 1, 0, 0, 0, 1, 0], [0, 1, 1, 0, 0, 1, 0, 1], [0, 1, 1, 1, 1, 0, 1, 1], [0, 1, 1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1], [1, 0, 1, 1, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 1, 0], [1, 1, 0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 1, 1, 0, 1], [1, 1, 0, 1, 0, 0, 1, 1], [1, 1, 0, 1, 0, 1, 0, 0]])
- main.get_wlp(n_runs: int, index: str)¶
Retrieve the word length pattern (WLP) starting on length 3 words for a given run size and design index. For 64-run design, the (WLP) starts on length 4 words.
- Parameters:
n_runs (int) – Number of runs
index (str) – Index of the design. Equivalent to the first column in the tables of Chen, Sun and Wu (1993)
- Returns:
wlp – Word length pattern
- Return type:
List[int]
- Raises:
ValueError – Number of runs must be a power of 2. Index must correspond to a design in the paper.
Example
Retrieve the Word length pattern of the 32-run design with index “17-12.3”, presented in Table 3 of Chen, Sun and Wu (1993)
>>> get_wlp(32,"17-12.3") [18, 95, 192, 354]
- main.get_cfi(n_runs: int, index: str)¶
Retrieve the number of clear two-factor interactions for a given run size and design index.
A two-factor interaction is considered clear if it is not aliased with any other main effect or two-factor interaction.
- Parameters:
n_runs (int) – Number of runs
index (str) – Index of the design. Equivalent to the first column in the tables of Chen, Sun and Wu (1993)
- Returns:
cfi – Number of clear two-factor interactions
- Return type:
int
- Raises:
ValueError – Number of runs must be a power of 2. Index must correspond to a design in the paper
Example
Retrieve the number of clear two-factor interaction in the 64-run design with index “11-5.2”, presented in Table 4 of Chen, Sun and Wu (1993)
>>> get_cfi(64,"11-5.2") 25
- main.num2word(n: int) str¶
Give the generator corresponding to a given column number. A generator is a letter representation of an interaction between two or more basic factors.
- Parameters:
n (int) – Column number
- Returns:
gen – Corresponding generator
- Return type:
str
- Raises:
ValueError – Column number must be a positive integer
Examples
Check to which generator corresponds column number 11. Eleven can be decomposed in powers of two: 1, 2 and 8, so the corresponding generator must contain ‘a’, ‘b’ and ‘d’.
>>> num2word(11) 'abd'
- main.word2num(w: str) int¶
Give the generator corresponding to the given column number. The generator does not contain the letter representing the added factor itself, but only the letters representing the basic factors forming the interaction.
- Parameters:
w (str) – Generator
- Returns:
num – Column number
- Return type:
int
- Raises:
ValueError – Generator must only contain lowercase letters from a to z
Examples
Which column number is equivalent to the generator ‘abc’ ?
>>> word2num('abc') 7