10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 21:24:00 +01:00

Improve statistics table

This commit is contained in:
Mickaël Véril 2020-02-20 14:42:40 +01:00
parent c5208d13b5
commit 0714161047

View File

@ -268,71 +268,67 @@ draft: false
key.shift() key.shift()
Reflect.setPrototypeOf(key[0], method.prototype) Reflect.setPrototypeOf(key[0], method.prototype)
//Reflect.setPrototypeOf(key[1], DOI.prototype) //Reflect.setPrototypeOf(key[1], DOI.prototype)
for (const [i, el] of key.entries()) { th = $("<th/>", { scope: "column" })
var td = $("<th/>",{scope:"column"}) const [meth, doi] = key
if (i === 1) { th.clone().text(meth.toString("\n").split('-').join('\u2011')).appendTo(row)
var publi = doiCache.get(el, true) var thdoi = th.clone()
const sets = await getSets() var publi = doiCache.get(doi, true)
if (sets.has(el)) { const sets = await getSets()
var str = sets.get(el) if (sets.has(doi)) {
$(td).append(str+ " ") var str = sets.get(doi)
} $(thdoi).append(str + " ")
$("<a/>", {
href: new DOI(el).url,
target: "_blank"
}).html(publi.format('citation', {
format: 'html',
lang: 'en-US'
})).appendTo(td)
}
else {
$(td).text(el)
}
$(row).append(td)
} }
const noNanVals = (vals.every((v) => Number.isNaN(v))) ? vals : (vals.filter((v) => !Number.isNaN(v))) $("<a/>", {
const avals = noNanVals.map(v => Math.abs(v)) href: new DOI(doi).url,
for (const val of [ss.min(noNanVals), ss.max(noNanVals), ss.mean(noNanVals), ss.mean(avals), ss.median(noNanVals), ss.median(avals), ss.rootMeanSquare(noNanVals), ss.variance(noNanVals), ss.standardDeviation(noNanVals)]) { target: "_blank"
$("<td/>").text(noNanFixed(val, 2)).appendTo(row) }).html(publi.format('citation', {
format: 'html',
lang: 'en-US'
})).appendTo(thdoi)
$(row).append(thdoi)
const noNanVals = (vals.every((v) => Number.isNaN(v))) ? vals : (vals.filter((v) => !Number.isNaN(v)))
const avals = noNanVals.map(v => Math.abs(v))
for (const val of [ss.min(noNanVals), ss.max(noNanVals), ss.mean(noNanVals), ss.mean(avals), ss.median(noNanVals), ss.median(avals), ss.rootMeanSquare(noNanVals), ss.variance(noNanVals), ss.standardDeviation(noNanVals)]) {
$("<td/>").text(noNanFixed(val, 2)).appendTo(row)
}
$(stb).append(row)
var box = {
x: noNanVals,
amean: ss.mean(avals).toFixed(3),
name: key[0].toString() + " MAD : " + ss.mean(avals).toPrecision(4),
type: 'box',
boxmean: 'sd'
};
graphdat.push(box)
}
var layout = {
paper_bgcolor: 'rgba(0,0,0,0)',
plot_bgcolor: 'rgba(0,0,0,0)',
gap: 0,
legend: {
traceorder: 'reversed',
},
xaxis: {
title: {
text: 'Energy (eV)',
} }
$(stb).append(row) },
var box = { bgcolor: '#E2E2E2',
x: noNanVals, bordercolor: '#FFFFFF',
amean: ss.mean(avals).toFixed(3), borderwidth: 2,
name: key[0].toString() + " MAD : " + ss.mean(avals).toPrecision(4), // autosize: false,
type: 'box', width: 850,
boxmean: 'sd' height: 500,
}; margin: {
graphdat.push(box) l: 0,
} r: 10,
var layout = { b: 15,
paper_bgcolor: 'rgba(0,0,0,0)', t: 20,
plot_bgcolor: 'rgba(0,0,0,0)', pad: 0,
gap: 0, },
legend: { }
traceorder: 'reversed', Plotly.newPlot('graph_div', graphdat, layout);
}, processingIndicator.isActive = false
xaxis: {
title: {
text: 'Energy (eV)',
}
},
bgcolor: '#E2E2E2',
bordercolor: '#FFFFFF',
borderwidth: 2,
// autosize: false,
width: 850,
height: 500,
margin: {
l: 0,
r: 10,
b: 15,
t: 20,
pad: 0,
},
}
Plotly.newPlot('graph_div', graphdat, layout);
processingIndicator.isActive = false
} }
async function reloadContent() { async function reloadContent() {
window.filterParams = [$("#cb_unsafe").prop("checked"), Array.from(Array.from($("#cb_exTypeList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0), Array.from(Array.from($("#cb_exVertKindList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0)] window.filterParams = [$("#cb_unsafe").prop("checked"), Array.from(Array.from($("#cb_exTypeList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0), Array.from(Array.from($("#cb_exVertKindList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0)]
@ -399,7 +395,7 @@ draft: false
var head = $("<tr/>") var head = $("<tr/>")
$("<thead/>").addClass("sticky").append(head).appendTo(table) $("<thead/>").addClass("sticky").append(head).appendTo(table)
var tbody = $("<tbody/>").appendTo(table) var tbody = $("<tbody/>").appendTo(table)
var th=$("<th/>",{scope:"column"}) var th = $("<th/>", { scope: "column" })
head.append(["Molecule", "Transition"].map(x => th.clone().text(x))) head.append(["Molecule", "Transition"].map(x => th.clone().text(x)))
head.append(sortedMethods.map(x => th.clone().text(x.toString("\n").split('-').join('\u2011')))) head.append(sortedMethods.map(x => th.clone().text(x.toString("\n").split('-').join('\u2011'))))
adjustSticky(); adjustSticky();
@ -431,14 +427,14 @@ draft: false
Reflect.setPrototypeOf(ex[3], VertExcitationKind.prototype) Reflect.setPrototypeOf(ex[3], VertExcitationKind.prototype)
var tr = $("<tr/>") var tr = $("<tr/>")
if (printmol) { if (printmol) {
$("<th/>",{ scope:"row", rowspan:moldat.size}).text(molecule).appendTo(tr) $("<th/>", { scope: "row", rowspan: moldat.size }).text(molecule).appendTo(tr)
printmol = false printmol = false
} }
var Vertkindtext = "" var Vertkindtext = ""
if (ex[3].Value == VertExcitationKinds.Fluorescence.Value) { if (ex[3].Value == VertExcitationKinds.Fluorescence.Value) {
Vertkindtext = String.raw`[${VertExcitationKinds.Fluorescence.LaTeX}]` Vertkindtext = String.raw`[${VertExcitationKinds.Fluorescence.LaTeX}]`
} }
$("<th/>",{scope:"row"}).text(String.raw`${LatexInline[0]}${ex[0].toLaTeX()} \rightarrow ${ex[1].toLaTeX()} ${Vertkindtext}(${ex[2].LaTeX}) ${LatexInline[1]}`).appendTo(tr) $("<th/>", { scope: "row" }).text(String.raw`${LatexInline[0]}${ex[0].toLaTeX()} \rightarrow ${ex[1].toLaTeX()} ${Vertkindtext}(${ex[2].LaTeX}) ${LatexInline[1]}`).appendTo(tr)
var entries = Array.from(exdat.entries()) var entries = Array.from(exdat.entries())
for (const method of sortedMethods) { for (const method of sortedMethods) {
td = $("<td/>").addClass("NumberCell") td = $("<td/>").addClass("NumberCell")
@ -587,17 +583,17 @@ draft: false
<section> <section>
<table id="stat_table" class="datatable"> <table id="stat_table" class="datatable">
<thead class="sticky"> <thead class="sticky">
<th>Method</th> <th scope="col">Method</th>
<th>Set</th> <th scope="col">Set</th>
<th>Min</th> <th scope="col">Min</th>
<th>Max</th> <th scope="col">Max</th>
<th>Mean</th> <th scope="col">MSE</th>
<th>Absolute Mean</th> <th scope="col">MAE</th>
<th>Median</th> <th scope="col">Median</th>
<th>Absolute Median</th> <th scope="col">Absolute Median</th>
<th>RMS</th> <th scope="col">RMS</th>
<th>Variance</th> <th scope="col">Variance</th>
<th>Standard deviation</th> <th scope="col">Standard deviation</th>
</thead> </thead>
<tbody> <tbody>
</tbody> </tbody>