aboutsummaryrefslogtreecommitdiff
path: root/doc/hitrate.html
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-12-15 14:46:12 +0100
committerThomas White <taw@physics.org>2014-12-15 14:46:49 +0100
commitac047732855fbaf26ea3029400184480fd7d4ae4 (patch)
treec3bcd2462cfc311d9493e8aaedcc5e728e17c442 /doc/hitrate.html
parent1dc4b5ae9c42e13d49c85ae106e5b2d654451ef0 (diff)
Add doc/hitrate.html
Diffstat (limited to 'doc/hitrate.html')
-rw-r--r--doc/hitrate.html80
1 files changed, 80 insertions, 0 deletions
diff --git a/doc/hitrate.html b/doc/hitrate.html
new file mode 100644
index 00000000..e8c95952
--- /dev/null
+++ b/doc/hitrate.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<title>SFX hitrate calculator</title>
+<script><!--
+
+// just for small k
+function dpois(k, lambda) {
+ var ret = Math.exp(-lambda) * Math.pow(lambda, k),
+ i = 0;
+ for (i = 2; i <= k; i++) {
+ ret /= i;
+ }
+ return ret;
+}
+
+function calc() {
+ var lambda = parseFloat(document.getElementById("lambda").value),
+ blank = dpois(0, lambda) * 100,
+ single = dpois(1, lambda) * 100,
+ two = dpois(2, lambda) * 100,
+ three = dpois(3, lambda) * 100,
+ hit = 100 - blank,
+ multi = 100 - blank - single;
+ if (lambda < 0) return;
+ document.getElementById("output").innerHTML = "<br>Blank frame: " + blank.toFixed(1) +
+ "%<br>Single lattice: " + single.toFixed(1) +
+ "% (" + (single / hit * 100).toFixed(1) + "% of hits)" +
+ "<br>Two lattices: " + two.toFixed(1) +
+ "% (" + (two / hit * 100).toFixed(1) + "% of hits)" +
+ "<br>Three lattices: " + three.toFixed(1) +
+ "% (" + (three / hit * 100).toFixed(1) + "% of hits)" +
+ "<br>Multiple lattices: " + multi.toFixed(1) +
+ "% (" + (multi / hit * 100).toFixed(1) + "% of hits)" +
+ "<br>Total Hit: " + hit.toFixed(1) + "%";
+}
+--></script>
+</head>
+
+<body onload="calc()">
+<h1>Serial crystallography Hitrate calculator</h1>
+
+<form>
+Mean number of crystals per shot: <input type="text" id="lambda" value="1.0" size=3>
+<input type="button" onClick="calc()" value="Calculate">
+<div id="output"></div>
+</form>
+
+<hr>
+<img src="hitrate.png">
+<p>Hitrate was modeled by Poisson distribution as in [1].
+The vertical line is at rate parameter = 1.</p>
+
+<ol>
+<li>Hunter, Mark S., et
+al. "<a href="http://www.nature.com/srep/2014/140812/srep06026/full/srep06026.html">Fixed-target
+protein serial microcrystallography with an x-ray free electron
+laser</a>" Scientific reports 4 (2014).</li>
+</ol>
+
+<p>The plot was generated by the following R code.</p>
+
+<pre>
+lambda &lt;- seq(0, 3, by=0.05)
+plot(lambda, 100 - 100* dpois(0, lambda=lambda), type='l',
+ ylab="Rate (%)", xlab="Mean(#Crystal/Shot)")
+lines(lambda, 100 * dpois(0, lambda=lambda), lty=2)
+lines(lambda, 100 * (1 - dpois(0, lambda=lambda) - dpois(1, lambda=lambda)), lty=3)
+lines(lambda, 100 * dpois(1, lambda=lambda), lty=1, col=2)
+lines(lambda, 100 * dpois(2, lambda=lambda), lty=1, col=3)
+lines(lambda, 100 * dpois(3, lambda=lambda), lty=1, col=4)
+abline(v=1)
+legend("topleft", lty=c(1, 2, 3, 1, 1, 1), col=c(1, 1, 1, 2, 3, 4),
+ c("Hit rate", "Blank frame", "Multiple hit", "Single lattice",
+ "Two lattices", "Three lattices"))
+</pre>
+
+</body>
+
+</html>