Example 4: Sweep Scan loading

This is an example showcasing the loading of a kinetic energy sweep scan

The individual images are loaded, and summed onto the grid of data that overlap on all images

[1]:
%load_ext autoreload
%autoreload 2
from specsscan import SpecsScan
import matplotlib.pyplot as plt
import numpy as np
%matplotlib widget

Here, a SpecsScan class instance is created as per the configuration provided in config.yaml. Crop parameters are set by an additional config dictionary.

[2]:
config = {"spa_params": {
    'ek_range_min': 0.07597844332538357,
    'ek_range_max': 0.8965456312395133,
    'ang_range_min': 0.16732026143790849,
    'ang_range_max': 0.8449673202614381,
    "angle_offset_px":13,
    "rotation_angle": 2,
    "crop":True,
}}
sps = SpecsScan(config=config, user_config="../specsscan/config/example_config_FHI.yaml")
path = "../tests/data/" # Path to the test data set
User config loaded from: [/home/runner/work/specsanalyzer/specsanalyzer/docs/specsscan/config/example_config_FHI.yaml]
Default config loaded from: [/home/runner/work/specsanalyzer/specsanalyzer/specsscan/config/default.yaml]
Default config loaded from: [/home/runner/work/specsanalyzer/specsanalyzer/specsanalyzer/config/default.yaml]

The load_scan method performs the merging of the images and returns the scan as an xarray

[3]:
res_xarray = sps.load_scan(
    scan=6455, # Scan number for an example sweep scan
    path=path,
)
WARNING:root:Conversion of sweep scans with non-equidistant energy steps might produce wrong results!
Cropping parameters not found, using cropping ranges from config...
Gathering metadata from different locations
Collecting time stamps...
Done!
[4]:
plt.figure()
res_xarray.plot()
[4]:
<matplotlib.collections.QuadMesh at 0x7f76143e3cd0>
[ ]: