Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmdocherty committed Jul 29, 2024
1 parent cad56f2 commit 2f601c1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { loadFromTIFF, loadFromImage } from "./components/imageLogic";
import "./assets/scss/App.scss";
import 'bootstrap/dist/css/bootstrap.min.css';

const PATH = "http://127.0.0.1:5000";
//const PATH = "http://127.0.0.1:5000";
//const PATH = "http://localhost:7071/api";
//const PATH = "https://representative.azurewebsites.net/api"
const PATH = "https://representative.azurewebsites.net/api"
const PF_ENDPOINT = PATH + "/phasefraction"
//const PF_ENDPOINT = "https://representativity.azurewebsites.net/phasefraction"

Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ const PreviewCanvas = () => {
const canvas = canvasRef.current!;

const shortestSide = Math.min(imageInfo?.width!, imageInfo?.height!);
if (targetL < shortestSide) { return }; // if already representative
const maxSF = (targetL / shortestSide);

const newCanvL = Math.min(canvDims.h, canvDims.w)
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,21 @@ const Result = () => {
const roundTo = getDPofSigFig(absErrFromPFB);

const beforeBoldText = `The phase fraction in the segmented image is ${phaseFrac.toFixed(3)}. Assuming perfect segmentation, the model proposed by Dahari et al. suggests that `
const boldText = `we can be ${selectedConf.toFixed(1)}% confident of the true phase fraction being within ${perErrFromPFB?.toFixed(1)}% of this value (i.e. ${phaseFrac.toFixed(roundTo)}±${(absErrFromPFB).toFixed(roundTo)})`
const boldText = `we can be ${selectedConf.toFixed(1)}% confident that the material's phase fraction is within ${perErrFromPFB?.toFixed(1)}% of this value (i.e. ${phaseFrac.toFixed(roundTo)}±${(absErrFromPFB).toFixed(roundTo)})`
const copyText = beforeBoldText + boldText

const copyBtn = () => { navigator.clipboard.writeText(copyText) }

const longestSide = Math.max(imageInfo?.width!, imageInfo?.height!)
const nMore = Math.pow((Math.ceil(l! / longestSide)), 2) - 1
const nMore = Math.pow((Math.ceil(l! / longestSide)), imageInfo?.nDims!) - 1

const title = "Phase Fraction Estimation of the Material"

const smallResults = (
<>
<Accordion defaultActiveKey={['0']} flush alwaysOpen>
<Accordion defaultActiveKey={['0', '1']} flush alwaysOpen>
<Accordion.Item eventKey="0">
<Accordion.Header ref={pfResultRef}>Phase Fraction Uncertainty</Accordion.Header>
<Accordion.Header ref={pfResultRef}>{title}</Accordion.Header>
{/*Need to manually overwrite the style here because of werid bug*/}
<Accordion.Body style={{ visibility: "visible" }}>
{beforeBoldText}<b>{boldText}</b>
Expand Down Expand Up @@ -294,9 +296,9 @@ const Result = () => {
<Modal.Title>Results!</Modal.Title>
</Modal.Header>
<Modal.Body>
<Accordion defaultActiveKey={['0']} flush alwaysOpen>
<Accordion defaultActiveKey={['0', '1']} flush alwaysOpen>
<Accordion.Item eventKey="0">
<Accordion.Header ref={pfResultRef}>Phase Fraction Uncertainty</Accordion.Header>
<Accordion.Header ref={pfResultRef}>{title}</Accordion.Header>
{/*Need to manually overwrite the style here because of werid bug*/}
<Accordion.Body style={{ visibility: "visible" }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/NormalSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ const NormalSlider = () => {
const ctx = canv.getContext('2d')!;
ctx.font = "28px Noto Sans"; // was 24
ctx.fillStyle = headerHex;
ctx.fillText('Likelihood of material p.f.', 10, 40);
ctx.fillText("Likelihood of the", 10, 40);
ctx.fillText("material's p.f.", 24, 70);

const epsY = 24
ctx.fillStyle = DARK_GREY;
Expand Down Expand Up @@ -258,7 +259,7 @@ const NormalSlider = () => {
<InputGroup.Text>Confidence in p.f. bounds (%):</InputGroup.Text>

<Form.Control type="number" min={0} max={100} value={selectedConf} step={0.5} onChange={(e) => setConf(e)} width={1} size="sm"></Form.Control>
<Form.Range min={80} max={100} value={selectedConf} step={0.1} onChange={(e) => setConf(e)} />
<Form.Range min={80} max={99.999} value={selectedConf} step={0.1} onChange={(e) => setConf(e)} />
</InputGroup>
</div>)
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Popups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const MoreInfo = () => {
<Modal.Title>About the Model</Modal.Title>
</Modal.Header>
<Modal.Body>
<p>How sure are we that our measured phase fraction in a material represents the 'true' or bulk phase fraction?
<p>How sure are we that our measured phase fraction in a material represents the bulk phase fraction?
We can never know for certain, but our model allows us to assess the uncertainty.
</p>
<p>
Expand All @@ -119,7 +119,7 @@ export const MoreInfo = () => {
<p>
For finite-sized features in large images, the variance in the bulk phase fraction is some function of the CLS,
so by determining it for our measured image we can establish uncertainty bounds on the bulk phase fraction given
the measured phase fractions. Put another way, <b>we can state the true phase fraction lies within some d% of
the measured phase fractions. Put another way, <b>we can state the material's phase fraction lies within some d% of
the measured phase fraction with c% of the time.</b>
</p>

Expand Down

0 comments on commit 2f601c1

Please sign in to comment.