SIXS/SOLEIL-Q-cut calculation from Binocular hdf5 file.

This program opens the Binocular hdf5 file and reshapes it to the qr /qz space with a missing wedge, and calculates Q-cut.
0 Downloads
Updated 9 Jun 2023

View License

I performed ex-situ GIWAXS measurements at SOLEIL synchrotron at SIXS beamline. The GIWAXS measurements were done with a multi-environment diffractometer. The sample was placed on the heavy-load hexapod, and the small 2D X-ray detector was attached to the arm of diffractometer. The arm of the diffractometer with 2D X-ray detector moved, and the reciprocal space was scanned. The Python program Binocular was used to stich images together and the result data were saved as Binocular hdf5 file. The Binocular software in Python was originally developed at ESRF, however, the staff at SOLEIL synchrotron at SIXS beamline modified Binocular software for their needs.
The example image attached to this project is named as <map_q_370-373.hdf5>. It is hdf5 file. The result of reshaping <map_q_370-373.hdf5> into the GIWAXS map encoded in the qr / qz space is shown in the jpg image with name <map_q_370-373.jpg>, which is also attached to this project. The m-scripts for calculation GIWAXS map and Q-cut are named as <Soleil_hdf5_file_reader_06_Qcut.m> and <Soleil_hdf5_file_reader_07_Qcut_enlarged.m>.
The first input for calculation is path to hdf5 file, so, you need to fill path_to_hdf5_file variable with string or path. Then, you specify path to folder to save data, so, you need to fill path_to_save_folder variable with string or path. Finally, you specify sample name, so, you need to fill sample_name variable with string value. On the line 12 of m-script, the info about hdf5 file is read using command h5disp(path_to_hdf5_file);. The Binoculars hdf5 file has 3 axes: q_x, q_y and q_z. On the lines 15, 17, 19, the information about q_x, q_y, q_z axes is read using h5read function. The Binoculars hdf5 file has two data-sets: counts and contributions, which are read on 74 and 76 lines using h5read function. The counts data-set is 3D data-set. The contributions data-set is 3D data-set. Each data-point in data-set counts contains signal value, q_x coordinate, q_y coordinate, q_z coordinate. Each data-point in data-set contributions contains contribution value, q_x coordinate, q_y coordinate, q_z coordinate. The all data points for counts data-set are stored in the variable <data_all_points_counts>. The all data points for contributions data-set are stored in the variable <data_all_points_contributions>. We need to reshape Binocular reciprocal space data from q_x, q_y, q_z to q_r, q_z space. Since, q_r=sqrt(q_x^2 + q_y^2), the all data points for counts data-set are stored in the variable <data_qrqz_all_points_counts>. Since, q_r=sqrt(q_x^2 + q_y^2), the all data points for contributions data-set are stored in the variable <data_qrqz_all_points_contributions>. Finally, we need to reshape <data_qrqz_all_points_counts> and <data_qrqz_all_points_contributions> into the q_r / q_z space. The reshape matrix for counts data-set is initialzed in the line 171 in the variable <reshape_qrqz_matrix_counts>. The reshape matrix for contributions data-set is initialzed in the line 173 in the variable <reshape_qrqz_matrix_contributions>. The final matrix for reshaped GIWAXS image is initialized in the line 175 in the variable <reshape_qrqz_matrix>. The final GIWAXS reshaped image is calculated as element-by-element division <reshape_qrqz_matrix=reshape_qrqz_matrix_counts(:,:)./reshape_qrqz_matrix_contributions(:,:);>.
The input parameters for reshaping: The image is reshaped in the qr direction (lateral or horizontal coordinate) from qr_min value to qr_max value on the total number of qr points specified in the <number_qr_points> variable.The image is reshaped in the qz direction (vertical coordinate) from qz_min value to qz_max value on the total number of qz points specified in the <number_qz_points> variable. The matrix <reshape_qrqz_matrix> or final result of reshaping is plotted as colormap with intensity scale from intensity_min value to intensity_max value.
The input parameters for reshaping: The image is reshaped in the qr direction (lateral or horizontal coordinate) from qr_min value to qr_max value on the total number of qr points specified in the <number_qr_points> variable.The image is reshaped in the qz direction (vertical coordinate) from qz_min value to qz_max value on the total number of qz points specified in the <number_qz_points> variable. The matrix <reshape_qrqz_matrix> or final result of reshaping is plotted as colormap with intensity scale from intensity_min value to intensity_max value.
The Q-cut is integrated from chi_min value to chi_max_value. The chi is an angle defined between q vector and q_z direction or chi is an angle defined between q vector and normal to the sample surface. The Q-cut is calculated for q values from q_min value to q_max value on the number of q points specified in the <no_q_points> variable. The program is capable to visualize the Q-cut for each iteration from 1 to <no_q_points>. If you want to see or visualize Q-cut for each q value, then sets <visualization_switch=1;>. If you do not want to see or visualize Q-cut for each q value, then sets <visualization_switch=0;>. The visualization swich is introduced in the line 260. The final Q-cut is plotted in the line 357. This description is valid for the m-script <Soleil_hdf5_file_reader_06_Qcut.m>. If your q_max value exceeds the dimensions of the GIWAXS map, you should use the m-script <Soleil_hdf5_file_reader_07_Qcut_enlarged.m>. The logic of the m-scripts <Soleil_hdf5_file_reader_06_Qcut.m> and <Soleil_hdf5_file_reader_07_Qcut_enlarged.m> is the same.
Enjoy your time in reciprocal space, and have fun with GIWAXS technique at SIXS beamline at SOLEIL synchrotron.

Cite As

Karol Vegso (2024). SIXS/SOLEIL-Q-cut calculation from Binocular hdf5 file. (https://www.mathworks.com/matlabcentral/fileexchange/130799-sixs-soleil-q-cut-calculation-from-binocular-hdf5-file), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with R2021a to R2023a
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0