aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--scripts/gaincal-to-saturation-map17
2 files changed, 19 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 799fab27..b1a477c4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -180,7 +180,8 @@ script_DATA = scripts/alternate-stream scripts/cell-please \
scripts/find-pairs scripts/plot-cc-and-scale.R \
scripts/ave-resolution scripts/crystal-frame-number \
scripts/plot-radius-resolution \
- scripts/detector-shift scripts/turbo-index
+ scripts/detector-shift scripts/turbo-index \
+ scripts/gaincal-to-saturation-map
EXTRA_DIST += $(script_DATA)
diff --git a/scripts/gaincal-to-saturation-map b/scripts/gaincal-to-saturation-map
new file mode 100644
index 00000000..8a803526
--- /dev/null
+++ b/scripts/gaincal-to-saturation-map
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+import numpy as np
+import h5py
+import sys
+
+fh = h5py.File(sys.argv[1], 'r')
+gains = fh['/data/data'].value
+fh.close()
+
+satns = np.ones_like(gains) * 13000
+satns[gains > 4] = 60000
+
+fh = h5py.File('saturation_map.h5', 'w')
+fh.create_dataset('/data/data', data=satns)
+fh.close()
+