@@ -14,7 +14,6 @@ import Table from "react-bootstrap/Table";
14
14
import Accordion from 'react-bootstrap/Accordion' ;
15
15
import { getPhaseFraction } from "./imageLogic" ;
16
16
17
-
18
17
const centreStyle = { display : 'flex' , justifyContent : 'space-evenly' , alignItems : 'center' , marginTop : '1em' }
19
18
20
19
const _getCSSColour = ( currentStateVal : any , targetStateVal : any , successPrefix : string , colourIdx : number ) : string => {
@@ -168,7 +167,6 @@ const Result = () => {
168
167
) ;
169
168
170
169
const perErr = analysisInfo ?. percentageErr ;
171
- const [ LB , UB ] = [ Math . max ( ( 1 - perErr ! / 100 ) * phaseFrac , 0 ) , Math . min ( ( 1 + perErr ! / 100 ) * phaseFrac , 1 ) ] ;
172
170
173
171
const l = analysisInfo ?. lForDefaultErr ;
174
172
const lStr = l ?. toFixed ( 0 ) ;
@@ -187,6 +185,15 @@ const Result = () => {
187
185
setMenuState ( 'processing' ) ;
188
186
}
189
187
188
+ const getDPofSigFig = ( decimal : number ) => {
189
+ const rounded = parseFloat ( decimal . toPrecision ( 1 ) ) ;
190
+ const loc = Math . ceil ( Math . abs ( Math . log10 ( rounded ) ) ) ;
191
+ return loc
192
+ }
193
+
194
+ const absErr = analysisInfo ?. absError !
195
+ const roundTo = getDPofSigFig ( absErr ) ;
196
+
190
197
const c = colours [ selectedPhase ] ;
191
198
const headerHex = rgbaToHex ( c [ 0 ] , c [ 1 ] , c [ 2 ] , c [ 3 ] ) ;
192
199
@@ -213,6 +220,11 @@ const Result = () => {
213
220
refs . map ( ( r , i ) => restyleAccordionHeaders ( r , ( i == 0 ) ) ) ;
214
221
} , [ selectedPhase ] )
215
222
223
+ 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 `
224
+ const boldText = `we can be ${ selectedConf } % confident of the true phase fraction being within ${ perErr ?. toFixed ( 1 ) } % of this value (i.e. ${ phaseFrac . toFixed ( roundTo ) } ±${ ( absErr ) . toFixed ( roundTo ) } )`
225
+ const copyText = beforeBoldText + boldText
226
+
227
+ const copyBtn = ( ) => { navigator . clipboard . writeText ( copyText ) }
216
228
217
229
return (
218
230
< >
@@ -221,9 +233,12 @@ const Result = () => {
221
233
< Accordion . Header ref = { pfResultRef } > Phase Fraction Uncertainty</ Accordion . Header >
222
234
{ /*Need to manually overwrite the style here because of werid bug*/ }
223
235
< Accordion . Body style = { { visibility : "visible" } } >
224
- The < b > bulk phase fraction ϕ is within { perErr ?. toFixed ( 3 ) } % of your image phase
225
- fraction Φ ({ phaseFrac . toFixed ( 3 ) } ) </ b > with { selectedConf } % confidence.
226
- { /*<p><b><i>i.e,</i> {LB.toFixed(3)} ≤ ϕ ≤ {UB.toFixed(3)} with {selectedConf}% confidence.</b></p>*/ }
236
+ { beforeBoldText } < b > { boldText } </ b >
237
+ < InputGroup style = { { justifyContent : 'center' , marginTop : '1em' } } >
238
+ < InputGroup . Text id = "btnGroupAddon" > Copy:</ InputGroup . Text >
239
+ < Button variant = "outline-secondary" onClick = { copyBtn } > text</ Button >
240
+ < Button variant = "outline-secondary" > citation</ Button >
241
+ </ InputGroup >
227
242
</ Accordion . Body >
228
243
</ Accordion . Item >
229
244
< Accordion . Item eventKey = "1" >
0 commit comments