From beba5a40c6ba02411b0ab01b8ed822c92a4fb1d0 Mon Sep 17 00:00:00 2001 From: walterxie Date: Wed, 26 Aug 2026 13:07:09 +1200 Subject: [PATCH 1/6] Use LogUniform to replace OneOnX #159 --- .../fxtemplates/ParametricDistributions.xml | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml b/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml index 139c5e42..ce37488c 100644 --- a/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml +++ b/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml @@ -33,13 +33,6 @@ ]]> - - - -]]> - - + + + + + + + +]]> + + Date: Wed, 26 Aug 2026 15:35:48 +1200 Subject: [PATCH 2/6] fix Dirichlet incorrectly displayed in the Prior panel #160 --- .../resources/beast.fx/fxtemplates/ParametricDistributions.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml b/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml index ce37488c..8fd244a4 100644 --- a/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml +++ b/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml @@ -210,11 +210,13 @@ + 1.0 ]]> From c6093be103a39d38aa8503de801b3fd8323b8e87 Mon Sep 17 00:00:00 2001 From: walterxie Date: Wed, 26 Aug 2026 15:56:36 +1200 Subject: [PATCH 3/6] correct comments #159 --- .../beast.fx/fxtemplates/ParametricDistributions.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml b/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml index 8fd244a4..a8350ebe 100644 --- a/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml +++ b/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml @@ -181,8 +181,8 @@ ]]> - - + + templateInstance) { + Object templateParam = templateInstance == null ? null : templateInstance.getInput("param").get(); + boolean paramIsSimplex = param instanceof Simplex; + boolean templateIsSimplex = templateParam instanceof Simplex; + return paramIsSimplex == templateIsSimplex; + } + + private boolean isCompatible(Class paramDomain, Class templateDomain, boolean hasSimplexParam) { if (templateDomain == null) { // the "no prior" and ScalarDistribution templates should be rejected return false; } - + if (!hasSimplexParam) { + return false; + } + if (Real.class.isAssignableFrom(paramDomain)) { // check type first if (!(Real.class.isAssignableFrom(templateDomain))) { diff --git a/beast-fx/src/main/java/beastfx/app/inputeditor/TensorDistributionInputEditor.java b/beast-fx/src/main/java/beastfx/app/inputeditor/TensorDistributionInputEditor.java index 895e30f4..22178875 100644 --- a/beast-fx/src/main/java/beastfx/app/inputeditor/TensorDistributionInputEditor.java +++ b/beast-fx/src/main/java/beastfx/app/inputeditor/TensorDistributionInputEditor.java @@ -12,6 +12,7 @@ import beast.base.spec.type.IntVector; import beast.base.spec.type.RealVector; import beast.base.spec.type.Scalar; +import beast.base.spec.type.Simplex; import beastfx.app.util.FXUtils; import javafx.scene.Node; import javafx.scene.control.Button; @@ -255,9 +256,10 @@ private ComboBox createComboBox() { Object param = distr.paramInput.get(); Class domain = getParameterDomain(param); for (BeautiSubTemplate template : tensorTemplates) { - if (isCompatible(domain, templateDomains.get(k++))) { + if (isCompatible(domain, templateDomains.get(k), hasSimplexParam(param, templateInstances.get(k)))) { comboBox.getItems().add(template); } + k++; } if (comboBox.getItems().size() == 0) { @@ -336,12 +338,27 @@ protected void updateItem(BeautiSubTemplate item, boolean empty) { } - private boolean isCompatible(Class paramDomain, Class templateDomain) { + /** + * Domain range checks in isCompatible() can't see the "elements sum to 1" structural + * constraint of a Simplex, so a Simplex-only template must line up with a + * Simplex-valued param, and a non-Simplex template must not be offered for one. + */ + private boolean hasSimplexParam(Object param, TensorDistribution templateInstance) { + Object templateParam = templateInstance == null ? null : templateInstance.getInput("param").get(); + boolean paramIsSimplex = param instanceof Simplex; + boolean templateIsSimplex = templateParam instanceof Simplex; + return paramIsSimplex == templateIsSimplex; + } + + private boolean isCompatible(Class paramDomain, Class templateDomain, boolean hasSimplexParam) { if (templateDomain == null) { // the "no prior" and ScalarDistribution templates should be rejected return false; } - + if (!hasSimplexParam) { + return false; + } + if (Real.class.isAssignableFrom(paramDomain)) { // check type first if (!(Real.class.isAssignableFrom(templateDomain))) { From 48144523d6880ebdbd59884a20d64f0884a8c1bf Mon Sep 17 00:00:00 2001 From: walterxie Date: Fri, 28 Aug 2026 14:43:38 +1200 Subject: [PATCH 6/6] comment on Dirichlet template #160 --- .../resources/beast.fx/fxtemplates/ParametricDistributions.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml b/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml index a8350ebe..bebbdaba 100644 --- a/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml +++ b/beast-fx/src/main/resources/beast.fx/fxtemplates/ParametricDistributions.xml @@ -209,6 +209,9 @@ + + +