Skip to content

Commit

Permalink
Merge pull request #1079 from vasole/copy
Browse files Browse the repository at this point in the history
Use public API.
  • Loading branch information
vasole authored Jun 6, 2024
2 parents e9699a1 + 930da03 commit 532dd62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit 532dd62

Please sign in to comment.