10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-03 18:06:06 +02:00
QUESTDB_website/content/multipledataset.html

340 lines
11 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
---
<link rel="stylesheet" type="text/css" href="/css/modal.css" />
<script src="/js/data.js" type="text/javascript"></script>
<script src="/js/loadAllData.js" type="text/javascript"></script>
<script src="/js/getFullDataPath.js" type="text/javascript"></script>
<script src="/js/getTextFromFile.js" type="text/javascript"></script>
<script src="/js/trueTypeOf.js" type="text/javascript"></script>
<script src="/js/uniq.js"></script>
<script src="/js/processingIndicator.js"></script>
<script src="/js/noNan.js"></script>
<script src="/js/websiteFile.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>
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-10-01 14:37:26 +02:00
$('#form_dat input[type=radio]').on('change', async function(event) {
processingIndicator.isActive=true
2019-10-07 09:51:53 +02:00
document.getElementById("Geom_th").hidden=true
document.getElementById("GSGeom_th").hidden=true
document.getElementById("ESGeom_th").hidden=true
2019-09-28 15:23:25 +02:00
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-10-07 09:51:53 +02:00
document.getElementById("Geom_th").hidden=false
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-10-07 09:51:53 +02:00
document.getElementById("Geom_th").hidden=false
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-10-07 09:51:53 +02:00
document.getElementById("GSGeom_th").hidden=false
document.getElementById("ESGeom_th").hidden=false
2019-09-28 15:23:25 +02:00
break;
}
2019-09-28 16:04:36 +02:00
window.dats=await Promise.all(proms)
processingIndicator.isActive=false
2019-10-02 19:20:37 +02:00
reloadFileSelector()
await reloadSelect()
2019-09-28 15:23:25 +02:00
})
}
2019-10-02 19:20:37 +02:00
function reloadFileSelector(){
2019-10-07 11:40:35 +02:00
const fsel=document.getElementById("customFiles_input")
fsel.value=""
fsel.disabled=false
2019-10-02 19:20:37 +02:00
}
async function reloadSelect(){
processingIndicator.isActive=true
2019-10-02 19:20:37 +02:00
radioval=$('#form_dat > input[name=datatype]:checked').val();
for(file of Array.from(document.getElementById("customFiles_input").files))
{
switch (radioval) {
case "abs":
var dat=await AbsDataFile.loadAsync(file)
window.dats.push(dat)
break;
case "fluo":
dat=await FluoDataFile.loadAsync(file)
window.dats.push(dat)
break;
case "ZPE":
dat=await ZPEDataFile.loadAsync(file)
window.dats.push(dat)
break;
}
}
2019-10-01 14:37:26 +02:00
$('#form_dat > select').each(function(){
2019-09-28 15:23:25 +02:00
$(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)
}
})
$('#form_dat > input[type="submit"').prop('disabled', false);
processingIndicator.isActive=false
2019-10-02 19:20:37 +02:00
await reloadContent()
2019-09-28 15:23:25 +02:00
}
2019-10-01 14:37:26 +02:00
async function reloadStat(){
processingIndicator.isActive=true
2019-10-01 14:37:26 +02:00
var stb=document.getElementById("stat_table_b");
document.getElementById("graph_div").inerrHTML=""
2019-10-01 14:37:26 +02:00
stb.innerHTML=''
const sel_ref=document.getElementById("sel_ref")
const refstr=((sel_ref.selectedIndex>=0) ? sel_ref.options[sel_ref.selectedIndex].value : null)
var sdatdic=new Map()
for (const d of window.filt) {
const key=JSON.stringify([d.code,d.method,d.DOI])
if(!(sdatdic.has(key)))
{
sdatdic.set(key,new Map())
}
for(const exc of d.excitations){
const key2=JSON.stringify([d.molecule,exc.initial,exc.final])
const keydic=sdatdic.get(key)
if(!(keydic.has(key2))){
keydic.set(key2,[])
}
keydic.get(key2).push(exc.value)
}
}
var sdic= new Map()
for(const [key,sdat] of sdatdic){
for(const [key2,exval] of sdat){
if(!(sdic.has(key))){
sdic.set(key,[])
}
sdic.get(key).push(exval-((sdatdic.has(refstr)) ? sdatdic.get(refstr).get(key2) : NaN))
}
}
2019-10-08 11:47:48 +02:00
sdic.delete(refstr)
var graphdat=[]
2019-10-01 14:37:26 +02:00
for(const[keystr,vals] of sdic){
row=document.createElement("tr")
key=JSON.parse(keystr)
2019-10-06 17:53:49 +02:00
key.shift()
Reflect.setPrototypeOf(key[0], method.prototype)
Reflect.setPrototypeOf(key[1], doi.prototype)
2019-10-01 14:37:26 +02:00
for(const el of key){
var td=document.createElement("td")
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)
}
const noNanVals=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)]){
2019-10-01 14:37:26 +02:00
var td=document.createElement("td")
td.innerText=noNanPrecision(val,3)
row.appendChild(td)
}
stb.appendChild(row)
var box = {
x: noNanVals,
amean: ss.mean(avals).toFixed(3),
2019-10-06 17:55:08 +02:00
name: key[0].toString() + " MAD : " + ss.mean(avals).toPrecision(4),
type: 'box',
boxmean: 'sd'
};
graphdat.push(box)
2019-10-01 14:37:26 +02:00
}
var layout = {
paper_bgcolor: 'rgba(0,0,0,0)',
plot_bgcolor: 'rgba(0,0,0,0)',
gap: 0,
legend: {
traceorder: 'reversed',
},
2019-10-08 13:16:17 +02:00
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
2019-10-01 14:37:26 +02:00
}
2019-09-29 15:58:34 +02:00
async function reloadContent(){
processingIndicator.isActive=true
2019-09-29 15:58:34 +02:00
const LatexInline=['\\(','\\)']
2019-10-01 14:37:26 +02:00
window.filt=window.dats
$('#form_dat > select').each(function(){
2019-09-28 16:04:36 +02:00
const prop=$(this).attr("name")
const values=$(this).val()
2019-10-01 14:37:26 +02:00
window.filt=window.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");
dtb.innerHTML=''
2019-10-01 14:37:26 +02:00
sel_ref=document.getElementById("sel_ref")
for (const d of window.filt) {
2019-09-28 15:23:25 +02:00
var row=document.createElement("tr")
var rowd=[]
2019-10-07 09:51:53 +02:00
const els=[d.molecule,d.comment,d.code,d.method,d.DOI]
2019-10-01 14:37:26 +02:00
var op=document.createElement("option")
var opObjVal=els.slice(2)
op.value=JSON.stringify(opObjVal)
2019-10-08 10:23:56 +02:00
op.innerText=d.method
2019-10-01 14:37:26 +02:00
sel_ref.appendChild(op)
2019-10-07 09:51:53 +02:00
var tableels=els.slice()
if(d instanceof oneStateDataFileBase){
tableels.splice(3,0,d.geometry)
}
else if(d instanceof twoStateDataFileBase){
tableels.splice(3,0,[d.GS,d.ES])
}
for(const el of tableels){
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{
2019-10-01 14:37:26 +02:00
td.innerText=el
2019-09-30 09:20:13 +02:00
}
row.appendChild(td)
2019-09-28 15:23:25 +02:00
}
2019-10-02 18:19:24 +02:00
var lnkfile=document.createElement("a")
lnkfile.target="_blank"
lnkfile.innerText="Go to file"
2019-10-02 19:20:37 +02:00
lnkfile.href=await d.sourceFile.getViewerURL()
2019-10-02 18:19:24 +02:00
row.appendChild(lnkfile)
2019-09-29 15:58:34 +02:00
dtb.appendChild(row)
}
processingIndicator.isActive=true
2019-10-01 14:37:26 +02:00
await reloadStat()
2019-09-28 15:23:25 +02:00
}
</script>
{{< getDataFilesName >}}
<p>
In this page you can compare multiple dataset and have somme statistics to evaluate method or basis accuracy.
For this follow this steps
<ol>
<li>Select a value type (Absorbtion, fluorescence or \(\Delta \text{ZPE}\))</li>
<li>You can add custom files if you want</li>
2019-10-07 09:57:21 +02:00
<li>Choose each parameters (of course you can select multiples values for each)</li>
<ul>
<li>Molecule</li>
<li>Method</li>
<li>Paper</li>
</ul>
<li>Select a reference from already selected data (by default the first is already selected)</li>
<li>Now you can see the list of selected data and some statistics about these data</li>
</ol>
</p>
<form id="form_dat" action="javascript:reloadContent()" method="post">
2019-09-28 15:23:25 +02:00
<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/>
2019-10-02 19:20:37 +02:00
<label for="customFiles">Add custom data file</label>
2019-10-07 11:40:35 +02:00
<input type="file" multiple onchange="reloadSelect()" id="customFiles_input" disabled=true></input>
2019-10-02 19:20:37 +02:00
<br/>
2019-09-28 15:23:25 +02:00
<label for="mol_select">Molecule</label>
<select multiple id="mol_select" name="molecule"></select>
2019-09-28 15:23:25 +02:00
<label for="method_select">Method</label>
<select multiple id="method_select" name="method"></select>
<label for="DOI_select">Paper</label>
<select multiple id="DOI_select" name="DOI"></select>
<br/>
<input type="submit" disabled=true value="Load"></input>
2019-09-28 15:23:25 +02:00
</form>
2019-10-01 14:37:26 +02:00
<form id="form_ref">
<label for="sel_ref">Reference</label>
<select id="sel_ref" onchange="reloadStat()">
</select>
</form>
2019-09-28 15:23:25 +02:00
<br/>
<div id="data_div">
<table id="dat_table">
<thead>
<th>Molecule</th>
<th>Comment</th>
<th>Code</th>
2019-10-07 09:51:53 +02:00
<th id="Geom_th" hidden=true>Geometry</th>
<th id="GSGeom_th" hidden=true>Ground state geometry</th>
<th id="ESGeom_th" hidden=true>Excited state geometry</th>
2019-09-28 15:23:25 +02:00
<th>Method</th>
<th>Paper</th>
2019-10-02 18:19:24 +02:00
<th>File</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>
2019-10-01 14:37:26 +02:00
<th>Method</th>
<th>Paper</th>
2019-09-29 15:58:34 +02:00
<th>Min</th>
<th>Max</th>
<th>Mean</th>
2019-10-01 14:37:26 +02:00
<th>Absolute Mean</th>
2019-09-29 15:58:34 +02:00
<th>Median</th>
2019-10-01 14:37:26 +02:00
<th>Absolute Median</th>
<th>RMS</th>
2019-09-29 15:58:34 +02:00
<th>Variance</th>
<th>Standard deviation</th>
</thead>
<tbody id="stat_table_b">
2019-09-28 15:23:25 +02:00
</tbody>
<div id="graph_div"></div>
2019-09-28 15:23:25 +02:00
</table>
</div>
{{< waitModal >}}