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

348 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" />
<link rel="stylesheet" type="text/css" href="/css/form.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>
<script src="/js/DOICache.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>
2019-10-09 20:10:48 +02:00
window.onload = async () => {
window.doiCache = new DOICache()
2019-10-09 20:10:48 +02:00
$('#form_dat > fieldset > input[type=radio]').on('change', async function (event) {
processingIndicator.isActive = true
$("#Geom_th,#GSGeom_th,#ESGeom_th").each(function () {
$(this).attr("hidden", true)
2019-10-09 17:53:10 +02:00
})
2019-09-28 15:23:25 +02:00
var result = $(this).val();
2019-10-09 20:10:48 +02:00
var proms = [];
2019-09-28 15:23:25 +02:00
switch (result) {
case "abs":
2019-10-09 20:10:48 +02:00
proms = getAbsFilesName().map((f) => AbsDataFile.loadAsync(f));
$("#Geom_th").attr("hidden", false)
2019-09-28 15:23:25 +02:00
break;
case "fluo":
2019-10-09 20:10:48 +02:00
proms = getFluoFilesName().map((f) => FluoDataFile.loadAsync(f));
$("#Geom_th").attr("hidden", false)
2019-09-28 15:23:25 +02:00
break;
case "zpe":
2019-10-09 20:10:48 +02:00
proms = getZPEFilesName().map((f) => ZPEDataFile.loadAsync(f));
$("#GSGeom_th,#ESGeom_th").each(function () {
$(this).attr("hidden", false)
2019-10-09 17:53:10 +02:00
})
2019-09-28 15:23:25 +02:00
break;
}
2019-10-09 20:10:48 +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-09 20:10:48 +02:00
function reloadFileSelector() {
$("#customFiles_input").attr("value", "").attr("disabled", false)
2019-10-02 19:20:37 +02:00
}
2019-10-09 20:10:48 +02:00
async function reloadSelect() {
processingIndicator.isActive = true
radioval = $('#form_dat > fieldset > input[name=datatype]:checked').val();
const files = $("#customFiles_input")[0].files
for (file of [...files]) {
2019-10-02 19:20:37 +02:00
switch (radioval) {
case "abs":
2019-10-09 20:10:48 +02:00
var dat = await AbsDataFile.loadAsync(file)
2019-10-02 19:20:37 +02:00
window.dats.push(dat)
break;
case "fluo":
2019-10-09 20:10:48 +02:00
dat = await FluoDataFile.loadAsync(file)
2019-10-02 19:20:37 +02:00
window.dats.push(dat)
break;
case "ZPE":
2019-10-09 20:10:48 +02:00
dat = await ZPEDataFile.loadAsync(file)
2019-10-02 19:20:37 +02:00
window.dats.push(dat)
break;
}
}
2019-10-10 09:49:39 +02:00
$('#form_dat > fieldset > div > select,#sel_ref').each(function () {
2019-09-28 15:23:25 +02:00
$(this).find('option[value!=""]').remove()
2019-10-10 09:49:39 +02:00
})
$('#form_dat > fieldset > div > select').each(function () {
2019-10-09 20:10:48 +02:00
const vals = uniq(window.dats.map((d) => { return d[$(this).attr("name")] }))
for (const val of vals) {
$("<option/>", {
value: JSON.stringify(val)
2019-10-09 17:53:10 +02:00
}).text(val.toString()).appendTo($(this))
}
2019-09-28 15:23:25 +02:00
})
$('#form_dat > input[type="submit"').prop('disabled', false);
2019-10-09 20:10:48 +02:00
processingIndicator.isActive = false
2019-10-02 19:20:37 +02:00
await reloadContent()
2019-09-28 15:23:25 +02:00
}
2019-10-09 20:10:48 +02:00
async function reloadStat() {
processingIndicator.isActive = true
var stb = $("#stat_table > tbody")
2019-10-09 17:53:10 +02:00
$("#graph_div").empty()
$(stb).empty()
2019-10-09 20:10:48 +02:00
var refstr = $("#sel_ref option:selected").val()
var sdatdic = new Map()
2019-10-01 14:37:26 +02:00
for (const d of window.filt) {
2019-10-09 20:10:48 +02:00
const key = JSON.stringify([d.code, d.method, d.DOI])
if (!(sdatdic.has(key))) {
sdatdic.set(key, new Map())
2019-10-01 14:37:26 +02:00
}
2019-10-09 20:10:48 +02:00
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, [])
2019-10-01 14:37:26 +02:00
}
keydic.get(key2).push(exc.value)
2019-10-09 20:10:48 +02:00
}
2019-10-01 14:37:26 +02:00
}
2019-10-09 20:10:48 +02:00
var sdic = new Map()
for (const [key, sdat] of sdatdic) {
for (const [key2, exval] of sdat) {
if (!(sdic.has(key))) {
sdic.set(key, [])
2019-10-01 14:37:26 +02:00
}
2019-10-09 20:10:48 +02:00
sdic.get(key).push(exval - ((sdatdic.has(refstr)) ? sdatdic.get(refstr).get(key2) : NaN))
2019-10-01 14:37:26 +02:00
}
}
2019-10-08 11:47:48 +02:00
sdic.delete(refstr)
2019-10-09 20:10:48 +02:00
var graphdat = []
for (const [keystr, vals] of sdic) {
row = $("<tr/>")
key = JSON.parse(keystr)
2019-10-06 17:53:49 +02:00
key.shift()
Reflect.setPrototypeOf(key[0], method.prototype)
2019-11-02 15:10:57 +01:00
Reflect.setPrototypeOf(key[1], DOI.prototype)
2019-10-09 20:10:48 +02:00
for (const el of key) {
var td = $("<td/>", {
style: "white-space: nowrap;"
2019-10-09 17:53:10 +02:00
})
if (trueTypeOf(el) == DOI.name) {
var publi = doiCache.get(el.string)
2019-10-09 20:10:48 +02:00
$("<a/>", {
href: el.url,
target: "_blank"
2019-10-09 17:53:10 +02:00
}).html(publi.format('citation', {
2019-10-09 20:10:48 +02:00
format: 'html',
lang: 'en-US'
2019-10-09 17:53:10 +02:00
})).appendTo(td)
2019-10-01 14:37:26 +02:00
}
2019-10-09 20:10:48 +02:00
else {
2019-10-09 17:53:10 +02:00
$(td).text(el)
2019-10-01 14:37:26 +02:00
}
2019-10-09 17:53:10 +02:00
$(row).append(td)
2019-10-01 14:37:26 +02:00
}
2019-10-09 20:10:48 +02:00
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)]) {
$("<td/>").text(noNanPrecision(val, 3)).appendTo(row)
2019-10-01 14:37:26 +02:00
}
2019-10-09 17:53:10 +02:00
$(stb).append(row)
var box = {
2019-10-09 20:10:48 +02:00
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)
2019-10-01 14:37:26 +02:00
}
var layout = {
2019-10-09 20:10:48 +02:00
paper_bgcolor: 'rgba(0,0,0,0)',
plot_bgcolor: 'rgba(0,0,0,0)',
gap: 0,
legend: {
traceorder: 'reversed',
},
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);
2019-10-09 20:10:48 +02:00
processingIndicator.isActive = false
2019-10-01 14:37:26 +02:00
}
2019-10-09 20:10:48 +02:00
async function reloadContent() {
doiCache.clear()
2019-10-09 20:10:48 +02:00
processingIndicator.isActive = true
const LatexInline = ['\\(', '\\)']
window.filt = window.dats
$('#form_dat > fieldset > div > select').each(function () {
const prop = $(this).attr("name")
const values = $(this).val()
window.filt = window.filt.filter((d) => {
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-10-09 20:10:48 +02:00
var dtb = $("#dat_table > tbody");
2019-10-09 17:53:10 +02:00
dtb.empty()
2019-10-09 20:10:48 +02:00
sel_ref = $("#sel_ref")
await doiCache.addRange(window.filt.map((x)=>x.DOI.string))
2019-10-01 14:37:26 +02:00
for (const d of window.filt) {
2019-10-09 20:10:48 +02:00
var row = $("<tr/>")
var rowd = []
const els = [d.molecule, d.comment, d.code, d.method, d.DOI]
var op = document.createElement("option")
var opObjVal = els.slice(2)
$("<option/>", {
value: JSON.stringify(opObjVal)
2019-10-09 17:53:10 +02:00
}).text(d.method).appendTo(sel_ref)
2019-10-09 20:10:48 +02:00
var tableels = els.slice()
if (d instanceof oneStateDataFileBase) {
tableels.splice(3, 0, d.geometry)
2019-10-07 09:51:53 +02:00
}
2019-10-09 20:10:48 +02:00
else if (d instanceof twoStateDataFileBase) {
tableels.splice(3, 0, [d.GS, d.ES])
2019-10-07 09:51:53 +02:00
}
2019-10-30 12:59:09 +01:00
tdtemp=$("<td/>", {
2019-10-09 20:10:48 +02:00
style: "white-space: nowrap;"
2019-10-09 17:53:10 +02:00
})
2019-10-30 12:59:09 +01:00
for (const el of tableels) {
td=$(tdtemp).clone()
if (trueTypeOf(el) == DOI.name) {
var publi = doiCache.get(el.string)
2019-10-09 20:10:48 +02:00
$("<a/>", {
2019-10-09 17:53:10 +02:00
href: el.url,
target: "_blank",
}).html(publi.format('citation', {
2019-10-09 20:10:48 +02:00
format: 'html',
lang: 'en-US'
})).appendTo(td)
2019-09-30 09:20:13 +02:00
}
2019-10-09 20:10:48 +02:00
else {
2019-10-09 17:53:10 +02:00
$(td).text(el)
2019-09-30 09:20:13 +02:00
}
2019-10-09 17:53:10 +02:00
$(row).append(td)
2019-09-28 15:23:25 +02:00
}
2019-10-30 12:59:09 +01:00
$(tdtemp).clone().append($("<a/>", {
2019-10-09 20:10:48 +02:00
target: "_blank",
2019-10-09 17:53:10 +02:00
href: await d.sourceFile.getViewerURL()
2019-10-30 12:59:09 +01:00
}).text("Go to file")).appendTo(row)
2019-10-09 17:53:10 +02:00
$(dtb).append(row)
2019-09-29 15:58:34 +02:00
}
2019-10-09 20:10:48 +02:00
processingIndicator.isActive = true
2019-10-01 14:37:26 +02:00
await reloadStat()
2019-09-28 15:23:25 +02:00
}
</script>
{{< getDataFilesName >}}
2019-10-09 20:10:48 +02:00
<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>
2019-10-17 14:03:06 +02:00
<li>Select a value type (Absorption, fluorescence or \(\Delta \text{ZPE}\))</li>
2019-10-09 20:10:48 +02:00
<li>You can add custom files if you want</li>
<li>Choose each parameters (of course you can select multiples values for each)</li>
<ul>
<li>Molecule</li>
<li>Method</li>
<li>Publication</li>
2019-10-09 20:10:48 +02:00
</ul>
<li>Select a reference from <strong>already selected data</strong> (by default the first is already selected)</li>
2019-10-09 20:10:48 +02:00
<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">
<fieldset>
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>
2019-10-09 20:10:48 +02:00
</fieldset>
<fieldset>
<div>
<label for="customFiles_input">Add custom data file</label>
<input type="file" multiple onchange="reloadSelect()" id="customFiles_input" disabled=true></input>
</div>
</fieldset>
<fieldset class="table">
2019-10-09 20:10:48 +02:00
<div>
<label for="mol_select">Molecule</label>
<select multiple id="mol_select" name="molecule"></select>
</div>
<div>
<label for="method_select">Method</label>
<select multiple id="method_select" name="method"></select>
</div>
<div>
<label for="DOI_select">Publication</label>
2019-10-09 20:10:48 +02:00
<select multiple id="DOI_select" name="DOI"></select>
</div>
</fieldset>
<input type="submit" disabled=true value="Load"></input>
</form>
<form id="form_ref">
<label for="sel_ref">Reference</label>
<select id="sel_ref" onchange="reloadStat()"></select>
</form>
<section>
2019-09-28 15:23:25 +02:00
<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>Publication</th>
2019-10-02 18:19:24 +02:00
<th>File</th>
2019-09-28 15:23:25 +02:00
</thead>
2019-10-09 17:53:10 +02:00
<tbody>
2019-09-29 15:58:34 +02:00
</tbody>
</table>
2019-10-09 20:10:48 +02:00
</section>
<section>
2019-09-29 15:58:34 +02:00
<table id="stat_table">
<thead>
2019-10-01 14:37:26 +02:00
<th>Method</th>
<th>Publication</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>
2019-10-09 17:53:10 +02:00
<tbody>
2019-09-28 15:23:25 +02:00
</tbody>
<div id="graph_div"></div>
2019-09-28 15:23:25 +02:00
</table>
2019-10-09 20:10:48 +02:00
</section>
{{< waitModal >}}