Skip to content

Commit

Permalink
distribution range (#3171)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwdchang authored Mar 26, 2024
1 parent e331ad2 commit 9e21f7f
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,20 @@ const initialize = async () => {
// Ensure the parameters have constant and distributions for editing in children components
knobs.value.parameters.forEach((param) => {
if (!param.distribution) {
// provide a non-zero range, unless val is itself 0
const val = param.value;
let lb = 0;
let ub = 0;
if (val && val !== 0) {
lb = val - Math.abs(0.05 * val);
ub = val + Math.abs(0.05 * val);
}
param.distribution = {
type: 'StandardUniform1',
parameters: {
minimum: param.value || 1,
maximum: param.value || 1
minimum: lb,
maximum: ub
}
};
}
Expand Down

0 comments on commit 9e21f7f

Please sign in to comment.