10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-23 03:07:44 +02:00

Add some statistics data

This commit is contained in:
Mickaël Véril 2019-09-29 15:58:34 +02:00
parent f8b654de60
commit f477542be9

View File

@ -9,9 +9,11 @@ draft: false
<script src="/scripts/getTextFromFile.js" type="text/javascript"></script>
<script src="/scripts/trueTypeOf.js" type="text/javascript"></script>
<script src="/scripts/uniq.js"></script>
<script src="/scripts/noNan.js"></script>
<script src="https://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js"
type="text/javascript"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script>
window.onload= async ()=>{
$('#form input[type=radio]').on('change', async function(event) {
@ -31,7 +33,7 @@ draft: false
}
window.dats=await Promise.all(proms)
reloadSelect()
reloadContent()
await reloadContent()
})
}
function reloadSelect(){
@ -46,7 +48,8 @@ draft: false
}
})
}
function reloadContent(){
async function reloadContent(){
const LatexInline=['\\(','\\)']
var filt=window.dats
$('#form > select').each(function(){
const prop=$(this).attr("name")
@ -58,19 +61,62 @@ draft: false
return values.includes(JSON.stringify(d[prop]))
})
})
var tb=document.getElementById("table_b");
tb.innerHTML=''
var dtb=document.getElementById("dat_table_b");
var stb=document.getElementById("stat_table_b");
dtb.innerHTML=''
stb.innerHTML=''
var sdic=new Map()
for (const d of filt) {
var row=document.createElement("tr")
var rowd=[]
var e=[d.molecule,d.comment,d.code,d.method,d.DOI]
for(el of e){
var els=[d.molecule,d.comment,d.code,d.method,d.DOI]
for(const el of els){
td=document.createElement("td")
td.innerText=el
row.appendChild(td)
}
tb.appendChild(row)
dtb.appendChild(row)
row=[]
if(!(sdic.has(d.molecule)))
{
sdic.set(d.molecule,new Map())
}
var exdic=sdic.get(d.molecule)
for(const exc of d.excitations){
var key=JSON.stringify([exc.initial,exc.final])
if(!(exdic.has(key))){
exdic.set(key,[])
}
exdic.get(key).push(exc.value)
}
}
for(const [mol,exs] of sdic){
var defmol=true
for (const [exstr,values] of exs) {
var row=document.createElement("tr")
if(defmol){
var td=document.createElement("td")
td.innerText=mol
td.rowSpan=exs.leight
row.appendChild(td)
defmol=false
}
ex=JSON.parse(exstr).map(v=>{
return Object.setPrototypeOf(v,state.prototype)
})
var td=document.createElement("td")
td.innerText=String.raw`${LatexInline[0]} ${ex[0].toLaTeX()} \rightarrow ${ex[1].toLaTeX()}${LatexInline[1]}`
row.appendChild(td)
e=[ss.min(values),ss.max(values),ss.mean(values),ss.median(values),ss.variance(values),ss.standardDeviation(values),ss.medianAbsoluteDeviation(values)]
e.forEach(v =>{
td=document.createElement("td")
td.innerText=noNanPrecision(v,3);
row.appendChild(td)
})
stb.appendChild(row)
}
}
await MathJax.typesetPromise()
}
</script>
{{< getDataFilesName >}}
@ -102,7 +148,24 @@ draft: false
<th>Method</th>
<th>DOI</th>
</thead>
<tbody id="table_b">
<tbody id="dat_table_b">
</tbody>
</table>
</div>
<div id="stat_div">
<table id="stat_table">
<thead>
<th>Molecule</th>
<th>Transition</th>
<th>Min</th>
<th>Max</th>
<th>Mean</th>
<th>Median</th>
<th>Variance</th>
<th>Standard deviation</th>
<th>Median absolute deviation</th>
</thead>
<tbody id="stat_table_b">
</tbody>
</table>
</div>