{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4: Sweep Scan loading\n", "This is an example showcasing the loading of a kinetic energy sweep scan\n", "\n", "The individual images are loaded, and summed onto the grid of data that overlap on all images" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "from specsscan import SpecsScan\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "%matplotlib widget" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Here, a SpecsScan class instance is created as per the configuration provided in [config.yaml](../tests/data/config.yaml). Crop parameters are set by an additional config dictionary." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "config = {\"spa_params\": {\n", " 'ek_range_min': 0.07597844332538357,\n", " 'ek_range_max': 0.8965456312395133,\n", " 'ang_range_min': 0.16732026143790849,\n", " 'ang_range_max': 0.8449673202614381,\n", " \"angle_offset_px\":13,\n", " \"rotation_angle\": 2,\n", " \"crop\":True,\n", "}}\n", "sps = SpecsScan(config=config, user_config=\"../src/specsscan/config/example_config_FHI.yaml\")\n", "path = \"../tests/data/\" # Path to the test data set" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "The load_scan method performs the merging of the images and returns the scan as an xarray" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "res_xarray = sps.load_scan(\n", " scan=6455, # Scan number for an example sweep scan\n", " path=path,\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure()\n", "res_xarray.plot()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "python3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.12" }, "vscode": { "interpreter": { "hash": "a164666994e9db75450cd7016dd7e51d42ea6e7c1e5e8017af1f8068ca906367" } } }, "nbformat": 4, "nbformat_minor": 2 }