10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 13:13:55 +01:00
QUESTDB_website/content/onedataset.html

218 lines
7.5 KiB
HTML

---
title: "One dataset"
date: 2019-08-29 09:00
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/noNan.js"></script>
<script src="/scripts/websiteFile.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>
{{< getDataFilesName >}}
<script>
window.onload=async function()
{
window.Cite = require('citation-js');
window.dats=await loadAllData()
window.data=new CombinedData()
molecules=new Set(Object.values(window.dats).flat().map((d)=>d.molecule))
for (const el of molecules) {
op=document.createElement("option")
op.value=el
op.innerText=el
document.getElementById("select_mol").appendChild(op)
}
}
function select_mol_onchange(event){
update_mol(event.target.value)
}
function select_abs_onchange(event){
update_abs(window.dats["abs"][event.target.value])
}
function select_fluo_onchange(event){
update_fluo(window.dats["fluo"][event.target.value])
}
function select_ZPE_onchange(event){
update_ZPE(window.dats["ZPE"][event.target.value])
}
async function update_mol(molecule){
for (const [key,dat] of Object.entries(window.dats)) {
var s=document.getElementById(String.raw`select_${key}`)
while (s.options[s.options.length-1].value!= "") {
s.options.remove(s.options[s.options.length-1])
}
dat.forEach((val,index)=>{
if(val.molecule==molecule){
var op=document.createElement("option")
op.value=index
op.innerText=val.method.toString()
s.appendChild(op)
}
})
}
}
async function update_abs(abs){
window.data.Abs=abs
reload()
}
async function update_fluo(fluo){
window.data.Fluo=fluo
reload()
}
async function update_ZPE(ZPE){
window.data.ZPE=ZPE
reload()
}
async function update_file(file) {
dat= await data.loadAsync(file);
await applyData(dat);
}
async function reload() {
const LatexInline=['\\(','\\)']
var par=document.getElementById("data_par")
par.innerHTML='';
var md=[];
var els=[];
var customRenderingProp=["excitations","sourceFile"]
for (const key of Object.keys(window.data)) {
if (window.data[key]!=null){
md.push(key)
for (const prop of Object.keys(window.data[key])) {
if(!(customRenderingProp.includes(prop)))
md.push([prop,window.data[key][prop]])
}
md.push(window.data[key].DOI)
md.push(window.data[key].sourceFile)
}
}
div=document.getElementById("meta_div")
div.innerHTML=""
for (const element of md) {
var node =null;
switch (trueTypeOf(element)) {
case "string":
node= document.createElement("h2");
node.innerText=element;
break;
case "doi":
var publi=await Cite.async(element.string)
var output = publi.format('bibliography', {
format: 'html',
template: 'apa',
lang: 'en-US'
})
node=document.createElement("a")
node.innerHTML=output
node.target='_blank'
node.href=element.url
break
case "websiteFile":
node=document.createElement("a")
node.innerText="Go to file"
node.target='_blank'
node.href= await element.getViewerURL()
break
case "Array":
k=element[0]
v=element[1]
k=k.charAt(0).toUpperCase() + k.slice(1)
node = document.createElement("div");
node.innerText= k+': '+v;
break;
}
div.appendChild(node);
}
var tb=document.getElementById("ex_table_b");
tb.innerHTML=''
for (const el of window.data.excitations) {
var row=document.createElement("tr")
var rowd=[]
rowd.push(String.raw`${LatexInline[0]} ${el.initial.toLaTeX()} \rightarrow ${el.final.toLaTeX()}${LatexInline[1]}`)
var e=[el.Eabs,el.Efluo,el.EZPE,el.Eadia,el.Ezz]
e.forEach((val)=>rowd.push(noNanPrecision(val,3)))
for(d of rowd) {
td=document.createElement("td")
td.innerText=d
row.appendChild(td)
}
tb.appendChild(row)
}
await MathJax.typesetPromise();
document.getElementById("ex_div").hidden=false
var plotdat = [{
x: [],
y: [],
type: 'bar'
}];
var expAbsData= await AbsDataFile.loadAsync("/abs/"+window.data.Abs.molecule.toLowerCase()+"_exp.dat")
var i;
for (i = 0; i < window.data.excitations.length; i++) {
var ext=window.data.excitations[i];
var exexp=expAbsData.excitations[i]
plotdat[0].x.push(ext.final.toString())
plotdat[0].y.push(ext.Eabs-exexp.value)
}
await MathJax.typesetPromise();
var layout={title: "Absorption theory deviation"}
Plotly.newPlot('abs_plot', plotdat,layout);
document.getElementById("graph_div").hidden=false
}
</script>
<script>
function onValueChange(e) {
update_file(e.target.value);
}
</script>
<div>
<label>Select a molecule<br/>
<select id="select_mol" onchange="select_mol_onchange(event)">
<option value="" disabled=true selected=true>Select a molecule</option>
</select>
</label>
</div>
<div>
<label>Select an absorption method<br/>
<select id="select_abs" onchange="select_abs_onchange(event)">
<option value="" disabled=true selected=true>Select an absorption method</option>
</select>
</label>
<label>Select a fluorescence method<br/>
<select id="select_fluo" onchange="select_fluo_onchange(event)">
<option value="" disabled=true selected=true>Select a fluorescence method</option>
</select>
</label>
<label>Select a ZPE method<br/>
<select id="select_ZPE" onchange="select_ZPE_onchange(event)">
<option value="" disabled=true selected=true>Select a ZPE method</option>
</select>
</label>
</div>
<h1>Data</h1>
<p id=data_par>
<div id="meta_div"></div>
<div id="ex_div" hidden=true>
<h2>Excitation</h2>
<table id="ex_table">
<thead>
<th>Transition</th>
<th>\(E_\text{abs}\)</th>
<th>\(E_\text{fluo}\)</th>
<th>\(\Delta E_\text{ZPE}\)</th>
<th>\(E_\text{adia}\)</th>
<th>\(E_\text{00}\)</th>
</thead>
<tbody id="ex_table_b">
</tbody>
</table>
</div>
<div id="graph_div" hidden=true>
<div id="abs_plot">
</div>
</div>
</p>