\n \n \n'
for (var i in data.rows) {
@@ -409,6 +430,14 @@
content += '\n \n
\n';
return content;
}
+ function fraction_table(massfrac) {
+ var content = '
element/isotope
mass fraction
\n';
+ for (var element in massfrac) {
+ content += '
'+element+'
'+massfrac[element]+'
\n';
+ }
+ content += '
';
+ return content;
+ }
function show_error(error_html) {
var content = '
\n';
content += error_html;
@@ -556,6 +585,9 @@
+ '×10-6/Å2)\n';
}
}
+
+ // Add the mass fraction table to the scattering summary.
+ content += fraction_table(sample.mass_fractions);
}
@@ -563,7 +595,10 @@
content += '
\n';
$(content).prependTo('div[id=results]'); //add to the dom
- $("table").tablesorter({sortList: [[8,1]]});
+ // Sort activations in reverse order by target time (column 8, descending)
+ $(".activation_table").tablesorter({sortList: [[8,1]]});
+ // Sort materials in reverse order by mass fraction (column 1, descending)
+ $(".material_table").tablesorter({sortList: [[1,1]]});
}
// Dynamic help support. Clicking an input field jumps to the
@@ -621,6 +656,7 @@
Material
+
diff --git a/cgi-bin/nact.py b/cgi-bin/nact.py
index 8a34af0..182265d 100755
--- a/cgi-bin/nact.py
+++ b/cgi-bin/nact.py
@@ -261,8 +261,8 @@ def cgi_call():
# Parse inputs
errors = {}
calculate = form.getfirst('calculate', 'all')
- if calculate not in ('scattering', 'activation', 'all'):
- errors['calculate'] = "calculate should be one of 'scattering', 'activation' or 'all'"
+ if calculate not in ('scattering', 'activation', 'material', 'all'):
+ errors['calculate'] = "calculate should be one of {scattering, activation, material, all}."
try:
sample = form.getfirst('sample')
chem = formula(sample)
@@ -393,6 +393,7 @@ def cgi_call():
'density': chem.density,
'thickness': thickness,
'natural_density': chem.natural_density,
+ 'mass_fractions': {str(k): v for k, v in chem.mass_fraction.items()},
}
# Run calculations