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 "", line 35, in <module>
      File "", line 25, in test_GSASIIspc
      File "/home/mwolf/src/pyGSAS/", line 3079, in test0
        assert (MoveToUnitCell([1,2,3])[0] == [0,0,0]).all, msg
      File "/home/mwolf/src/pyGSAS/", line 1065, in
        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.


Attachment: signature.asc
Description: OpenPGP digital signature

GSAS-II mailing list

Reply via email to