Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UB matrix in NXsample #559

Closed
prjemian opened this issue Apr 10, 2017 · 10 comments
Closed

UB matrix in NXsample #559

prjemian opened this issue Apr 10, 2017 · 10 comments
Assignees

Comments

@prjemian
Copy link
Contributor

prjemian commented Apr 10, 2017

Documentation of the UB matrix in NXsample needs improvement. The email discussion today brings out several good points.

Quoting @vasole from his email:

  • trying to map the orientation matrix (UB in the SPEC jargon) to the appropriate place in NXsample

My understanding is that it should be under orientation_matrix however I
face some difficulties:

  • The format is [n_comp, 3, 3]. I would be expecting a 3x3 matrix. So, I
    guess if there is only one composition or type of crystal, the format
    has to be [1,3,3]

  • Do you call orientation_matrix to the UB product in Busing and Levy or
    just the matrix U? Very often one just has the product UB and it would
    be cumbersome to have different meanings as function of having the
    (optional) cell parameters or not in order to build the B matrix. If you
    actually mean the U matrix, I would strongly advice to add the
    ub[n_comp, 3, 3] representing UB as a sample dataset field.

As a side question, what is the NXsample/sample_orientation that has
three floats? The only thing I find in Busing and Levy corresponding to
three floats is hkl. If it is that, hkl would have been more explicit.
If it is not that, what is it?

@prjemian
Copy link
Contributor Author

Continue that thread for more discussion. @rayosborn follows up with:

> On Apr 10, 2017, at 2:19 PM, V. Armando Sole <sole at esrf.fr> wrote:
> 
> Hi Ray,
> 
> On 10.04.2017 19:40, Osborn, Raymond wrote:
>> I suppose we could add a UB
>> matrix to the list of stored parameters in a NeXus file even though it
>> is technically redundant.
> 
> We face the problem that people stores the UB matrix and the diffractometer positions together with the images but we do not have any of the other unit cell parameters.
> 
> I guess the best thing I can do then is to use a not-yet-official-and-perhpas-never-official ub term inside NXsample with dimensions [n_comp, 3, 3].
> 
> Concerning the other question concerning sample orientation specified by 3 floats. Is that intended to be hkl?
> 
> Best,
> 
> Armando

Your example provides a good rationale for having a separate UB matrix field, so I would support it. If I’m able to join the next telco, I will raise it then if others don’t.

I have never used the sample_orientation parameter, but the units are specified as NX_ANGLE, so they must refer to omega, chi, and phi, which Busing and Levy discuss in the section on “Coordinate Transformations.” They are used in the sequence of matrix multiplications that transform (hkl) into goniometer lab coordinates (Eq. 19 in Busing and Levy). The documentation is inadequate because it doesn’t state what order they are specified, but it’s either (omega, chi, phi) or the reverse. The other inadequacy is that there could be multiple (omega, chi, phi) angles if the sample is being scanned. 

Thanks for raising the issue because it is something we should sort out. There are a few questionable decisions taken when we were first formalizing the standard, such as the unit_cell field, which contains a mix of lattice parameters and angles, and therefore have mixed units. They are gradually being fixed. This might just need better documentation. I hope others contribute to this discussion if I have misunderstood the definitions. I am not a crystallographer.

@vasole
Copy link
Contributor

vasole commented Apr 11, 2017

Hi!

Mixing distances and angles I guess it is something traditional. At least SPEC provides them that way so a lot of people are used to it. For the time being I am going to ask my colleagues to use a "new" sample field named ub with dimensions [n_comp, 3, 3] containing 9 floats. I hope it will be approved.

If the three floats correspond to the angles, the choice is really unfortunate. The actual angle names should have been used because, in addition, they are scanned during measurements and there is more than just four-circle diffractometers.

On the longer term, a better solution is needed. I am not a crystallographer either but I have been dealing with diffractometer geometries and conversion from lab to reciprocal space coordinates based on the diffractometer angles. For that one needs, among others, the UB matrix, the type of diffractometer and geometry. Some classical articles are Busing & Levy 1967, Lohmaier and Vlieg (1992 or 1993 not sure), Ewans-Lutterodt and Tang (1995) and You (1999). I basically support four-circle and six-circle with the same code base. Given that those articles clearly define the different geometries and provide names to the associated angles, an NXdiffractometer class containing the UB matrix, the diffractometertype, mode and angles would be convenient since it would pave the way for conversion to reciprocal space coordinates. One would still some other things like wavelength, detector pixel sizes, distance and coordinates of the hypothetical the point of incidence on the detector if all the diffractometer angles would be at zero. Surface diffraction people, among others, need that type of description.

So, NXdiffractomer inside NXinstrument and eventually linked to from NXsample would be a nice arrangement, but I am going too far. As I said, for the time being I will just put the UB matrix inside NXsample under the name ub.

@zjttoefs
Copy link
Contributor

zjttoefs commented Apr 11, 2017 via email

@zjttoefs
Copy link
Contributor

zjttoefs commented Apr 11, 2017 via email

@vasole
Copy link
Contributor

vasole commented Apr 11, 2017

@zjttoefs

I am not going to be picky and I would take whatever is decided. Everybody talks about UB matrix, but among the different formats used at the ESRF nobody has written ub_matrix in the files, just ub. Some people here seem to forget that scientist also look at the data interactively. Following your reasoning, one would have to write miller_indices or hkl_miller_indices instead of just hkl. As I said, I will take whatever is decided but I need an answer before May 10 when we would like to release our software.

@vasole
Copy link
Contributor

vasole commented Apr 11, 2017

@zjttoefs

I may be mistaken, but upper or lower triangular probably refers to the B matrix. If you follow Busing and Levy, B is upper triangular. In any case, what you usually determine is the product UB.

@rayosborn
Copy link
Contributor

Since we have historically added the orientation_matrix to the NXsample class, it makes sense to add ub_matrix (or ub or UB_matrix) there as well, hopefully in time for your May 10 deadline. However, I think there is a strong argument for creating an NXgoniometer class (I would prefer that name to NXdiffractometer), one of whose fields would be to specify which publication is used to define the angles, and whether it is a four-circle or six-circle, etc. It would be useful for our own diffuse scattering software.

@vasole
Copy link
Contributor

vasole commented Apr 12, 2017

@rayosborn

I agree. At this point I have no other official place where to write the information but in the (not-so) long run a class for dealing with the diffractometers is needed. If a working group is setup, I should be able to provide help/feedback for its definition.

@zjttoefs
Copy link
Contributor

In http://www.nexusformat.org/Telco_20170426.html we decided adding ub_matrix is the right thing to do. Mark will do so tomorrow.

@mkoennecke
Copy link
Contributor

The ub_matrix has now been added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants