def add_param(self, kind, element, constraint=None):
        if element not in self.element_list:
            self.element_list.append(element)
            self.element_linenames.extend(get_activated_lines(
                self.params['coherent_sct_energy']['value'], [element]))
        if kind == 'area':
            return self._add_area_param(element, constraint)

        PARAM_SUFFIXES = {'pos': 'delta_center',
                          'width': 'delta_sigma',
                          'ratio': 'ratio_adjust'}
        param_suffix = PARAM_SUFFIXES[kind]

        if len(element) <= 4:
            element, line = element.split('_')
            transitions = TRANSITIONS_LOOKUP[line]

            # Mg_L -> Mg_la1, which xraylib wants
            linenames = [
                '{0}_{1}'.format(element, t) for t in transitions]

            for linename in linenames:
                # check if the line is activated
                if linename not in self.element_linenames:
                    continue
                param_name = '_'.join((str(linename), param_suffix))  # as in lmfit Model
                new_pos = PARAM_DEFAULTS[kind].copy()
                if constraint is not None:
                    self._element_strategy[param_name] = constraint
                self.params.update({param_name: new_pos})
        elif 'user' in element.lower():  # for user peak
            param_name = '_'.join((element, param_suffix))
            new_pos = PARAM_DEFAULTS[kind].copy()
            if constraint is not None:
                self._element_strategy[param_name] = constraint
            # update parameter in place
            self.params.update({param_name: new_pos})
        else:   # for pileup peak
            linename = 'pileup_'+element.replace('-', '_')
            param_name = linename + param_suffix  # as in lmfit Model
            new_pos = PARAM_DEFAULTS[kind].copy()
            if constraint is not None:
                self._element_strategy[param_name] = constraint
            # update parameter in place
            self.params.update({param_name: new_pos})
Create a Parameter controlling peak position, width,
dataset/ETHPy150Open scikit-beam/scikit-beam/skbeam/core/fitting/xrf_model.py/ParamController.add_param