FABLE-3DXRD / ImageD11

ImageD11 is a python code for identifying individual grains in spotty area detector X-ray diffraction images.
https://imaged11.readthedocs.io/
GNU General Public License v2.0
15 stars 24 forks source link

Error when running code from match.py #87

Closed jadball closed 4 years ago

jadball commented 4 years ago

Hello,

Has some behaviour changed in xfab for the ubi_to_u_b function in tools?

When I call xfab.tools.ubi_to_u_b in the same way that you do in match.py:

https://github.com/FABLE-3DXRD/ImageD11/blob/3b2df5ffc6ac8e67482625fba47cb144c5947934/sandbox/match.py#L50-L54

I receive the following error message:

Traceback (most recent call last):
  File "translation_finder.py", line 247, in <module>
    g1_matched, g2_matched, ndt = find_matches(g1l, g2l, h, tolangle, toldist, init_pose)
  File "translation_finder.py", line 141, in find_matches
    g.u = xfab.tools.ubi_to_u_b(g.ubi)[0]
AttributeError: can't set attribute

Unless I've finally lost it, this behaviour seems to have changed over Christmas? My script was working before.

Any ideas?

Thanks

jonwright commented 4 years ago

It is a "bug/feature" in ImageD11.grain. I made a bunch of stuff into "properties" and that does not allow you to set them freely (e.g. grain.u is read only). The reason is to avoid having inconsistent stuff inside the grain, if you have ub, ubi, u and b then they should all agree, or someone needs to write a set_u function and attach it. Grains have the u matrix grain.u via xfab.tools built in already now. I guess we need a patch on sandbox/match.py and some way to send a more informative error message when attempting the set attribute...

jadball commented 4 years ago

Thanks for the quick reply. Is there an easy way to calculate the ubi from the individual U11, U12, U13 etc values from a gff columnfile?

jadball commented 4 years ago

Don't worry, sorted it! I grabbed the code from xfab/scripts/gff_to_ubi.py