Skip to content

Commit 68abc66

Browse files
Uncomment unused functions
Uncomment functions to use in the future
1 parent 3caecae commit 68abc66

File tree

1 file changed

+30
-33
lines changed

1 file changed

+30
-33
lines changed

src/mvesuvio/analysis_reduction.py

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -785,39 +785,36 @@ def pseudoVoigt(self, x, sigma, gamma):
785785
return pseudo_voigt / norm
786786

787787

788-
# When interface is updated, uncomment to change the way
789-
# constraints are handled:
790-
791-
# def _get_parsed_constraints(self):
792-
#
793-
# parsed_constraints = []
794-
#
795-
# for constraint in self._constraints:
796-
# constraint['fun'] = self._get_parsed_constraint_function(constraint['fun'])
797-
#
798-
# parsed_constraints.append(constraint)
799-
#
800-
# return parsed_constraints
801-
#
802-
#
803-
# def _get_parsed_constraint_function(self, function_string: str):
804-
#
805-
# profile_order = [key for key in self._profiles.keys()]
806-
# attribute_order = ['intensity', 'width', 'center']
807-
#
808-
# words = function_string.split(' ')
809-
# for i, word in enumerate(words):
810-
# if '.' in word:
811-
#
812-
# try: # Skip floats
813-
# float(word)
814-
# except ValueError:
815-
# continue
816-
#
817-
# profile, attribute = word
818-
# words[i] = f"pars[{profile_order.index(profile) + attribute_order.index(attribute)}]"
819-
#
820-
# return eval(f"lambda pars: {' '.join(words)}")
788+
def _get_parsed_constraints(self):
789+
790+
parsed_constraints = []
791+
792+
for constraint in self._constraints:
793+
constraint['fun'] = self._get_parsed_constraint_function(constraint['fun'])
794+
795+
parsed_constraints.append(constraint)
796+
797+
return parsed_constraints
798+
799+
800+
def _get_parsed_constraint_function(self, function_string: str):
801+
802+
profile_order = [key for key in self._profiles.keys()]
803+
attribute_order = ['intensity', 'width', 'center']
804+
805+
words = function_string.split(' ')
806+
for i, word in enumerate(words):
807+
if '.' in word:
808+
809+
try: # Skip floats
810+
float(word)
811+
except ValueError:
812+
continue
813+
814+
profile, attribute = word
815+
words[i] = f"pars[{profile_order.index(profile) + attribute_order.index(attribute)}]"
816+
817+
return eval(f"lambda pars: {' '.join(words)}")
821818

822819

823820
def _replace_zero_columns_with_ncp_fit(self):

0 commit comments

Comments
 (0)