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)
Example #2
0
    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
Example #3
0
    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
Example #4
0
    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)
Example #5
0
    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__("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)
Example #7
0
    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__("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)
Example #9
0
    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
Example #10
0
    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)
Example #11
0
    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)
Example #12
0
    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__("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,
        ]