Tutorial 7: Angular scans

As a package dedicated to GID data, pygid supports measurements with a varying angle of incidence (ai).

The angle of incidence ai can be provided in several ways:

  • Single value

    ai = 0.01
    
  • List of values

    ai = [0.0, 0.01, 0.02]
    
  • Automatically parsed from a scan command (start, stop, number-1).

scan = "ascan om 0.0400 0.1000 12"

or

scan = "0.0400 0.1000 12"

NOTE: For angular scans, the number of angles (ai) in ExpParams should match the number of loaded images.

from pygid.datasets import get_dataset

# Download example dataset from Zenodo
try:
    files = get_dataset("tutorial_07")
    poni_path = files["poni"]
    mask_path = files["mask"]
    # several files for batch processing
    data_path = files["data"]
except:
    print("Dataset download skipped on Read the Docs.")
Dataset download skipped on Read the Docs.

Single image for a single angle of incidence

import pygid

params = pygid.ExpParams(
    poni_path=poni_path,
    mask_path=mask_path,
    ai=0.004,                       # angle of incidence (degrees)
    fliplr=True,
    flipud=True
)

matrix = pygid.CoordMaps(
    params,  # pygid.ExpParams
    vert_positive=True,
    hor_positive=True,
)

analysis = pygid.Conversion(
    matrix=matrix,
    path=data_path,
    dataset='/entry_0000/ESRF-ID10/eiger4m/data',
    frame_num = 0,                  # corresponding image
)
print(f"ai: {params.ai}, number of images: {len(analysis.img_raw)}")
ai: 0.004, number of images: 1

List of images, list of angles

import pygid

params = pygid.ExpParams(
    poni_path=poni_path,
    mask_path=mask_path,
    ai=[0.065, 0.07, 0.075],       # angles of incidence (degrees)
    fliplr=True,
    flipud=True
)

matrix = pygid.CoordMaps(
    params,  # pygid.ExpParams
    vert_positive=True,
    hor_positive=True,
)

analysis = pygid.Conversion(
    matrix=matrix,
    path=data_path,
    dataset='/entry_0000/ESRF-ID10/eiger4m/data',
    frame_num = [6,7,8],           # corresponding images
)

print(f"ai: {params.ai}, number of images: {len(analysis.img_raw)}")
ai: [0.065, 0.07, 0.075], number of images: 3

List of images, scan command

params = pygid.ExpParams(
    poni_path=poni_path,          # path to the PONI file
    mask_path=mask_path,
    scan = "ascan om 0.0400 0.1000 12",                       # angle of incidence (degrees)
    fliplr=True,
    flipud=True
)

matrix = pygid.CoordMaps(
    params,  # pygid.ExpParams
    vert_positive=True,
    hor_positive=True,
)

analysis = pygid.Conversion(
    matrix=matrix,
    path=data_path,
    dataset='/entry_0000/ESRF-ID10/eiger4m/data',
    frame_num = None,           # all images
)


print(f"ai: {params.ai}, number of images: {len(analysis.img_raw)}")
INFO - ai list calculated: [0.04, 0.045, 0.05, 0.055, 0.06, 0.065, 0.07, 0.075, 0.08, 0.085, 0.09, 0.095, 0.1]
ai: [0.04, 0.045, 0.05, 0.055, 0.06, 0.065, 0.07, 0.075, 0.08, 0.085, 0.09, 0.095, 0.1], number of images: 13