Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use public API. #1079

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions PyMca5/PyMcaMath/fitting/Gefit.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def LinearLeastSquaresFit(model0,parameters0,data0,maxiter,
weight = selfweight
iiter = maxiter
niter = 0
newpar = parameters.__copy__()
newpar = parameters.copy()
while (iiter>0):
niter+=1
chisq0, alpha0, beta,\
Expand Down Expand Up @@ -330,7 +330,7 @@ def RestreinedLeastSquaresFit(model0,parameters0,data0,maxiter,
if ONED:
data = numpy.array(data0)
x = data[1:2,0]
fittedpar = parameters.__copy__()
fittedpar = parameters.copy()
flambda = 0.001
iiter = maxiter
niter = 0
Expand Down Expand Up @@ -392,7 +392,7 @@ def RestreinedLeastSquaresFit(model0,parameters0,data0,maxiter,
flag = 0
lastdeltachi = chisq0
while flag == 0:
newpar = parameters.__copy__()
newpar = parameters.copy()
if(1):
alpha = alpha0 + flambda * numpy.identity(nr) * alpha0
deltapar = numpy.dot(beta, inv(alpha))
Expand Down Expand Up @@ -448,7 +448,7 @@ def RestreinedLeastSquaresFit(model0,parameters0,data0,maxiter,
iiter = 0
else:
flag = 1
fittedpar = newpar.__copy__()
fittedpar = newpar.copy()
lastdeltachi = (chisq0-chisq)/(chisq0+(chisq0==0))
if (lastdeltachi) < deltachi:
iiter = 0
Expand Down Expand Up @@ -518,7 +518,7 @@ def ChisqAlphaBeta(model0, parameters, x,y,weight, constrains,model_deriv=None,l
##############
# Prior to each call to the function one has to re-calculate the
# parameters
pwork = parameters.__copy__()
pwork = parameters.copy()
for i in range(n_free):
pwork [free_index[i]] = fitparam [i]
newpar = getparameters(pwork.tolist(),constrains)
Expand All @@ -527,7 +527,7 @@ def ChisqAlphaBeta(model0, parameters, x,y,weight, constrains,model_deriv=None,l
raise ValueError("No free parameters to fit")
for i in range(n_free):
if model_deriv is None:
#pwork = parameters.__copy__()
#pwork = parameters.copy()
pwork [free_index[i]] = fitparam [i] + delta [i]
newpar = getparameters(pwork.tolist(),constrains)
newpar=numpy.take(newpar,noigno)
Expand Down
6 changes: 3 additions & 3 deletions PyMca5/PyMcaPhysics/xrf/ClassMcaTheory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ def num_deriv(self, param0,index,t0):
#numerical derivative
x=numpy.array(t0)
delta = (param0[index] + numpy.equal(param0[index],0.0)) * 0.00001
newpar = param0.__copy__()
newpar = param0.copy()
newpar[index] = param0[index] + delta
f1 = self.mcatheory(newpar, x)
newpar[index] = param0[index] - delta
Expand Down Expand Up @@ -1657,7 +1657,7 @@ def linearMcaTheoryDerivative(self, param0, index, t0):
#print "index = ",index
x=numpy.array(t0)
delta = (param0[index] + numpy.equal(param0[index],0.0)) * 0.00001
newpar = param0.__copy__()
newpar = param0.copy()
newpar[index] = param0[index] + delta
f1 = self.linearMcaTheory(newpar, x)
newpar[index] = param0[index] - delta
Expand Down Expand Up @@ -1803,7 +1803,7 @@ def analyticalDerivative(self, param0, index, t0):
#print "index = ",index
x=numpy.array(t0)
delta = (param0[index] + numpy.equal(param0[index],0.0)) * 0.00001
newpar = param0.__copy__()
newpar = param0.copy()
newpar[index] = param0[index] + delta
f1 = self.mcatheory(newpar, x)
newpar[index] = param0[index] - delta
Expand Down
Loading