use of dr.app.beauti.types.PriorType in project beast-mcmc by beast-dev.
the class PriorSettingsPanel method setupChart.
void setupChart() {
chart.removeAllPlots();
if (hasInvalidInput(false)) {
quantileText.setText("Invalid input");
return;
}
PriorType priorType = (PriorType) priorCombo.getSelectedItem();
if (priorType == null) {
priorType = parameter.priorType;
priorCombo.setSelectedItem(priorType);
}
PriorOptionsPanel priorOptionsPanel = optionsPanels.get(priorType);
// TODO is this used or duplicated to OffsetPositiveDistribution?
double offset = 0.0;
// this does not refresh dist from parameter truncation lower/upper, it get them from GUI
Distribution distribution = priorOptionsPanel.getDistribution(parameter);
chart.addPlot(new PDFPlot(distribution, offset));
if (distribution != null) {
quantileText.setText(formatter.format(distribution.quantile(0.025)) + "\n" + formatter.format(distribution.quantile(0.05)) + "\n" + formatter.format(distribution.quantile(0.5)) + "\n" + formatter.format(distribution.quantile(0.95)) + "\n" + formatter.format(distribution.quantile(0.975)));
}
}
use of dr.app.beauti.types.PriorType in project beast-mcmc by beast-dev.
the class PriorSettingsPanel method setParameter.
/**
* Set the parameter to be controlled
* q
* @param parameter
*/
public void setParameter(final Parameter parameter) {
this.parameter = parameter;
priorCombo = new JComboBox();
for (PriorType priorType : PriorType.getPriorTypes(parameter)) {
priorCombo.addItem(priorType);
}
if (parameter.priorType != null) {
priorCombo.setSelectedItem(parameter.priorType);
}
// setArguments here
setupComponents();
priorCombo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
setupComponents();
dialog.pack();
dialog.repaint();
}
});
for (PriorOptionsPanel optionsPanel : optionsPanels.values()) {
optionsPanel.removeAllListeners();
optionsPanel.addListener(new PriorOptionsPanel.Listener() {
public void optionsPanelChanged() {
setupChart();
dialog.pack();
dialog.repaint();
}
});
}
}
Aggregations