def __init__(self): super().__init__("SimpleParser") # input ports self.input = StreamInput(self, "in") self.average_data = choice_input(self, "Average data", "off", ["off", "on"]) # output ports self.e = ArrayOutput(self, "e", self.read_e) self.intensity = ArrayOutput(self, "intensity", self.read_intensity) # declare self.inputs = [ self.input, self.average_data, ] self.outputs = [ self.e, self.intensity, ] self.e_data = None self.intensity_data = None
def __init__(self): super().__init__("XAS spectra") # inputs self.a_p_norm = StreamInput(self, "a_p_norm") self.a_a_norm = StreamInput(self, "a_a_norm") # parameter inputs self.fit = choice_input( self, "fit", "Do Nothing!!", [ "linear", "polynomial", "exp decay", "2 point linear", "Do Nothing!!" ], ) self.background_start = int_input(self, "p_start_xas", self.a_p_norm, 770) self.background_stop = int_input(self, "p_stop_xas", self.a_p_norm, 805) # outputs self.xas = ArrayOutput(self, "xas", self.read_xas) self.xas_bg = ArrayOutput(self, "xas_bg", self.read_xas_bg) self.xas_integral = ArrayOutput(self, "xas_integral", self.read_xas_integral)
def __init__(self): super().__init__("XMCDStreamParser") # input ports self.input = StreamInput(self, "in") self.average_data = choice_input(self, "Average data", "off", ["off", "on"]) # output ports self.t_a_all = ArrayOutput(self, "t_a_all", self.read_t_a) self.t_p_all = ArrayOutput(self, "t_p_all", self.read_t_p) self.e = ArrayOutput(self, "e", self.read_e) # declare self.inputs = [ self.input, self.average_data, ] self.outputs = [ self.t_a_all, self.t_p_all, self.e, ] self.t_a_all_data = None self.t_p_all_data = None self.e_data = None self.parent = Function
def __init__(self): super().__init__("step_subtraction") # Input Ports self.a_p_norm = StreamInput(self, "a_p_norm") self.a_a_norm = StreamInput(self, "a_a_norm") self.apply_step = choice_input(self, "Apply", "off", ["off", "on"]) self.fit_type = choice_input(self, "fit_type", "Alpha", ["Alpha", "Beta"]) self.fit_function = choice_input(self, "fit_function", "Voight", ["Voight", "Arctan"]) self.step_start = int_input(self, "step_start", self.a_p_norm, None) self.step_intermediate = int_input(self, "step_intermediate", self.a_p_norm, None) self.step_stop = int_input(self, "step_stop", self.a_p_norm, None) # output ports self.a_a_stepfunction = ArrayOutput(self, "a_a_stepfunction", self.read_a_a_stepfunction) self.a_p_stepfunction = ArrayOutput(self, "a_p_stepfunction", self.read_a_p_stepfunction) self.a_a_step_subtracted = ArrayOutput(self, "a_a_step_subtracted", self.read_a_a_step_subtracted) self.a_p_step_subtracted = ArrayOutput(self, "a_p_step_subtracted", self.read_a_p_step_subtracted)
def __init__(self): super().__init__("EXAFSStreamParser") # input ports self.input = StreamInput(self, "in") self.average_data = choice_input(self, "Average data", "off", ["off", "on"]) # output ports self.e = ArrayOutput(self, "e", self.read_e) self.intensity = ArrayOutput(self, "intensity", self.read_intensity) self.e_data = None self.intensity_data = None
def __init__(self): super().__init__("SquareGen") # ports self.frequency = free_int_input(self, "freq", 1, 3, 5) self.amplitude = free_int_input(self, "amp", 0, 20, 100) self.square = ArrayOutput(self, "square", self.read_square)
def __init__(self): super().__init__("integrate") # input ports self.input = StreamInput(self, "inputarray") self.integral = ArrayOutput(self, "integral", self.read_integral)
def __init__(self): super().__init__("Addition") # inputs self.A = StreamInput(self, "A") self.B = StreamInput(self, "B") # outputs self.added = ArrayOutput(self, "added", self.read_added)
def __init__(self): super().__init__("step_subtraction") # Input Ports self.input_array = StreamInput(self, "input_array") self.apply_step = choice_input(self, "Apply", "on", ["on", "off"]) self.fit_function = choice_input(self, "fit_function", "Voight", ["Voight", "Arctan"]) self.step_start = int_input(self, "step_start", self.input_array, None) self.step_stop = int_input(self, "step_stop", self.input_array, None) self.edge = int_input(self, "edge", self.input_array, None) # output ports self.stepfunction = ArrayOutput(self, "stepfunction", self.read_stepfunction) self.subtracted_step = ArrayOutput(self, "post_step_a", self.read_subtracted_step)
def __init__(self): super().__init__("SinGen") # ports self.frequency = free_int_input(self, "frequency", 100, 200, 500) self.amplitude = free_int_input(self, "frequency", 0, 1, 100) self.line1 = free_int_input(self, "line1", 0, 1, 100) self.line2 = free_int_input(self, "line2", 0, 1, 100) self.sin = ArrayOutput(self, "sin", self.read_sin)
def __init__(self): super().__init__("Convolve") # ports self.A = StreamInput(self, "A") self.B = StreamInput(self, "B") self.convolution = ArrayOutput(self, "convolution", self.read_convolution)
def __init__(self): super().__init__("background_subtraction") # streamed inputs # self.e = StreamInput(self, "e") self.input_data = StreamInput(self, "input_data") # input.changed += self.on_data # parameter inputs self.fit = choice_input( fn=self, name="fit", default="No fit", choices=[ "No fit", "Polynomial fit inside limits", "Polynomial fit outside limits", "exp decay (fits for all e < 'Background_start' and e > ' Background_end')", "2 point linear (straight line between 2 points)", ], ) self.apply_offset = choice_input( fn=self, name="apply_offset", default="off", choices=[ "off", "on (shifts post 'Background_end' by amount equal to e = 'Background_end' to e = 'Background_start' )", ], ) # self.apply_offset = int_input(self, "apply_offset", 1, 1, 3) self.p_start = int_input(self, "Background_start", self.input_data, None) self.p_end = int_input(self, "Background_end", self.input_data, None) self.power = free_int_input(self, "power", 1, 1, 3) # output ports self.background = ArrayOutput(self, "background", self.read_background) self.subtracted_background = ArrayOutput( self, "subtracted_background", self.read_subtracted_background)
def __init__(self, name): super().__init__(name) # input ports self.inputarray = StreamInput(self, "inputarray") self.lookup = int_input(self, "lookup", self.inputarray, None) # output ports self.value = TextOutput(self, "value", self.read_value) self.graph = ArrayOutput(self, "graph", self.read_graph)
def __init__(self): super().__init__("Scale") # inputs self.input = StreamInput(self, "input") # params self.scale_value = num_input(self, "scale_value", self.input, 1) # outputs self.scaled = ArrayOutput(self, "scaled", self.read_scaled)
def __init__(self): super().__init__("Difference") # inputs self.A = StreamInput(self, "a_p_norm") self.B = StreamInput(self, "a_a_norm") self.Reverse = choice_input(self, "A-B", "A-B", ["A-B", "B-A"]) # outputs self.diff = ArrayOutput(self, "diff", self.read_diff)
def __init__(self): super().__init__("Normalise") # streamed inputs self.t_p_all = StreamInput(self, "t_p_all") self.t_a_all = StreamInput(self, "t_a_all") # parameter inputs self.action = choice_input( self, "Action", "Do not Apply", ["Do not Apply", "Apply"] ) self.normalise_point_1 = int_input( self, "normalise_point_1", self.t_p_all, None ) self.normalise_point_2 = int_input( self, "normalise_point_2", self.t_p_all, None ) # output ports self.a_p_norm = ArrayOutput(self, "a_p_norm", self.read_a_p_norm) self.a_a_norm = ArrayOutput(self, "a_a_norm", self.read_a_a_norm)
def __init__(self): super().__init__("step_subtraction") # Input Ports self.input_array = StreamInput(self, "input_array") self.apply_step = choice_input(self, "Apply", "off", ["off", "on"]) self.fit_function = choice_input(self, "fit_function", "Voight", ["Voight", "Arctan"]) self.pre_feature_min = int_input(self, "pre_feature_min", self.input_array, None) self.pre_feature_max = int_input(self, "pre_feature_max", self.input_array, None) self.post_feature_min = int_input(self, "post_feature_min", self.input_array, None) self.post_feature_max = int_input(self, "post_feature_max", self.input_array, None) # output ports self.stepfunction = ArrayOutput(self, "stepfunction", self.read_stepfunction) self.subtracted_step = ArrayOutput(self, "subtracted_step", self.read_subtracted_step)
def __init__(self): super().__init__("Transpose") # streamed inputs self.spectra = StreamInput(self, "spectra") # parameter inputs self.action = choice_input(self, "Action", "on", ["off", "on"]) self.x_value_for_transpose = int_input(self, "x_value_for_transpose", self.spectra, 771) # output ports self.transposed_data = ArrayOutput(self, "transposed_data", self.read_transposed_data)
def __init__(self): super().__init__("area") # input ports self.input = StreamInput(self, "inputarray") # int_input takes arguments (fn, name, input_stream) # The input_stream allows for limits to be calculated for GUI sliders. self.start = int_input(self, "start", self.input, 770) self.mid = int_input(self, "mid", self.input, 790) self.end = int_input(self, "end", self.input, 800) # self.value = TextOutput(self, "value", self.read_value) self.graph = ArrayOutput(self, "graph", self.read_graph)
def __init__(self, n_inputs): super().__init__("Multiplexer") self.n_inputs = n_inputs self.inputs = [] for item in range(n_inputs): input = StreamInput(self, "in" + str(item)) self.inputs.append(input) # input.changed += self.on_data self.multiplot = ArrayOutput(self, "out", self.read_output) self.a = None
def __init__(self): super().__init__("Addition") # inputs self.A = StreamInput(self, "a_p_norm") self.B = StreamInput(self, "a_a_norm") # outputs self.added = ArrayOutput(self, "added", self.read_added) # port declaration self.inputs = [ self.Reverse, self.A, self.B, ] self.outputs = [ self.added, ]
def __init__(self): super().__init__("Identify Peaks") # Input Ports self.input_array = StreamInput(self, "input_array") self.number_of_peaks = free_int_input(self, "number_of_peaks", 1, 2, 10) self.center_of_peaks = int_input( self, "center_of_peaks", self.input_array, 5990 ) self.sigma_of_peaks = int_input(self, "sigma_of_peaks", self.input_array, 30) self.height_of_peaks = int_input( self, "height_of_peaks", self.input_array, 0.12 ) self.type_of_peaks = choice_input( self, "GaussianModel", "GaussianModel", ["GaussianModel", "LorentzianModel"] ) # output ports self.fitted_peaks = ArrayOutput(self, "fitted_peaks", self.read_fitted_peaks)
def __init__(self): super().__init__("background_subtraction") # streamed inputs # self.e = StreamInput(self, "e") self.t_p_all = StreamInput(self, "t_p_all") self.t_a_all = StreamInput(self, "t_a_all") # parameter inputs self.fit = choice_input( self, "fit", "No fit", [ "No fit", "Polynomial fit inside limits", "Polynomial fit outside limits", "exp decay (fits for all e < 'Background_start' and e > ' Background_end')", "2 point linear (straight line between 2 points)", ], ) self.apply_offset = choice_input( self, "apply_offset", "off", [ "off", "on (shifts post 'Background_end' by amount equal to e = 'Background_end' to e = 'Background_start' )", ], ) # self.apply_offset = int_input(self, "apply_offset", 1, 1, 3) self.p_start = int_input(self, "Background_start", self.t_p_all, None) self.p_end = int_input(self, "Background_end", self.t_p_all, None) self.power = free_int_input(self, "power", 1, 1, 4) # output ports self.a_p_background_subtraction = ArrayOutput( self, "a_p_background_subtraction", self.read_a_p_background_subtraction) self.a_a_background_subtraction = ArrayOutput( self, "a_a_background_subtraction", self.read_a_a_background_subtraction) self.a_p_background_subtracted = ArrayOutput( self, "a_p_background_subtracted", self.read_ia_p_background_subtracted) self.a_a_background_subtracted = ArrayOutput( self, "a_a_background_subtracted", self.read_ia_a_background_subtracted) # self.e_out= ArrayOutput(self, "e_out", self.read_e_out) # publish ports self.inputs = [ # self.e, self.t_p_all, self.t_a_all, self.fit, self.apply_offset, self.p_start, self.p_end, self.power, ] self.outputs = [ self.a_p_background_subtraction, self.a_a_background_subtraction, self.a_p_background_subtracted, self.a_a_background_subtracted, # self.e_out, ]