aboutsummaryrefslogtreecommitdiff
path: root/scripts/gaincal-to-saturation-map
blob: 5287577a818300e7ecb30aee60973b05ed6571ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Convert gain map to saturation map
#
# Copyright © 2016-2020 Deutsches Elektronen-Synchrotron DESY,
#                       a research centre of the Helmholtz Association.
#
# Author:
#    2016-2017 Thomas White <taw@physics.org>

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()