10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-26 22:33:56 +01:00
QUESTDB_website/content/multipledataset.html

186 lines
6.0 KiB
HTML
Raw Normal View History

2019-09-28 15:23:25 +02:00
---
title: "Multiple dataset"
date: 2019-09-27 16:41
draft: false
---
<script src="/scripts/data.js" type="text/javascript"></script>
<script src="/scripts/loadAllData.js" type="text/javascript"></script>
<script src="/scripts/getFullDataPath.js" type="text/javascript"></script>
<script src="/scripts/getTextFromFile.js" type="text/javascript"></script>
<script src="/scripts/trueTypeOf.js" type="text/javascript"></script>
<script src="/scripts/uniq.js"></script>
2019-09-29 15:58:34 +02:00
<script src="/scripts/noNan.js"></script>
2019-09-28 15:23:25 +02:00
<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>
2019-09-29 15:58:34 +02:00
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
2019-09-28 15:23:25 +02:00
<script>
window.onload= async ()=>{
2019-09-30 09:20:13 +02:00
window.Cite = require('citation-js');
2019-09-28 15:23:25 +02:00
$('#form input[type=radio]').on('change', async function(event) {
var result = $(this).val();
2019-09-28 16:04:36 +02:00
var proms=[];
2019-09-28 15:23:25 +02:00
switch (result) {
case "abs":
2019-09-28 16:15:33 +02:00
proms=getAbsFilesName().map((f) => AbsDataFile.loadAsync(f));
2019-09-28 15:23:25 +02:00
break;
case "fluo":
2019-09-28 16:04:36 +02:00
proms=getFluoFilesName().map((f) => FluoDataFile.loadAsync(f));
2019-09-28 15:23:25 +02:00
break;
case "zpe":
2019-09-28 16:04:36 +02:00
proms=getZPEFilesName().map((f) => ZPEDataFile.loadAsync(f));
2019-09-28 15:23:25 +02:00
break;
}
2019-09-28 16:04:36 +02:00
window.dats=await Promise.all(proms)
2019-09-28 15:23:25 +02:00
reloadSelect()
2019-09-29 15:58:34 +02:00
await reloadContent()
2019-09-28 15:23:25 +02:00
})
}
function reloadSelect(){
$('#form > select').each(function(){
$(this).find('option[value!=""]').remove()
const vals=uniq(window.dats.map((d)=>{return d[$(this).attr("name")]}))
for (const val of vals){
op=document.createElement("option")
2019-09-28 16:41:32 +02:00
op.value=JSON.stringify(val)
2019-09-28 15:23:25 +02:00
op.innerText=val.toString()
$(this).append(op)
}
})
}
2019-09-29 15:58:34 +02:00
async function reloadContent(){
const LatexInline=['\\(','\\)']
2019-09-28 15:23:25 +02:00
var filt=window.dats
2019-09-28 16:04:36 +02:00
$('#form > select').each(function(){
const prop=$(this).attr("name")
const values=$(this).val()
2019-09-28 15:23:25 +02:00
filt=filt.filter((d)=>{
2019-09-28 16:04:36 +02:00
if(typeof values=="undefined" || values==null){
return false
2019-09-28 15:23:25 +02:00
}
2019-09-28 16:41:32 +02:00
return values.includes(JSON.stringify(d[prop]))
2019-09-28 15:23:25 +02:00
})
})
2019-09-29 15:58:34 +02:00
var dtb=document.getElementById("dat_table_b");
var stb=document.getElementById("stat_table_b");
dtb.innerHTML=''
stb.innerHTML=''
var sdic=new Map()
2019-09-28 15:23:25 +02:00
for (const d of filt) {
var row=document.createElement("tr")
var rowd=[]
2019-09-29 15:58:34 +02:00
var els=[d.molecule,d.comment,d.code,d.method,d.DOI]
for(const el of els){
2019-09-28 15:23:25 +02:00
td=document.createElement("td")
2019-09-30 09:20:13 +02:00
if(trueTypeOf(el)=="doi"){
var publipromise=window.Cite.async(el.string)
var lnkdoi=document.createElement("a")
lnkdoi.href=el.url
lnkdoi.target="_blank"
publi=await publipromise
lnkdoi.innerHTML=publi.format('citation', {
format: 'html',
lang: 'en-US'
})
td.appendChild(lnkdoi)
}
else{
td.innerText=el
}
row.appendChild(td)
2019-09-28 15:23:25 +02:00
}
2019-09-29 15:58:34 +02:00
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)
}
2019-09-28 15:23:25 +02:00
}
2019-09-29 15:58:34 +02:00
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()
2019-09-28 15:23:25 +02:00
}
</script>
{{< getDataFilesName >}}
<form id="form" action="" method="post">
<legend>Data type</legend>
<input type="radio" id="abs" value="abs" name="datatype">
<label for="abs">Absorption</label>
<input type="radio" id="fluo" value="fluo" name="datatype">
<label for="fluo">Fluorescence</label>
<input type="radio" id="zpe" value="zpe" name="datatype">
<label for="zpe">\(\Delta \text{ZPE}\)</label>
<br/>
<label for="mol_select">Molecule</label>
<select multiple id="mol_select" onchange="reloadContent()" name="molecule"></select>
2019-09-28 15:23:25 +02:00
<label for="code_select">Code</label>
<select multiple id="code_select" onchange="reloadContent()" name="code"></select>
2019-09-28 15:23:25 +02:00
<label for="method_select">Method</label>
<select multiple id="method_select" onchange="reloadContent()" name="method"></select>
2019-09-28 15:23:25 +02:00
<label for="DOI_select">DOI</label>
<select multiple id="DOI_select" onchange="reloadContent()" name="DOI"></select>
2019-09-28 15:23:25 +02:00
</form>
<br/>
<div id="data_div">
<table id="dat_table">
<thead>
<th>Molecule</th>
<th>Comment</th>
<th>Code</th>
<th>Method</th>
2019-09-30 09:20:13 +02:00
<th>Reference</th>
2019-09-28 15:23:25 +02:00
</thead>
2019-09-29 15:58:34 +02:00
<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">
2019-09-28 15:23:25 +02:00
</tbody>
</table>
</div>