dials / dials

Diffraction Integration for Advanced Light Sources
https://dials.github.io
BSD 3-Clause "New" or "Revised" License
75 stars 52 forks source link

Would be good to have clean methods in dials to extend a post-integration reflection table... #233

Open graeme-winter opened 8 years ago

graeme-winter commented 8 years ago

... to include direction cosines, Schwarzenbach and Flack's psi angle, ... etc. Direction cosines w.r.t. the true unit cell vectors or the elements of the crystal setting matrix U would be neat.

This is already implemented in export_sadabs.py and export_xds_ascii.py in util, but quicker and tidier C++ implementations would be highly desirable as the current methods in Python are really very slow.

Clearly there are preconditions for this namely test cases.

graeme-winter commented 8 years ago

Elsewise for last two use existing (slow) Python code; will allow testing more easily.

graeme-winter commented 8 years ago

Direction consines:

Given beam := vector from sample to source; s := vector from sample to diffraction spot; z0 is frame with centroid on;

    UB = experiment.crystal.get_A_at_scan_point(int(round(z0)))
    phi = phi_start + z0 * phi_range
    R = axis.axis_and_angle_as_r3_rotation_matrix(phi, deg=True)
    RUB = S * R * F * UB

    x = RUB * (h, k, l)
    s = (s0 + x).normalize()

    astar = (RUB * (1, 0, 0)).normalize()
    bstar = (RUB * (0, 1, 0)).normalize()
    cstar = (RUB * (0, 0, 1)).normalize()

    ix = beam.dot(astar)
    iy = beam.dot(bstar)
    iz = beam.dot(cstar)

    dx = s.dot(astar)
    dy = s.dot(bstar)
    dz = s.dot(cstar)
rjgildea commented 8 years ago

Is there a test somewhere for the python version of the above? Might be possible to do it using flex vector operations avoiding the need to write new C++ code.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. The label will be removed automatically if any activity occurs. Thank you for your contributions.