aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rwxr-xr-xscripts/eiger-badmap32
2 files changed, 33 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index e4873cfa..3a32a42d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -184,7 +184,7 @@ script_DATA = scripts/alternate-stream scripts/cell-please \
scripts/detector-shift scripts/turbo-index-lsf \
scripts/gaincal-to-saturation-map scripts/move-entire-detector \
scripts/split-by-mask scripts/turbo-index-slurm \
- scripts/sum-peaks scripts/peakogram-stream
+ scripts/sum-peaks scripts/peakogram-stream scripts/eiger-badmap
EXTRA_DIST += $(script_DATA)
diff --git a/scripts/eiger-badmap b/scripts/eiger-badmap
new file mode 100755
index 00000000..7fe0a382
--- /dev/null
+++ b/scripts/eiger-badmap
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Generate bad pixel map for EIGER detector from a native HDF5 file
+#
+# Copyright © 2017 Deutsches Elektronen-Synchrotron DESY,
+# a research centre of the Helmholtz Association.
+#
+# Author:
+# 2017 Thomas White <taw@physics.org>
+
+import numpy as np
+import h5py
+import sys
+
+fh = h5py.File(sys.argv[1], 'r')
+frame = fh['/entry/data/data_000001'][0]
+fh.close()
+
+if len(frame.shape) != 2:
+ print("Input frame is not 2D!")
+ sys.exit(1)
+
+print("Size of mask: "+str(frame.shape[0])+" by "+str(frame.shape[1])+" pixels")
+
+mask = np.zeros_like(frame)
+mask[frame > 65535] = 1
+
+fh = h5py.File('eiger_badmap.h5', 'w')
+fh.create_dataset('/data/data', data=mask)
+fh.close()
+