✨ Added sampling of list options
This commit is contained in:
parent
d2e88c9e44
commit
c5e30f068a
1 changed files with 23 additions and 0 deletions
|
@ -147,6 +147,10 @@ Pattern.prototype.sampleOption = function(optionName) {
|
|||
let anchors = {};
|
||||
let parts = this.sampleParts();
|
||||
let option = this.config.options[optionName];
|
||||
if (typeof option.list === "object") {
|
||||
console.log("sampling list");
|
||||
return this.sampleListOption(optionName);
|
||||
}
|
||||
if (typeof option.min === "undefined" || typeof option.max === "undefined") {
|
||||
let min = option * 0.9;
|
||||
let max = option * 1.1;
|
||||
|
@ -169,6 +173,25 @@ Pattern.prototype.sampleOption = function(optionName) {
|
|||
return this;
|
||||
};
|
||||
|
||||
Pattern.prototype.sampleListOption = function(optionName) {
|
||||
let parts = this.sampleParts();
|
||||
let option = this.config.options[optionName];
|
||||
let anchors = {};
|
||||
let count = 1;
|
||||
for (let val of option.list) {
|
||||
this.options[optionName] = val;
|
||||
this.debug(
|
||||
debugStyle("info", "🔬 Sample run"),
|
||||
`Sampling option ${optionName} with value ${round(val)}`
|
||||
);
|
||||
this.sampleRun(parts, anchors, count);
|
||||
count++;
|
||||
}
|
||||
this.parts = parts;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles measurement sampling
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue