From 6468dfb315be9bc2d5ee3497d61686b5e0bf3e73 Mon Sep 17 00:00:00 2001 From: Jeremy Magland Date: Fri, 17 May 2024 10:52:32 -0400 Subject: [PATCH] Update sampling options panel layout with Grid component --- .../SamplingOptsPanel/SamplingOptsPanel.tsx | 143 ++++++++++-------- gui/src/app/pages/HomePage/HomePage.tsx | 2 +- 2 files changed, 79 insertions(+), 66 deletions(-) diff --git a/gui/src/app/SamplingOptsPanel/SamplingOptsPanel.tsx b/gui/src/app/SamplingOptsPanel/SamplingOptsPanel.tsx index 26379695..f8a87a04 100644 --- a/gui/src/app/SamplingOptsPanel/SamplingOptsPanel.tsx +++ b/gui/src/app/SamplingOptsPanel/SamplingOptsPanel.tsx @@ -1,6 +1,7 @@ import { FunctionComponent, useCallback } from "react"; import { SamplingOpts, defaultSamplingOpts } from "../StanSampler/StanSampler"; import { Hyperlink } from "@fi-sci/misc"; +import { Grid } from "@mui/material"; type SamplingOptsPanelProps = { samplingOpts: SamplingOpts; @@ -21,6 +22,9 @@ type SamplingOptsPanelProps = { // Seed. Any uint32. +const sp1 = 0.5; +const sp2 = 1; + const SamplingOptsPanel: FunctionComponent = ({ samplingOpts, setSamplingOpts }) => { const num_chains = samplingOpts.num_chains; const readOnly = setSamplingOpts === undefined; @@ -29,71 +33,80 @@ const SamplingOptsPanel: FunctionComponent = ({ sampling }, [setSamplingOpts]) return (
- - - - - - - - - - - - - - - - - - - - - - - -
# chains - setSamplingOpts && setSamplingOpts({ ...samplingOpts, num_chains: value as number })} - min={1} - max={8} - readOnly={readOnly} - type="int" - /> -
# warmup - setSamplingOpts && setSamplingOpts({ ...samplingOpts, num_warmup: value as number })} - min={0} - readOnly={readOnly} - type="int" - /> -
# samples - setSamplingOpts && setSamplingOpts({ ...samplingOpts, num_samples: value as number })} - min={1} - readOnly={readOnly} - type="int" - /> -
init radius - setSamplingOpts && setSamplingOpts({ ...samplingOpts, init_radius: value as number })} - min={0} - readOnly={readOnly} - type="float" - /> -
seed - setSamplingOpts && setSamplingOpts({ ...samplingOpts, seed: value })} - min={0} - readOnly={readOnly} - type="int" - /> -
+ + + + # chains + + + setSamplingOpts && setSamplingOpts({ ...samplingOpts, num_chains: value as number })} + min={1} + max={8} + readOnly={readOnly} + type="int" + /> + + + + + # warmup + + + setSamplingOpts && setSamplingOpts({ ...samplingOpts, num_warmup: value as number })} + min={0} + readOnly={readOnly} + type="int" + /> + + + + + # samples + + + setSamplingOpts && setSamplingOpts({ ...samplingOpts, num_samples: value as number })} + min={1} + readOnly={readOnly} + type="int" + /> + + + + + init radius + + + setSamplingOpts && setSamplingOpts({ ...samplingOpts, init_radius: value as number })} + min={0} + readOnly={readOnly} + type="float" + /> + + + + + seed + + + setSamplingOpts && setSamplingOpts({ ...samplingOpts, seed: value })} + min={0} + readOnly={readOnly} + type="int" + /> + + + +
reset
diff --git a/gui/src/app/pages/HomePage/HomePage.tsx b/gui/src/app/pages/HomePage/HomePage.tsx index e5c67478..e51de2e9 100644 --- a/gui/src/app/pages/HomePage/HomePage.tsx +++ b/gui/src/app/pages/HomePage/HomePage.tsx @@ -217,7 +217,7 @@ const LowerRightView: FunctionComponent = ({ width, height, } }, [dataFileContent]) const samplingOptsPanelHeight = 140 - const samplingOptsPanelWidth = Math.min(150, width / 2) + const samplingOptsPanelWidth = Math.min(180, width / 2) const {sampler} = useStanSampler(compiledMainJsUrl) const {status: samplerStatus} = useSamplerStatus(sampler)