aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--Makefile.am3
-rw-r--r--doc/hitrate.html80
-rw-r--r--doc/hitrate.pngbin0 -> 48217 bytes
4 files changed, 83 insertions, 1 deletions
diff --git a/AUTHORS b/AUTHORS
index b4f2af19..86dfdc40 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -58,6 +58,7 @@
* Takanori Nakane <nakane.t@gmail.com>
hdfsee ADSC export and scrollbars
Some other bits and pieces
+ Hit rate calculator (doc/hitrate.{html,png})
* Keitaro Yamashita <k.yamashita@spring8.or.jp>
process_hkl bug fix
diff --git a/Makefile.am b/Makefile.am
index fc4e6df5..d18b4bd3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -151,7 +151,8 @@ crystfeldoc_DATA = doc/twin-calculator.pdf doc/examples/lcls-dec.geom \
doc/examples/simple.geom \
doc/examples/cspad-feb2011.geom \
doc/examples/pilatus.geom \
- doc/examples/cell-example.cell
+ doc/examples/cell-example.cell \
+ doc/hitrate.html doc/hitrate.png
EXTRA_DIST += $(crystfeldoc_DATA) doc/twin-calculator.odt \
doc/reference/libcrystfel/xml/coding-standards.xml
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>
diff --git a/doc/hitrate.png b/doc/hitrate.png
new file mode 100644
index 00000000..478a1b76
--- /dev/null
+++ b/doc/hitrate.png
Binary files differ