Skip to content
Snippets Groups Projects
Commit a37432e5 authored by Martin Teichmann's avatar Martin Teichmann
Browse files

remove old code and fix get_params

parent 8dc714e1
No related branches found
No related tags found
1 merge request!235Resolve "two issues with hRIXS"
...@@ -164,13 +164,6 @@ def to_fwhm(sigma): ...@@ -164,13 +164,6 @@ def to_fwhm(sigma):
return abs(sigma * FWHM_COEFF) return abs(sigma * FWHM_COEFF)
# -----------------------------------------------------------------------------
# Centroid
THRESHOLD = 510 # pixel counts above which a hit candidate is assumed
CURVE_A = 2.19042931e-02 # curvature parameters as determined elsewhere
CURVE_B = -3.02191568e-07
def decentroid(res): def decentroid(res):
res = np.array(res) res = np.array(res)
ret = np.zeros(shape=(res.max(axis=0) + 1).astype(int)) ret = np.zeros(shape=(res.max(axis=0) + 1).astype(int))
...@@ -180,14 +173,6 @@ def decentroid(res): ...@@ -180,14 +173,6 @@ def decentroid(res):
return ret return ret
# -----------------------------------------------------------------------------
# Integral
FACTOR = 1
RANGE = [300, 400]
BINS = abs(np.subtract(*RANGE)) * FACTOR
class hRIXS: class hRIXS:
"""The hRIXS analysis, especially curvature correction """The hRIXS analysis, especially curvature correction
...@@ -251,7 +236,6 @@ class hRIXS: ...@@ -251,7 +236,6 @@ class hRIXS:
CURVE_B = 0 CURVE_B = 0
# integral # integral
FACTOR = FACTOR
BINS = 100 BINS = 100
METHOD = 'centroid' # ['centroid', 'integral'] METHOD = 'centroid' # ['centroid', 'integral']
...@@ -270,8 +254,7 @@ class hRIXS: ...@@ -270,8 +254,7 @@ class hRIXS:
if not params: if not params:
params = ('proposal', 'x_range', 'y_range', params = ('proposal', 'x_range', 'y_range',
'threshold', 'curve_a', 'curve_b', 'threshold', 'curve_a', 'curve_b',
'factor', 'range', 'bins', 'bins', 'method', 'fields')
'method', 'fields')
return {param: getattr(self, param.upper()) for param in params} return {param: getattr(self, param.upper()) for param in params}
def from_run(self, runNB, proposal=None, extra_fields=()): def from_run(self, runNB, proposal=None, extra_fields=()):
......
...@@ -60,6 +60,12 @@ class TestHRIXS(unittest.TestCase): ...@@ -60,6 +60,12 @@ class TestHRIXS(unittest.TestCase):
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
]) ])
def test_getparam(self):
# this is just a smoke test
h = hRIXS()
d = h.get_params()
self.assertEqual(d['bins'], 100)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment