Dear Ruggero
Actually using Q2Ang for consistency checks is not really feasible.
Let me explain why:
Q2Ang takes the orientation of the material from the definition of "hxrd"
(in your case FourC).
This is somehow elaborate and likely by default fits best applications of
thin film diffraction.
The two directions you specify in the constructor of FourC define the
crystal axis which is along the primary beam (when all goniometer angles
are at zero) and a second direction which for the thin film case
corresponds to the out of plane direction. In fact the meaning of
the second direction also depends on the setting of the optional
'sample_or'. So yes you can set the sample orientation. I see that somebody
would want to set this directly using an orientation matrix. Maybe you
could report an issue on github about this if you agree.
But there is a more fundamental problem why Q2Ang likely will not be useful
for you: You basically want to determine four goniometer angles from three
reciprocal space coordinates/Miller indices. So the problem is
overdetermined.
The implementation of Q2Ang in FourC (and HXRD) make some assumptions about
how to angles are calculated (in fact they turn the sample to obtain a
coplanar setting of incidence/diffracted and surface normal). There is also
NonCOP which describes the same goniometer with a different Q2Ang
implementation. For your 2D detector both will likely not help. There is an
alternative, however, look at Q2AngFit. There you can define your own
orientation matrix and other geometrical restrictions and the function by
numerical optimization determines the diffraction angles. [1]
cheers
dominik
[1]
https://xrayutilities.sourceforge.io/examples.html#calculation-of-diffraction-angles-for-a-general-geometry
ps: I realized now a major problem in the documentation (both online and in
the pdf) which do not contain the docstrings of __init__ functions. I will
fix this asap.
On Fri, Dec 11, 2020 at 11:59 AM ruggero frison <rug...@uz...>
wrote:
> Dear Dominik,
>
> thank you.
> That helped and things work thought the results are not fully consisten
> with the experiment, but it might be
> some little error that I hope I will figure out myself with a more careful
> look at.
>
> One more thing. To check the results I understand that I could use Q2Ang.
> I expect the return values of Q2Ang should match the experimental values.
> Where from the Q2Ang gets the sample orientation?
>
> In the example xrayutilities_angular2hkl_conversion.py there is:
> [om, chi, phi, tt] = hxrd.Q2Ang(mat.Q(H, K, L))
>
> Is there a way to set the sample orientation?
>
> Thank you
>
> Best regards
> Ruggero
>
>
>
> > On 11 Dec 2020, at 00:37, Dominik Kriegner <dom...@gm...>
> wrote:
> >
> > Dear Ruggero,
> >
> > I think you seemed to look more or less in the right places. I see three
> problems in the the dummy script you sent:
> >
> > 1) I am not sure which version or xrayutilities you are using but
> reasonable up to date versions the material definition would need to be
> > sam = xu.materials.material.Crystal('sample1', xu.materials.SGLattice(1,
> *abcabg))
> >
> > 2) Since you say you are describing a four circle machine you should
> likely use FourC
> > hxrd = xu.FourC(sam.Q(-2, 0, 0), sam.Q(0, 0, -4), en=energy)
> > you then will need to specify chi and phi in your call to Ang2HKL
> >
> > 3) Ang2HKL takes an optional parameter dettype [1]. This should in your
> case likely be set to 'area'
> > h,k,l = hxrd.Ang2HKL(omega, chi, phi, towtheta, U=ubmat, dettype='area')
> >
> > h,k,l should then be matrices of the shape (Nch1, Nch2) for every
> angular position you specify. If you specify arrays of angles h,k,l will be
> three dimensional arrays with according dimensions.
> >
> > I hope this helps.
> >
> > kind regards
> > Dominik
> >
> > [1]
> https://xrayutilities.sourceforge.io/xrayutilities.html?highlight=ang2hkl#xrayutilities.experiment.Experiment.Ang2HKL
> >
> > On Thu, Dec 10, 2020 at 6:38 PM ruggero frison <rug...@uz...>
> wrote:
> > >
> > > Hello,
> > >
> > > I would need some help, I am trying to index a frame of an Area
> detector into hkl coordinateds following the example provided in Appendix B
> of the reference paper and in some scripts provided in the example folder
> of the distribution.
> > >
> > > I have some frames of an area detector with a 4-circles Eulerian
> cradle.
> > >
> > > I paste below a dummy script, which
> > > I prepared a script building on the examples but it does not give
> results, I do not understand why.
> > > I guess because I do not understand the underlying action of
> xrayutilities.
> > >
> > > I understand that Ang2HKL would create the arrays of hkl vlaues using
> the experimental angles.
> > > Thus I could feed it with the scan parameters I retrieve from the scan
> files and the UB matrix determined during the sample alignment.
> > >
> > > Would that work or I am getting wrong?
> > >
> > > I paste below a dummy script to avoid useless details.
> > >
> > > Thanks
> > >
> > > Best regards
> > >
> > > Ruggero
> > >
> > >
> > > ##__set the material
> > > abcabg = [a,b,c,alpha, beta, gamma]
> > > sam = xru.materials.material.Crystal(’sample1', abcabg)
> > >
> > > ##__the UB matrix is retrieved during the experiment
> > > ubmat = np.array([[1.364,-0.131,0.270],[-0.044, 1.639, 0.083],[-0.950,
> -0.264, 0.384]])
> > >
> > >
> > > ##__load the frame and associated parameter file to get scan
> parameters,
> > > omega, twotheta, chi, phi, energy, detector_distance = ...
> > >
> > > ##__fix detector spec
> > >
> > > #__define experiment geometry
> > > hxrd = xru.HXRD(sam.Q(-2, 0, 0), sam.Q(0, 0, -4), en=energy)
> > >
> > > ##__assign orientation matrix
> > > hxrd.Ang2Q.init_area('z+','x+', cch1=cpix, cch2=cpiy, Nch1=npix,
> Nch2=npiy,
> > > pwidth1=xpix, pwidth2=ypix, distance=sam_det)
> > >
> > > ## conversion to h,k,l
> > > h,k,l = hxrd.Ang2HKL(omega, towtheta, U=ubmat)
> > >
> > >
> > >
> > > ==================================================================
> > > Ruggero Frison
> > > University of Zurich, Physik Institut
> > >
> > > Winterthurerstrasse 190
> > > CH-8057 Zurich, Switzerland
> > > Office: Y36-H-76
> > > Phone: +41 44 635 5780
> > > ==================================================================
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > xrayutilities-users mailing list
> > > xra...@li...
> > > https://lists.sourceforge.net/lists/listinfo/xrayutilities-users
>
>
|