irrad_control/irrad_interpreter.py
def _calc_digital_shift(self, data, server, ch_types, m='h'):
        """Calculate the beam displacement on the secondary electron monitor from the digitized foil signals"""

        # Get indices of respective foil signals in data and extract
        idx_a, idx_b = self.ch_type_idx[server][ch_types[0]], self.ch_type_idx[server][ch_types[1]]
        a, b = data[self.adc_setup[server]['channels'][idx_a]], data[self.adc_setup[server]['channels'][idx_b]]

        # Convert to currents since ADC channels can have different R/O scales
        a = a / 5.0 * self.adc_setup[server]['ro_scales'][idx_a]
        b = b / 5.0 * self.adc_setup[server]['ro_scales'][idx_b]

        # Do calc and catch ZeroDivisionError
        try:
            res = float(a - b) / float(a + b)
        except ZeroDivisionError:
            res = 0.0

        # If we don't have beam, sometimes results get large and cause problems with displaying the data, therefore limit
        res = 1 if res > 1 else -1 if res < -1 else res

        # Horizontally, if we are shifted to the left the graph should move to the left, therefore * -1
        return -1 * res if m == 'h' else res
Calculate the beam displacement on the secondary electron monitor from the digitized foil signals
Calculate the beam displacement on the secondary electron monitor from the digitized foil signals
Calculate the beam displacement on the secondary electron monitor from the digitized foil signals
def _calc_digital_shift(self, data, server, ch_types, m='h'):
        idx_a, idx_b = self.ch_type_idx[server][ch_types[0]], self.ch_type_idx[server][ch_types[1]]
        a, b = data[self.adc_setup[server]['channels'][idx_a]], data[self.adc_setup[server]['channels'][idx_b]]
        a = a / 5.0 * self.adc_setup[server]['ro_scales'][idx_a]
        b = b / 5.0 * self.adc_setup[server]['ro_scales'][idx_b]
        try:
            res = float(a - b) / float(a + b)
        except ZeroDivisionError:
            res = 0.0
        res = 1 if res > 1 else -1 if res < -1 else res
        return -1 * res if m == 'h' else res
def _calc_digital_shift ( self , data , server , ch_types , m = 'h' ) : idx_a , idx_b = self . ch_type_idx [ server ] [ ch_types [ 0 ] ] , self . ch_type_idx [ server ] [ ch_types [ 1 ] ] a , b = data [ self . adc_setup [ server ] [ 'channels' ] [ idx_a ] ] , data [ self . adc_setup [ server ] [ 'channels' ] [ idx_b ] ] a = a / 5.0 * self . adc_setup [ server ] [ 'ro_scales' ] [ idx_a ] b = b / 5.0 * self . adc_setup [ server ] [ 'ro_scales' ] [ idx_b ] try : res = float ( a - b ) / float ( a + b ) except ZeroDivisionError : res = 0.0 res = 1 if res > 1 else - 1 if res < - 1 else res return - 1 * res if m == 'h' else res
Calculate the beam displacement on the secondary electron monitor from the digitized foil signals
Calculate the beam displacement on the secondary electron monitor from the digitized foil signals
"""Calculate the beam displacement on the secondary electron monitor from the digitized foil signals""" # Get indices of respective foil signals in data and extract # Convert to currents since ADC channels can have different R/O scales # Do calc and catch ZeroDivisionError # If we don't have beam, sometimes results get large and cause problems with displaying the data, therefore limit # Horizontally, if we are shifted to the left the graph should move to the left, therefore * -1
self
data
server
ch_types
m