Description of the data reduction process for XRR on liquids

This notebook explains the different steps performed to extract the X-ray reflectivity in JupyLabBook v2.8 with the library XRR.py.

Conditions

The conditions for the examples treated here are:

Extraction of the intensity of the reflected beam

Each point of the XRR curve results from a time scan on the Pilatus detector. We describe here how the reflected beam is located on the 2D images, and how its raw intensity is extracted.

User-defined full scan ROI

The user defines the ROI (Region Of Interest) in which all the reflected beams of a XRR curve falls. It means that the user should check that this ROI includes the reflected beams of each scan of the XRR.

Control on one scan

We check that the ROI is right for one scan, i.e. one data angle of the XRR curve.
We use the library PilatusSum.pyto extract the 2D images from the nexus file of a scan. All the images within a same time scan are summed.

Control on all the scans

We check on every scan of the XRR that the reflected beam falls in the full scan ROI.

Finding the vertical position of the reflected beam

It may happen that the reflected beam moves vertically on the Pilatus from one scan to another, within the full scan ROI.
For proper measurement of the intensity we need to center the summation ROI on the reflected beam.
We find the reflected beam following this routine:

The user defines the height of the summation ROI, which will be summed to extract the intensity of the reflected beam. Careful, the larger the ROI, the more background you add to the signal. Also, the height has to be an odd number, to have the beam centered.

NB: it does not seem reasonable to fit the beam with a gaussian or a step function, as its width is usually of only one or two pixels on the Pilatus detector (pixel size of 172 microns).

Extract the raw intensity of the reflected beam

For each scan of the XRR we then extract the raw intensity of the reflected beam by summing over the summation ROI.
We normalize each point by the integration time and the number of points in the scan.

Control on one scan

We check that the beam is within the summation ROI.

We plot the extracted raw intensities, which looks weird because the attenuators were adjusted from one scan to another to avoid beam damage on the detector. This will be adjusted by the normalization with the incident beam.
We also plot the position of the reflected beam. If everything went well, this should be a straight line with jumps of maximum two pixels.

Background subtraction

The background is defined by taking a ROI of the same size as the summation ROI, eather immediately above and below it, or on its left and right.
The user chooses which background is taken:

Control on one scan

We check the background ROIs in linear and log scales.

Subtract background for all the scans & define errors

We extract the background for each scan and subtract it from the intensity of the reflected beam.

We also define the error for each point as the square root of the intensity. We use a worst-case scenario for the error definition: the sum of the error on the reflected beam and of the average error of the background ROIs.

We plot the background intensity, which looks weird for the same reasons as for the reflected beams. We see that the subtraction is important for large values of theta.

Normalization by the incident beam intensity

We describe now how the incident beam intensity is used to normalize the intensity of the reflected beam.

For each scan of the XRR, the voltage of the ionization chamber is measured for each of its 6 gains. The values are stored in the companion file _XRR_gains.dat.
An increase of 1 in the gain corresponds to a factor 10 in the measured voltage, with a saturation at 10 V.
We assume that the voltage is proportional to the intensity of the incident beam, provided that the gain is high enough. Thus, the voltage is used to normalize the intensity of the reflected and direct beams.

The following step consists in finding for each point the maximum gain for which the voltage returned by the ionization chamber is not saturated.

Extraction of the voltage value

Details and control for a single scan

We detail the code for one point of the XRR here.

Extract V for all the scans

The procedure is the same as for the example.

We plot V, which is non-monotonic because the attenuators are changed in the course of the XRR curve.

Normalize the reflected beam by the voltage of the ionization chamber

The intensity of the reflected beam is simply divided by the corresponding voltage of the ionization chamber V, and so are the errors and the background.

We also extract the value of theta, the incident angle on the water surface, for each data point:
$$\theta = 2 |m4_{pitch}−m4_{pitch0}|$$
$m4_{pitch}$ is the angle of the deflection mirror, and $m4_{pitch0}$ the value for which it is parallel to the beam.
$m4_{pitch0}$ is provided by the user in JupyLabBook.

We plot the normalized intensity as a function of theta, now this looks like a XRR curve. The last missing thing is the normalization by the direct beam.

Normalization by the direct beam

Every steps made above should be performed as well on the direct beam.

Control the direct

We check that the direct is in the Pilatus.

Finding the position of the direct beam

The direct beam is easily found by taking the position of maximum on the whole detector.

Extract the raw intensity of the direct beam

We sum over the summation ROI and normalize by the integration time and the number of points in the scan.

Background subtraction

The background is defined the same way as for the reflected beam.

Normalization by the incident beam

V is defined the same way as for the reflected beam, except that there is no m4pitch value recorded in the companion file _direct_gains.dat.

Normalization by the direct beam : XRR curve

Finally, we normalize the intensity of the reflected beam with the direct beam and obtain the XRR curve.

We plot the results for $q_z= 4\pi/\lambda\sin(\theta)$ as well, where $\lambda$ is the wavelength provided by the user in JupyLabBook, and for $Iq_z^4$ to normalize by the Fresnel reflectivity.

Summary of the useful variables

Summary of the parameters