ILLGrenoble / takin

Takin, an inelastic neutron scattering software suite.
http://www.ill.eu/takin
Other
4 stars 3 forks source link

How can we export the 4-D resolution array? #24

Open panziyi1 opened 3 weeks ago

panziyi1 commented 3 weeks ago

It would be a great help if we can export the resolution array for further analysis.

tweber-ill commented 3 weeks ago

Hello,

thanks for the question, could you please add a few details?

panziyi1 commented 3 weeks ago

Thank you for your quick reply.

I am wondering if I can use this great program to export the numerial representation (array) of the resolution function in a specific spectrometer configuration. I was able to plot a resolution ellipsoid but couldn't find a way to export the 4D coordinates (Q, w) and the corresponding values R(Q, w).

It seems that we both are talking about the 1st point in your reply. If you would kindly provide some examples or tracks, it would be quite helpful. Thanks !

tweber-ill commented 2 weeks ago

Hello,

here's now an example of how to calculate the resolution matrices and their principal axes in a loop for a range of (Q, E) points: https://github.com/ILLGrenoble/takin/blob/master/core/tools/res_py/run_QE.sh

The results are written into the subdirectory “./results” where the file names and their structure (INI-like files) are easily parsable by other scripts.

You can put your instrument parameters in the “params” dictionary on top of the file https://github.com/ILLGrenoble/takin/blob/master/core/tools/res_py/calc.py

Or, for a more permanent way, please have a look on how I included the IN20 parameters and do the same for your instrument (please think about a pull request in that case, as this might be of general use): https://github.com/ILLGrenoble/takin/blob/master/core/tools/res_py/params_in20.py

In case you need to convert from or to rlu coordinates, here’s another Python tool for that (it has a command-line and a Qt interface, but you can also directly use its routines as a library): https://github.com/ILLGrenoble/takin/blob/master/mag-core/tools_py/tascalc/tas.py (When there's time, I'll do an example on that, too.)

Hope that helps…