Project

General

Profile

Bug #1253

bug with python<2.7

Added by kieffer, jerome over 7 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Start date:
20/03/2012
Due date:
% Done:

100%


Description

This bug is related to python2.6; moving to python 2.7 seams to solve it.
Could be:
http://bugs.python.org/issue1515

Jerome Roy, could you see if this copy.deepcopy could be avoided ?
Thanks

examples % ./examples_xsw.py
Using PyMca library for EdfFile
Using local library for mpfit
Using PyMca library for Gefit
Using local library for lmfit
Using local library for CIF
Using PyMca library for specfile
Basic test for calculating/plotting simulations on Silicon

Reading CIF file /usr/lib/pymodules/python2.6/pyXSW/cif/Si-77K.cif
Loading crystal Si-77K
Defining mono parameters Si-77K
Energy was already existing, replaced
Calculating parameters for energy 6000.000 eV
Adding reflection (1, 1, 1)
Finished defining the mono parameters

Reading CIF file /usr/lib/pymodules/python2.6/pyXSW/cif/Si.cif
Loading crystal 9011998
Defining sample parameters: Si
Energy was already existing, replaced
Calculating parameters for energy 6000.000 eV
Adding reflection (2, 2, 0)
Finished defining the sample parameters

Applying the mono convolution
/usr/lib/pymodules/python2.6/numpy/core/numeric.py:677: DeprecationWarning:
The current behavior of correlate is deprecated for 1.4.0, and will be removed
for NumPy 1.5.0.

The new behavior fits the conventional definition of correlation: inputs are
never swapped, and the second argument is conjugated for complex arrays.
DeprecationWarning)
Adding yield (2, 2, 0) Si
Calling set_extinct_factor for extinction correction

Traceback (most recent call last):
File "./examples_xsw.py", line 304, in <module>
sample, ref, xfs = test_Si()
File "./examples_xsw.py", line 33, in test_Si
xfs = refl.add_yield('Si', extinct=True, alpha=0.1, fluolines=('K', 'L2'))
File "/usr/lib/pymodules/python2.6/pyXSW/simul.py", line 545, in add_yield
eyield = Yield(self, label, extinct, *kwargs)
File "/usr/lib/pymodules/python2.6/pyXSW/simul.py", line 824, in init
self.set_extinct_factor(
*kwargs)
File "/usr/lib/pymodules/python2.6/pyXSW/simul.py", line 849, in set_extinct_factor
self.energy_fluo)
File "/usr/lib/pymodules/python2.6/pyXSW/simul.py", line 875, in calc_extinct_factor
crystalfluo = copy.deepcopy(self.crystal)
File "/usr/lib/python2.6/copy.py", line 189, in deepcopy
y = reconstruct(x, rv, 1, memo)
File "/usr/lib/python2.6/copy.py", line 338, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 189, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/usr/lib/python2.6/copy.py", line 338, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 189, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/usr/lib/python2.6/copy.py", line 338, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 189, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/usr/lib/python2.6/copy.py", line 323, in _reconstruct
y = callable(*args)
File "/usr/lib/python2.6/copy_reg.py", line 93, in newobj
return cls.
_new__(cls, *args)
TypeError: instancemethod expected at least 2 arguments, got 0

History

#1 Updated by Roy, Jerome over 7 years ago

  • Status changed from New to Assigned

Replaced call to deepcopy by full calculation of the new CrystalCIF instance

#2 Updated by kieffer, jerome over 7 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

Thanks, it works now ...
We will have to define tests together but with what is in example it should be straight forward.

Also available in: Atom PDF