@@ -785,39 +785,36 @@ def pseudoVoigt(self, x, sigma, gamma):
785
785
return pseudo_voigt / norm
786
786
787
787
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 )} " )
821
818
822
819
823
820
def _replace_zero_columns_with_ncp_fit (self ):
0 commit comments