From c4c98aefb2f2d51bf4030fd7f731edcfb24d36bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Le=20Guyader?= <loic.le.guyader@xfel.eu> Date: Tue, 29 Oct 2019 10:53:12 +0100 Subject: [PATCH] automatically scale by -1 MCP data --- XAS.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/XAS.py b/XAS.py index c7605d5..527b079 100644 --- a/XAS.py +++ b/XAS.py @@ -135,10 +135,22 @@ def xas(nrun, bins=None, Iokey='SCS_SA3', Itkey='MCP3apd', nrjkey='nrj', Iooffse def whichIo(data): """ Select which fields to use as I0 and which to use as I1 """ + + if 'mcp' in Iokey.lower(): + Io_sign = -1 + else: + Io_sign = 1 + + if 'mcp' in Itkey.lower(): + It_sign = -1 + else: + It_sign = 1 + + if len(data) == 0: return absorption([], []) else: - return absorption(-data['It'], data['Io']) + return absorption(It_sign*data['It'], Io_sign*data['Io']) if bins is None: num_bins = 80 -- GitLab