Skip to content

Commit ec933d3

Browse files
Merge pull request #1170 from silx-kit/numpy_reshape_remain
Fix remain `arr.shape=` and remove "silent flattening"
2 parents 4fbf74a + 8193397 commit ec933d3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/PyMca5/PyMcaGui/physics/xrf/McaAdvancedFit.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,8 @@ def matrixSpectrum(self):
10721072
ddict['result']['ymatrix'] = ymatrix + self.mcafit.zz
10731073
else:
10741074
ddict['result']['ymatrix'] = ymatrix
1075-
ddict['result']['ymatrix'].shape = (len(ddict['result']['ymatrix']),)
1076-
ddict['result']['continuum'].shape = (len(ddict['result']['ymatrix']),)
1075+
ddict['result']['ymatrix'] = ddict['result']['ymatrix'].reshape(len(ddict['result']['ymatrix']))
1076+
ddict['result']['continuum'] = ddict['result']['continuum'].reshape(len(ddict['result']['ymatrix']))
10771077
if self.matrixSpectrumButton.isChecked():
10781078
self.dict['result']['ymatrix']= ddict['result']['ymatrix'] * 1.0
10791079
"""
@@ -1375,7 +1375,7 @@ def peaksSpectrum(self):
13751375
ddict['result'][label] = ymatrix + self.mcafit.zz
13761376
else:
13771377
ddict['result'][label] = ymatrix
1378-
ddict['result'][label] = numpy.ravel(ddict['result'][label])
1378+
ddict['result'][label] = ddict['result'][label].reshape(len(ddict['result'][label]))
13791379
if self.peaksSpectrumButton.isChecked():
13801380
self.dict['result'][label]= ddict['result'][label] * 1.0
13811381
try:
@@ -1954,8 +1954,8 @@ def plot(self, ddict=None):
19541954
ydata = self.mcafit.ydata + self.mcafit.zz
19551955
else:
19561956
ydata = self.mcafit.ydata * 1.0
1957-
xdata = numpy.ravel(xdata)
1958-
ydata = numpy.ravel(ydata)
1957+
xdata = xdata.reshape(len(xdata))
1958+
ydata = ydata.reshape(len(ydata))
19591959
self.graph.addCurve(xdata, ydata, legend="Data", replot=True, replace=True)
19601960
self.graph.updateLegends()
19611961
return

src/PyMca5/PyMcaMath/mva/Lanczos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ def ricipolla(self, k,m):
620620

621621
def diago(self, k, m):
622622
mat = numpy.zeros([m,m], numpy.float64)
623-
mat = numpy.ravel(mat)
623+
mat = mat.reshape(m * m)
624624
mat[0:m*m:m+1] = self.alpha
625625
mat[k*m+k+1:m*m:m+1] =self.beta[k:m-1]
626626
mat[(k+1)*m+k:m*m:m+1] =self.beta[k:m-1]

0 commit comments

Comments
 (0)