Skip to content
Snippets Groups Projects
Commit 0635f3cc authored by Andrew E. Torda's avatar Andrew E. Torda
Browse files

Puts acceptance criteria on the output page. Changed default values so they...

Puts acceptance criteria on the output page. Changed default values so they are bit more interesting.
parent 06bb886f
No related branches found
No related tags found
No related merge requests found
ini_temp 0.15
ini_temp 0.05
final_temp 0.01
x_ini 1,2,3,4,5,6
n_step 100000
......@@ -14,8 +14,10 @@ package ui
import (
"bytes"
"fmt"
"os"
mcwork "example.com/ackley_mc/mc_work"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
......@@ -24,6 +26,14 @@ import (
"fyne.io/fyne/v2/widget"
)
// runStatTxt should summarise some of the statistics
func runStatTxt (rslt * mcwork.MCresult) fyne.Widget {
txt := fmt.Sprintf ("Num steps %d\nNum accepted %d\nacceptance rate %.1f %%",
rslt.NStep, rslt.NAcc, (float32(rslt.NAcc)/float32(rslt.NStep)) * 100.)
r := widget.NewLabel( txt)
return r
}
// If we get a message with an error, display it
func showErrTab(cntr *fyne.Container, err error) {
cntr.Objects = nil
......@@ -126,12 +136,14 @@ func (*rbox) Layout(objects []fyne.CanvasObject, cntrSize fyne.Size) {
}
// showResultsTab shows buttons on the left and two plots on the right
func showResultsTab(cntr *fyne.Container, win fyne.Window, fdata, xdata []byte) {
func showResultsTab(cntr *fyne.Container, win fyne.Window, rslt mcwork.MCresult) {
cntr.Objects = nil
fImage := png2image(fdata, "function.png")
xImage := png2image(xdata, "xdata.png")
right := container.New(&rbox{}, fImage, xImage)
left := leftbar(win, fdata, xdata)
fImage := png2image(rslt.Fdata, "function.png")
xImage := png2image(rslt.Xdata, "xdata.png")
rbox := container.New(&rbox{}, fImage, xImage)
right := container.NewVSplit (rbox, runStatTxt(&rslt))
right.SetOffset(0.99)
left := leftbar(win, rslt.Fdata, rslt.Xdata)
split := container.NewHSplit(left, right)
split.SetOffset(0.01)
......@@ -148,7 +160,7 @@ func outputTab(genParams genParams, cntr *fyne.Container, form *widget.Form) {
case calculating:
showCalcTab(cntr)
case resultsReady:
showResultsTab(cntr, genParams.win, s.Fdata, s.Xdata)
showResultsTab(cntr, genParams.win, s.MCresult)
form.Enable()
form.Refresh()
case errorCalc:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment