I am trying to update GSAS-II but the program cannot connect with the server. 
Is there any problem in the server or it is my problem? 

-----Original Message-----
From: gsas-ii-boun...@aps.anl.gov [mailto:gsas-ii-boun...@aps.anl.gov] On 
Behalf Of Mark Wolf
Sent: Sunday, September 20, 2015 8:14 PM
To: gsas-ii@mailman.aps.anl.gov
Subject: [GSAS-II] unit test for GSASIIspc.MoveToUnitCell() function

Your website encourages user contributions so hopefully I'm sending this to the 
right place. I was poking at your unit tests the other day and one of them 
failed, namely those for the GSASIIspc.MoveToUnitCell function when passing a 
regular python list instead of a numpy array:

    Traceback (most recent call last):
      File "unit_tests.py", line 35, in <module>
      File "unit_tests.py", line 25, in test_GSASIIspc
      File "/home/mwolf/src/pyGSAS/GSASIIspc.py", line 3079, in test0
        assert (MoveToUnitCell([1,2,3])[0] == [0,0,0]).all, msg
      File "/home/mwolf/src/pyGSAS/GSASIIspc.py", line 1065, in MoveToUnitCell
        XYZ = (xyz+10.)%1.
    TypeError: can only concatenate list (not "float") to list

I fixed it with some exception handling using list comprehension as a fallback 
if numpy arithmetic fails. Diff can be found at

In case this is speed-sensitive, here are the profiling results using IPython's 
%timeit magic:

- Original (numpy array): 2.81 us per loop
- New (numpy array): 2.98 us per loop
- New (native list): 2.46 us per loop

If the extra 15us is too much, then maybe you want to consider removing the 
unit test that uses a native list (line 3079).

If you want to use my patch, I license it (and any future contributions) for 
use under the license included with the pyGSAS (GSAS-II) source code.


GSAS-II mailing list

Reply via email to