Skip to content

Commit

Permalink
Uncomment unused functions
Browse files Browse the repository at this point in the history
Uncomment functions to use in the future
  • Loading branch information
GuiMacielPereira committed Aug 22, 2024
1 parent 3caecae commit 68abc66
Showing 1 changed file with 30 additions and 33 deletions.
63 changes: 30 additions & 33 deletions src/mvesuvio/analysis_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,39 +785,36 @@ def pseudoVoigt(self, x, sigma, gamma):
return pseudo_voigt / norm


# When interface is updated, uncomment to change the way
# constraints are handled:

# def _get_parsed_constraints(self):
#
# parsed_constraints = []
#
# for constraint in self._constraints:
# constraint['fun'] = self._get_parsed_constraint_function(constraint['fun'])
#
# parsed_constraints.append(constraint)
#
# return parsed_constraints
#
#
# def _get_parsed_constraint_function(self, function_string: str):
#
# profile_order = [key for key in self._profiles.keys()]
# attribute_order = ['intensity', 'width', 'center']
#
# words = function_string.split(' ')
# for i, word in enumerate(words):
# if '.' in word:
#
# try: # Skip floats
# float(word)
# except ValueError:
# continue
#
# profile, attribute = word
# words[i] = f"pars[{profile_order.index(profile) + attribute_order.index(attribute)}]"
#
# return eval(f"lambda pars: {' '.join(words)}")
def _get_parsed_constraints(self):

parsed_constraints = []

for constraint in self._constraints:
constraint['fun'] = self._get_parsed_constraint_function(constraint['fun'])

parsed_constraints.append(constraint)

return parsed_constraints


def _get_parsed_constraint_function(self, function_string: str):

profile_order = [key for key in self._profiles.keys()]
attribute_order = ['intensity', 'width', 'center']

words = function_string.split(' ')
for i, word in enumerate(words):
if '.' in word:

try: # Skip floats
float(word)
except ValueError:
continue

profile, attribute = word
words[i] = f"pars[{profile_order.index(profile) + attribute_order.index(attribute)}]"

return eval(f"lambda pars: {' '.join(words)}")


def _replace_zero_columns_with_ncp_fit(self):
Expand Down

0 comments on commit 68abc66

Please sign in to comment.