|
|
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# How to index, slice, modify, and delete data points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Very usually, we need to select, modify and even delete the data of certain shots. Here there is a short introduction on how to do that.\n", "\n", "Let us start with importing the supporting packages and loading the data. In order to keep things ealier, here we will import all the packages, but not all of them will be us" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load some example data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Import supporting packages" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Set the system path for importing packages\n", "# This is just because I put all example scripts in another folder\n", "# You DO NOT need to do this \n", "# -------------- You do NOT need following part --------------\n", "import sys\n", "import os\n", "sys.path.insert(0, os.path.abspath('..'))\n", "# -------------- You do NOT need above part --------------\n", "\n", "import copy\n", "import glob\n", "from datetime import datetime\n", "\n", "# The package for data structure\n", "import xarray as xr\n", "import pandas as pd\n", "import numpy as np\n", "\n", "# The packages for working with uncertainties\n", "from uncertainties import ufloat\n", "from uncertainties import unumpy as unp\n", "from uncertainties import umath\n", "\n", "# The package for plotting\n", "import matplotlib.pyplot as plt\n", "plt.rcParams['font.size'] = 18 # Set the global font size\n", "\n", "# -------------- The modules written by us --------------\n", "\n", "# The packages for read data\n", "from DataContainer.ReadData import read_hdf5_file, read_hdf5_global, read_hdf5_run_time, read_csv_file\n", "\n", "# The packages for data analysis\n", "from Analyser.ImagingAnalyser import ImageAnalyser\n", "from Analyser.FitAnalyser import FitAnalyser\n", "from Analyser.FitAnalyser import ThomasFermi2dModel, DensityProfileBEC2dModel, Polylog22dModel\n", "from Analyser.FFTAnalyser import fft, ifft, fft_nutou\n", "from ToolFunction.ToolFunction import *\n", "\n", "# Add errorbar plot to xarray package\n", "from ToolFunction.HomeMadeXarrayFunction import errorbar, dataarray_plot_errorbar\n", "xr.plot.dataarray_plot.errorbar = errorbar\n", "xr.plot.accessor.DataArrayPlotAccessor.errorbar = dataarray_plot_errorbar" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Start a client for parallel computing" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", " <div style=\"width: 24px; height: 24px; background-color: #e1e1e1; border: 3px solid #9D9D9D; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"margin-left: 48px;\">\n", " <h3 style=\"margin-bottom: 0px;\">Client</h3>\n", " <p style=\"color: #9D9D9D; margin-bottom: 0px;\">Client-b0e6c9ce-2097-11ee-9d7c-80e82ce2fa8e</p>\n", " <table style=\"width: 100%; text-align: left;\">\n", "\n", " <tr>\n", " \n", " <td style=\"text-align: left;\"><strong>Connection method:</strong> Cluster object</td>\n", " <td style=\"text-align: left;\"><strong>Cluster type:</strong> distributed.LocalCluster</td>\n", " \n", " </tr>\n", "\n", " \n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:8787/status\" target=\"_blank\">http://127.0.0.1:8787/status</a>\n", " </td>\n", " <td style=\"text-align: left;\"></td>\n", " </tr>\n", " \n", "\n", " </table>\n", "\n", " \n", "\n", " \n", " <details>\n", " <summary style=\"margin-bottom: 20px;\"><h3 style=\"display: inline;\">Cluster Info</h3></summary>\n", " <div class=\"jp-RenderedHTMLCommon jp-RenderedHTML jp-mod-trusted jp-OutputArea-output\">\n", " <div style=\"width: 24px; height: 24px; background-color: #e1e1e1; border: 3px solid #9D9D9D; border-radius: 5px; position: absolute;\">\n", " </div>\n", " <div style=\"margin-left: 48px;\">\n", " <h3 style=\"margin-bottom: 0px; margin-top: 0px;\">LocalCluster</h3>\n", " <p style=\"color: #9D9D9D; margin-bottom: 0px;\">2c85baf6</p>\n", " <table style=\"width: 100%; text-align: left;\">\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Dashboard:</strong> <a href=\"http://127.0.0.1:8787/status\" target=\"_blank\">http://127.0.0.1:8787/status</a>\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Workers:</strong> 6\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Total threads:</strong> 60\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Total memory:</strong> 55.88 GiB\n", " </td>\n", " </tr>\n", " \n", " <tr>\n", " <td style=\"text-align: left;\"><strong>Status:</strong> running</td>\n", " <td style=\"text-align: left;\"><strong>Using processes:</strong> True</td>\n", "</tr>\n", "\n", " \n", " </table>\n", "\n", " <details>\n", " <summary style=\"margin-bottom: 20px;\">\n", " <h3 style=\"display: inline;\">Scheduler Info</h3>\n", " </summary>\n", "\n", " <div style=\"\">\n", " <div>\n", " <div style=\"width: 24px; height: 24px; background-color: #FFF7E5; border: 3px solid #FF6132; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"margin-left: 48px;\">\n", " <h3 style=\"margin-bottom: 0px;\">Scheduler</h3>\n", " <p style=\"color: #9D9D9D; margin-bottom: 0px;\">Scheduler-3edf5152-70c9-41bc-b2e3-dd1cacfc5ef2</p>\n", " <table style=\"width: 100%; text-align: left;\">\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Comm:</strong> tcp://127.0.0.1:62125\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Workers:</strong> 6\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Dashboard:</strong> <a href=\"http://127.0.0.1:8787/status\" target=\"_blank\">http://127.0.0.1:8787/status</a>\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Total threads:</strong> 60\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Started:</strong> Just now\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Total memory:</strong> 55.88 GiB\n", " </td>\n", " </tr>\n", " </table>\n", " </div>\n", " </div>\n", "\n", " <details style=\"margin-left: 48px;\">\n", " <summary style=\"margin-bottom: 20px;\">\n", " <h3 style=\"display: inline;\">Workers</h3>\n", " </summary>\n", "\n", " \n", " <div style=\"margin-bottom: 20px;\">\n", " <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"margin-left: 48px;\">\n", " <details>\n", " <summary>\n", " <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 0</h4>\n", " </summary>\n", " <table style=\"width: 100%; text-align: left;\">\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Comm: </strong> tcp://127.0.0.1:62161\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Total threads: </strong> 10\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:62163/status\" target=\"_blank\">http://127.0.0.1:62163/status</a>\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Memory: </strong> 9.31 GiB\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Nanny: </strong> tcp://127.0.0.1:62128\n", " </td>\n", " <td style=\"text-align: left;\"></td>\n", " </tr>\n", " <tr>\n", " <td colspan=\"2\" style=\"text-align: left;\">\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-doscq09y\n", " </td>\n", " </tr>\n", "\n", " \n", "\n", " \n", "\n", " </table>\n", " </details>\n", " </div>\n", " </div>\n", " \n", " <div style=\"margin-bottom: 20px;\">\n", " <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"margin-left: 48px;\">\n", " <details>\n", " <summary>\n", " <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 1</h4>\n", " </summary>\n", " <table style=\"width: 100%; text-align: left;\">\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Comm: </strong> tcp://127.0.0.1:62167\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Total threads: </strong> 10\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:62168/status\" target=\"_blank\">http://127.0.0.1:62168/status</a>\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Memory: </strong> 9.31 GiB\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Nanny: </strong> tcp://127.0.0.1:62129\n", " </td>\n", " <td style=\"text-align: left;\"></td>\n", " </tr>\n", " <tr>\n", " <td colspan=\"2\" style=\"text-align: left;\">\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-7b8nhgmg\n", " </td>\n", " </tr>\n", "\n", " \n", "\n", " \n", "\n", " </table>\n", " </details>\n", " </div>\n", " </div>\n", " \n", " <div style=\"margin-bottom: 20px;\">\n", " <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"margin-left: 48px;\">\n", " <details>\n", " <summary>\n", " <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 2</h4>\n", " </summary>\n", " <table style=\"width: 100%; text-align: left;\">\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Comm: </strong> tcp://127.0.0.1:62156\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Total threads: </strong> 10\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:62159/status\" target=\"_blank\">http://127.0.0.1:62159/status</a>\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Memory: </strong> 9.31 GiB\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Nanny: </strong> tcp://127.0.0.1:62130\n", " </td>\n", " <td style=\"text-align: left;\"></td>\n", " </tr>\n", " <tr>\n", " <td colspan=\"2\" style=\"text-align: left;\">\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-y1tkfpfy\n", " </td>\n", " </tr>\n", "\n", " \n", "\n", " \n", "\n", " </table>\n", " </details>\n", " </div>\n", " </div>\n", " \n", " <div style=\"margin-bottom: 20px;\">\n", " <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"margin-left: 48px;\">\n", " <details>\n", " <summary>\n", " <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 3</h4>\n", " </summary>\n", " <table style=\"width: 100%; text-align: left;\">\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Comm: </strong> tcp://127.0.0.1:62162\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Total threads: </strong> 10\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:62165/status\" target=\"_blank\">http://127.0.0.1:62165/status</a>\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Memory: </strong> 9.31 GiB\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Nanny: </strong> tcp://127.0.0.1:62131\n", " </td>\n", " <td style=\"text-align: left;\"></td>\n", " </tr>\n", " <tr>\n", " <td colspan=\"2\" style=\"text-align: left;\">\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-613gqycm\n", " </td>\n", " </tr>\n", "\n", " \n", "\n", " \n", "\n", " </table>\n", " </details>\n", " </div>\n", " </div>\n", " \n", " <div style=\"margin-bottom: 20px;\">\n", " <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"margin-left: 48px;\">\n", " <details>\n", " <summary>\n", " <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 4</h4>\n", " </summary>\n", " <table style=\"width: 100%; text-align: left;\">\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Comm: </strong> tcp://127.0.0.1:62150\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Total threads: </strong> 10\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:62153/status\" target=\"_blank\">http://127.0.0.1:62153/status</a>\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Memory: </strong> 9.31 GiB\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Nanny: </strong> tcp://127.0.0.1:62132\n", " </td>\n", " <td style=\"text-align: left;\"></td>\n", " </tr>\n", " <tr>\n", " <td colspan=\"2\" style=\"text-align: left;\">\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-nf2w0fki\n", " </td>\n", " </tr>\n", "\n", " \n", "\n", " \n", "\n", " </table>\n", " </details>\n", " </div>\n", " </div>\n", " \n", " <div style=\"margin-bottom: 20px;\">\n", " <div style=\"width: 24px; height: 24px; background-color: #DBF5FF; border: 3px solid #4CC9FF; border-radius: 5px; position: absolute;\"> </div>\n", " <div style=\"margin-left: 48px;\">\n", " <details>\n", " <summary>\n", " <h4 style=\"margin-bottom: 0px; display: inline;\">Worker: 5</h4>\n", " </summary>\n", " <table style=\"width: 100%; text-align: left;\">\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Comm: </strong> tcp://127.0.0.1:62155\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Total threads: </strong> 10\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Dashboard: </strong> <a href=\"http://127.0.0.1:62157/status\" target=\"_blank\">http://127.0.0.1:62157/status</a>\n", " </td>\n", " <td style=\"text-align: left;\">\n", " <strong>Memory: </strong> 9.31 GiB\n", " </td>\n", " </tr>\n", " <tr>\n", " <td style=\"text-align: left;\">\n", " <strong>Nanny: </strong> tcp://127.0.0.1:62133\n", " </td>\n", " <td style=\"text-align: left;\"></td>\n", " </tr>\n", " <tr>\n", " <td colspan=\"2\" style=\"text-align: left;\">\n", " <strong>Local directory: </strong> C:\\Users\\data\\AppData\\Local\\Temp\\dask-worker-space\\worker-xm8jsrrg\n", " </td>\n", " </tr>\n", "\n", " \n", "\n", " \n", "\n", " </table>\n", " </details>\n", " </div>\n", " </div>\n", " \n", "\n", " </details>\n", "</div>\n", "\n", " </details>\n", " </div>\n", "</div>\n", " </details>\n", " \n", "\n", " </div>\n", "</div>" ], "text/plain": [ "<Client: 'tcp://127.0.0.1:62125' processes=6 threads=60, memory=55.88 GiB>" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from dask.distributed import Client\n", "client = Client(n_workers=6, threads_per_worker=10, processes=True, memory_limit='10GB')\n", "client" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Set the path for different cameras" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "groupList = [\n", " \"images/MOT_3D_Camera/in_situ_absorption\",\n", " \"images/ODT_1_Axis_Camera/in_situ_absorption\",\n", " \"images/ODT_2_Axis_Camera/in_situ_absorption\",\n", "]\n", "\n", "# give a short name to each path (or let's say each camera)\n", "dskey = {\n", " \"images/MOT_3D_Camera/in_situ_absorption\": \"camera_0\",\n", " \"images/ODT_1_Axis_Camera/in_situ_absorption\": \"camera_1\",\n", " \"images/ODT_2_Axis_Camera/in_situ_absorption\": \"camera_2\",\n", "}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Set global path for experiment" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "img_dir = '//DyLabNAS/Data/'\n", "SequenceName = \"Evaporative_Cooling\" + \"/\"\n", "folderPath = img_dir + SequenceName + '2023/04/17'# get_date()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Load shot 0058" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n", "<defs>\n", "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n", "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n", "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "</symbol>\n", "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n", "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n", "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "</symbol>\n", "</defs>\n", "</svg>\n", "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n", " *\n", " */\n", "\n", ":root {\n", " --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n", " --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n", " --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n", " --xr-border-color: var(--jp-border-color2, #e0e0e0);\n", " --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n", " --xr-background-color: var(--jp-layout-color0, white);\n", " --xr-background-color-row-even: var(--jp-layout-color1, white);\n", " --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n", "}\n", "\n", "html[theme=dark],\n", "body[data-theme=dark],\n", "body.vscode-dark {\n", " --xr-font-color0: rgba(255, 255, 255, 1);\n", " --xr-font-color2: rgba(255, 255, 255, 0.54);\n", " --xr-font-color3: rgba(255, 255, 255, 0.38);\n", " --xr-border-color: #1F1F1F;\n", " --xr-disabled-color: #515151;\n", " --xr-background-color: #111111;\n", " --xr-background-color-row-even: #111111;\n", " --xr-background-color-row-odd: #313131;\n", "}\n", "\n", ".xr-wrap {\n", " display: block !important;\n", " min-width: 300px;\n", " max-width: 700px;\n", "}\n", "\n", ".xr-text-repr-fallback {\n", " /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n", " display: none;\n", "}\n", "\n", ".xr-header {\n", " padding-top: 6px;\n", " padding-bottom: 6px;\n", " margin-bottom: 4px;\n", " border-bottom: solid 1px var(--xr-border-color);\n", "}\n", "\n", ".xr-header > div,\n", ".xr-header > ul {\n", " display: inline;\n", " margin-top: 0;\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-obj-type,\n", ".xr-array-name {\n", " margin-left: 2px;\n", " margin-right: 10px;\n", "}\n", "\n", ".xr-obj-type {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-sections {\n", " padding-left: 0 !important;\n", " display: grid;\n", " grid-template-columns: 150px auto auto 1fr 20px 20px;\n", "}\n", "\n", ".xr-section-item {\n", " display: contents;\n", "}\n", "\n", ".xr-section-item input {\n", " display: none;\n", "}\n", "\n", ".xr-section-item input + label {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-item input:enabled + label {\n", " cursor: pointer;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-item input:enabled + label:hover {\n", " color: var(--xr-font-color0);\n", "}\n", "\n", ".xr-section-summary {\n", " grid-column: 1;\n", " color: var(--xr-font-color2);\n", " font-weight: 500;\n", "}\n", "\n", ".xr-section-summary > span {\n", " display: inline-block;\n", " padding-left: 0.5em;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-summary-in + label:before {\n", " display: inline-block;\n", " content: '►';\n", " font-size: 11px;\n", " width: 15px;\n", " text-align: center;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label:before {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-summary-in:checked + label:before {\n", " content: '▼';\n", "}\n", "\n", ".xr-section-summary-in:checked + label > span {\n", " display: none;\n", "}\n", "\n", ".xr-section-summary,\n", ".xr-section-inline-details {\n", " padding-top: 4px;\n", " padding-bottom: 4px;\n", "}\n", "\n", ".xr-section-inline-details {\n", " grid-column: 2 / -1;\n", "}\n", "\n", ".xr-section-details {\n", " display: none;\n", " grid-column: 1 / -1;\n", " margin-bottom: 5px;\n", "}\n", "\n", ".xr-section-summary-in:checked ~ .xr-section-details {\n", " display: contents;\n", "}\n", "\n", ".xr-array-wrap {\n", " grid-column: 1 / -1;\n", " display: grid;\n", " grid-template-columns: 20px auto;\n", "}\n", "\n", ".xr-array-wrap > label {\n", " grid-column: 1;\n", " vertical-align: top;\n", "}\n", "\n", ".xr-preview {\n", " color: var(--xr-font-color3);\n", "}\n", "\n", ".xr-array-preview,\n", ".xr-array-data {\n", " padding: 0 5px !important;\n", " grid-column: 2;\n", "}\n", "\n", ".xr-array-data,\n", ".xr-array-in:checked ~ .xr-array-preview {\n", " display: none;\n", "}\n", "\n", ".xr-array-in:checked ~ .xr-array-data,\n", ".xr-array-preview {\n", " display: inline-block;\n", "}\n", "\n", ".xr-dim-list {\n", " display: inline-block !important;\n", " list-style: none;\n", " padding: 0 !important;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list li {\n", " display: inline-block;\n", " padding: 0;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list:before {\n", " content: '(';\n", "}\n", "\n", ".xr-dim-list:after {\n", " content: ')';\n", "}\n", "\n", ".xr-dim-list li:not(:last-child):after {\n", " content: ',';\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-has-index {\n", " font-weight: bold;\n", "}\n", "\n", ".xr-var-list,\n", ".xr-var-item {\n", " display: contents;\n", "}\n", "\n", ".xr-var-item > div,\n", ".xr-var-item label,\n", ".xr-var-item > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-even);\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-var-item > .xr-var-name:hover span {\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-var-list > li:nth-child(odd) > div,\n", ".xr-var-list > li:nth-child(odd) > label,\n", ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-odd);\n", "}\n", "\n", ".xr-var-name {\n", " grid-column: 1;\n", "}\n", "\n", ".xr-var-dims {\n", " grid-column: 2;\n", "}\n", "\n", ".xr-var-dtype {\n", " grid-column: 3;\n", " text-align: right;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-var-preview {\n", " grid-column: 4;\n", "}\n", "\n", ".xr-index-preview {\n", " grid-column: 2 / 5;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-var-name,\n", ".xr-var-dims,\n", ".xr-var-dtype,\n", ".xr-preview,\n", ".xr-attrs dt {\n", " white-space: nowrap;\n", " overflow: hidden;\n", " text-overflow: ellipsis;\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-var-name:hover,\n", ".xr-var-dims:hover,\n", ".xr-var-dtype:hover,\n", ".xr-attrs dt:hover {\n", " overflow: visible;\n", " width: auto;\n", " z-index: 1;\n", "}\n", "\n", ".xr-var-attrs,\n", ".xr-var-data,\n", ".xr-index-data {\n", " display: none;\n", " background-color: var(--xr-background-color) !important;\n", " padding-bottom: 5px !important;\n", "}\n", "\n", ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n", ".xr-var-data-in:checked ~ .xr-var-data,\n", ".xr-index-data-in:checked ~ .xr-index-data {\n", " display: block;\n", "}\n", "\n", ".xr-var-data > table {\n", " float: right;\n", "}\n", "\n", ".xr-var-name span,\n", ".xr-var-data,\n", ".xr-index-name div,\n", ".xr-index-data,\n", ".xr-attrs {\n", " padding-left: 25px !important;\n", "}\n", "\n", ".xr-attrs,\n", ".xr-var-attrs,\n", ".xr-var-data,\n", ".xr-index-data {\n", " grid-column: 1 / -1;\n", "}\n", "\n", "dl.xr-attrs {\n", " padding: 0;\n", " margin: 0;\n", " display: grid;\n", " grid-template-columns: 125px auto;\n", "}\n", "\n", ".xr-attrs dt,\n", ".xr-attrs dd {\n", " padding: 0;\n", " margin: 0;\n", " float: left;\n", " padding-right: 10px;\n", " width: auto;\n", "}\n", "\n", ".xr-attrs dt {\n", " font-weight: normal;\n", " grid-column: 1;\n", "}\n", "\n", ".xr-attrs dt:hover span {\n", " display: inline-block;\n", " background: var(--xr-background-color);\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-attrs dd {\n", " grid-column: 2;\n", " white-space: pre-wrap;\n", " word-break: break-all;\n", "}\n", "\n", ".xr-icon-database,\n", ".xr-icon-file-text2,\n", ".xr-no-icon {\n", " display: inline-block;\n", " vertical-align: middle;\n", " width: 1em;\n", " height: 1.5em !important;\n", " stroke-width: 0;\n", " stroke: currentColor;\n", " fill: currentColor;\n", "}\n", "</style><pre class='xr-text-repr-fallback'><xarray.Dataset>\n", "Dimensions: (runs: 5, truncation_value: 11, y: 1200, x: 1920)\n", "Coordinates:\n", " * runs (runs) float64 0.0 1.0 2.0 3.0 4.0\n", " * truncation_value (truncation_value) float64 0.8 0.83 0.85 ... 0.97 0.99 1.0\n", "Dimensions without coordinates: y, x\n", "Data variables:\n", " atoms (runs, truncation_value, y, x) uint16 99 100 ... 126 129\n", " background (runs, truncation_value, y, x) uint16 103 100 ... 122 124\n", " dark (runs, truncation_value, y, x) uint16 51 52 52 ... 49 50\n", " shotNum (runs, truncation_value) <U2 '00' '01' '02' ... '53' '54'\n", "Attributes: (12/100)\n", " TOF_free: 0.02\n", " abs_img_freq: 110.866\n", " absorption_imaging_flag: True\n", " backup_data: True\n", " blink_off_time: nan\n", " blink_on_time: nan\n", " ... ...\n", " z_offset: 0.195\n", " z_offset_img: 0.195\n", " truncation_value: [0.8 0.83 0.85 0.87 0.89 0.91 0.93 0....\n", " runs: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1...\n", " scanAxis: ['runs' 'truncation_value']\n", " scanAxisLength: [55. 55.]</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-f6866415-13e6-4ceb-9e2b-bb7ccda03142' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-f6866415-13e6-4ceb-9e2b-bb7ccda03142' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>runs</span>: 5</li><li><span class='xr-has-index'>truncation_value</span>: 11</li><li><span>y</span>: 1200</li><li><span>x</span>: 1920</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-e5d20d4c-8cf2-4236-9189-e341a83a1b66' class='xr-section-summary-in' type='checkbox' checked><label for='section-e5d20d4c-8cf2-4236-9189-e341a83a1b66' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>runs</span></div><div class='xr-var-dims'>(runs)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.0 1.0 2.0 3.0 4.0</div><input id='attrs-c9415d14-bf51-46e8-9859-e5bfddddc1dd' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-c9415d14-bf51-46e8-9859-e5bfddddc1dd' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-01eac335-7b56-462b-8231-7467bd19d7c0' class='xr-var-data-in' type='checkbox'><label for='data-01eac335-7b56-462b-8231-7467bd19d7c0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0., 1., 2., 3., 4.])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>truncation_value</span></div><div class='xr-var-dims'>(truncation_value)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.8 0.83 0.85 ... 0.97 0.99 1.0</div><input id='attrs-dc9d5dc6-8fe5-4e0a-87ea-409689e906af' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-dc9d5dc6-8fe5-4e0a-87ea-409689e906af' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ca9ff513-98c4-4649-874e-dbd81877bbf1' class='xr-var-data-in' type='checkbox'><label for='data-ca9ff513-98c4-4649-874e-dbd81877bbf1' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0.8 , 0.83, 0.85, 0.87, 0.89, 0.91, 0.93, 0.95, 0.97, 0.99, 1. ])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-3d03f457-3b77-4a87-9eaa-8e130f0a616b' class='xr-section-summary-in' type='checkbox' checked><label for='section-3d03f457-3b77-4a87-9eaa-8e130f0a616b' class='xr-section-summary' >Data variables: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>atoms</span></div><div class='xr-var-dims'>(runs, truncation_value, y, x)</div><div class='xr-var-dtype'>uint16</div><div class='xr-var-preview xr-preview'>99 100 102 87 ... 130 125 126 129</div><input id='attrs-4309b054-d25d-4782-8642-c423c254d48c' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-4309b054-d25d-4782-8642-c423c254d48c' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1616364a-d417-4fea-8bc5-96a6bafbf0f6' class='xr-var-data-in' type='checkbox'><label for='data-1616364a-d417-4fea-8bc5-96a6bafbf0f6' title=' " [100, 106, 99, ..., 149, 148, 146],\n", " [ 94, 95, 96, ..., 139, 144, 148],\n", " ...,\n", " [ 98, 106, 105, ..., 133, 142, 142],\n", " [112, 109, 102, ..., 128, 136, 131],\n", " [112, 113, 111, ..., 121, 122, 131]],\n", "\n", " [[102, 103, 100, ..., 155, 154, 142],\n", " [ 97, 100, 101, ..., 146, 146, 156],\n", " [ 91, 93, 97, ..., 142, 136, 151],\n", " ...,\n", " [105, 103, 103, ..., 144, 134, 142],\n", " [102, 104, 112, ..., 133, 134, 135],\n", " [114, 115, 113, ..., 119, 126, 122]],\n", "\n", " [[101, 105, 103, ..., 148, 152, 146],\n", " [101, 102, 98, ..., 143, 146, 149],\n", " [ 97, 98, 98, ..., 139, 137, 146],\n", " ...,\n", "...\n", " ...,\n", " [100, 102, 109, ..., 135, 141, 140],\n", " [106, 103, 105, ..., 128, 140, 132],\n", " [114, 107, 108, ..., 121, 123, 126]],\n", "\n", " [[101, 102, 101, ..., 153, 153, 146],\n", " [101, 103, 100, ..., 148, 143, 149],\n", " [ 96, 95, 98, ..., 145, 138, 144],\n", " ...,\n", " [ 98, 107, 103, ..., 140, 142, 145],\n", " [106, 100, 103, ..., 133, 133, 136],\n", " [115, 103, 102, ..., 123, 125, 128]],\n", "\n", " [[103, 100, 102, ..., 154, 147, 153],\n", " [ 96, 103, 97, ..., 150, 150, 152],\n", " [ 96, 100, 96, ..., 141, 142, 144],\n", " ...,\n", " [101, 102, 101, ..., 139, 142, 140],\n", " [105, 105, 98, ..., 132, 135, 131],\n", " [109, 111, 107, ..., 125, 126, 129]]]], dtype=uint16)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>background</span></div><div class='xr-var-dims'>(runs, truncation_value, y, x)</div><div class='xr-var-dtype'>uint16</div><div class='xr-var-preview xr-preview'>103 100 101 92 ... 130 122 122 124</div><input id='attrs-f9914ab6-98a1-4a63-8217-da175587ca5e' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-f9914ab6-98a1-4a63-8217-da175587ca5e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-abec8df5-4e10-4673-ac41-49e32040b672' class='xr-var-data-in' type='checkbox'><label for='data-abec8df5-4e10-4673-ac41-49e32040b672' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>IMAGE_SUBCLASS :</span></dt><dd>IMAGE_GRAYSCALE</dd><dt><span>IMAGE_VERSION :</span></dt><dd>1.2</dd><dt><span>IMAGE_WHITE_IS_ZERO :</span></dt><dd>0</dd></dl></div><div class='xr-var-data'><pre>array([[[[103, 100, 101, ..., 161, 147, 146],\n", " [101, 96, 97, ..., 146, 144, 146],\n", " [ 92, 95, 96, ..., 143, 134, 149],\n", " ...,\n", " [104, 103, 107, ..., 139, 142, 137],\n", " [104, 105, 109, ..., 128, 133, 130],\n", " [111, 111, 107, ..., 118, 120, 123]],\n", "\n", " [[ 96, 100, 99, ..., 155, 149, 139],\n", " [ 94, 101, 100, ..., 149, 143, 151],\n", " [ 94, 90, 97, ..., 140, 143, 139],\n", " ...,\n", " [103, 105, 103, ..., 126, 139, 144],\n", " [104, 111, 105, ..., 131, 136, 134],\n", " [111, 112, 104, ..., 121, 126, 137]],\n", "\n", " [[101, 99, 107, ..., 154, 146, 151],\n", " [ 97, 101, 100, ..., 148, 148, 145],\n", " [ 87, 102, 100, ..., 145, 133, 140],\n", " ...,\n", "...\n", " ...,\n", " [105, 100, 99, ..., 132, 142, 137],\n", " [ 96, 104, 102, ..., 133, 135, 133],\n", " [110, 109, 103, ..., 123, 122, 119]],\n", "\n", " [[101, 102, 101, ..., 156, 154, 149],\n", " [ 95, 99, 99, ..., 140, 146, 153],\n", " [ 91, 103, 97, ..., 142, 140, 147],\n", " ...,\n", " [ 98, 106, 106, ..., 132, 139, 147],\n", " [102, 110, 108, ..., 127, 130, 131],\n", " [110, 109, 106, ..., 127, 125, 127]],\n", "\n", " [[103, 106, 105, ..., 146, 146, 147],\n", " [ 99, 103, 102, ..., 152, 142, 152],\n", " [ 97, 100, 92, ..., 143, 138, 156],\n", " ...,\n", " [104, 108, 105, ..., 142, 141, 139],\n", " [107, 104, 104, ..., 131, 137, 128],\n", " [110, 109, 107, ..., 122, 122, 124]]]], dtype=uint16)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>dark</span></div><div class='xr-var-dims'>(runs, truncation_value, y, x)</div><div class='xr-var-dtype'>uint16</div><div class='xr-var-preview xr-preview'>51 52 52 51 51 ... 52 50 53 49 50</div><input id='attrs-76370da3-3eeb-4ffc-8da7-38cfa32416fd' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-76370da3-3eeb-4ffc-8da7-38cfa32416fd' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-90342ed7-aa13-46bd-a2cb-f0f48910fe9d' class='xr-var-data-in' type='checkbox'><label for='data-90342ed7-aa13-46bd-a2cb-f0f48910fe9d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>IMAGE_SUBCLASS :</span></dt><dd>IMAGE_GRAYSCALE</dd><dt><span>IMAGE_VERSION :</span></dt><dd>1.2</dd><dt><span>IMAGE_WHITE_IS_ZERO :</span></dt><dd>0</dd></dl></div><div class='xr-var-data'><pre>array([[[[51, 52, 52, ..., 50, 51, 51],\n", " [50, 50, 51, ..., 51, 51, 49],\n", " [51, 51, 50, ..., 50, 50, 49],\n", " ...,\n", " [50, 51, 50, ..., 50, 50, 49],\n", " [50, 50, 49, ..., 50, 50, 51],\n", " [51, 50, 50, ..., 50, 50, 51]],\n", "\n", " [[50, 52, 51, ..., 50, 50, 49],\n", " [51, 50, 50, ..., 50, 50, 50],\n", " [50, 51, 49, ..., 50, 50, 51],\n", " ...,\n", " [51, 50, 50, ..., 52, 50, 51],\n", " [51, 50, 51, ..., 50, 52, 51],\n", " [51, 52, 51, ..., 51, 50, 50]],\n", "\n", " [[51, 51, 52, ..., 51, 51, 50],\n", " [50, 50, 51, ..., 51, 51, 51],\n", " [50, 50, 50, ..., 50, 50, 50],\n", " ...,\n", "...\n", " ...,\n", " [51, 50, 51, ..., 51, 51, 51],\n", " [50, 49, 50, ..., 49, 51, 51],\n", " [50, 51, 50, ..., 50, 49, 51]],\n", "\n", " [[50, 50, 50, ..., 51, 50, 51],\n", " [51, 50, 51, ..., 51, 50, 49],\n", " [52, 49, 50, ..., 52, 51, 51],\n", " ...,\n", " [50, 50, 50, ..., 49, 50, 49],\n", " [50, 49, 51, ..., 51, 50, 51],\n", " [52, 51, 52, ..., 50, 51, 51]],\n", "\n", " [[50, 51, 49, ..., 50, 51, 51],\n", " [51, 52, 51, ..., 51, 51, 50],\n", " [52, 51, 51, ..., 49, 51, 51],\n", " ...,\n", " [52, 50, 51, ..., 52, 50, 51],\n", " [50, 51, 50, ..., 51, 50, 50],\n", " [50, 51, 51, ..., 53, 49, 50]]]], dtype=uint16)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>shotNum</span></div><div class='xr-var-dims'>(runs, truncation_value)</div><div class='xr-var-dtype'><U2</div><div class='xr-var-preview xr-preview'>'00' '01' '02' ... '52' '53' '54'</div><input id='attrs-d222e2e8-8564-45fc-91cc-6a8ef6b20bc2' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-d222e2e8-8564-45fc-91cc-6a8ef6b20bc2' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-82580c3f-c948-4675-a4fa-39d0c59b6cea' class='xr-var-data-in' type='checkbox'><label for='data-82580c3f-c948-4675-a4fa-39d0c59b6cea' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10'],\n", " ['11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'],\n", " ['22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32'],\n", " ['33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43'],\n", " ['44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54']],\n", " dtype='<U2')</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-330a8433-d4b6-47ea-9e85-5fdc7612e0e9' class='xr-section-summary-in' type='checkbox' ><label for='section-330a8433-d4b6-47ea-9e85-5fdc7612e0e9' class='xr-section-summary' >Indexes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>runs</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-3f3fae6c-3d6d-4507-a2c3-e03b55fa5052' class='xr-index-data-in' type='checkbox'/><label for='index-3f3fae6c-3d6d-4507-a2c3-e03b55fa5052' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([0.0, 1.0, 2.0, 3.0, 4.0], dtype='float64', name='runs'))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>truncation_value</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-de25337f-f532-44ee-abbc-badfdecb8ec4' class='xr-index-data-in' type='checkbox'/><label for='index-de25337f-f532-44ee-abbc-badfdecb8ec4' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([0.8, 0.83, 0.85, 0.87, 0.89, 0.91, 0.93, 0.95, 0.97, 0.99, 1.0], dtype='float64', name='truncation_value'))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-0e9068ec-5b28-4b91-999c-6fe2882e98ec' class='xr-section-summary-in' type='checkbox' ><label for='section-0e9068ec-5b28-4b91-999c-6fe2882e98ec' class='xr-section-summary' >Attributes: <span>(100)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>TOF_free :</span></dt><dd>0.02</dd><dt><span>abs_img_freq :</span></dt><dd>110.866</dd><dt><span>absorption_imaging_flag :</span></dt><dd>True</dd><dt><span>backup_data :</span></dt><dd>True</dd><dt><span>blink_off_time :</span></dt><dd>nan</dd><dt><span>blink_on_time :</span></dt><dd>nan</dd><dt><span>c_duration :</span></dt><dd>0.2</dd><dt><span>cmot_final_current :</span></dt><dd>0.65</dd><dt><span>cmot_hold :</span></dt><dd>0.06</dd><dt><span>cmot_initial_current :</span></dt><dd>0.18</dd><dt><span>compX_current :</span></dt><dd>0.005</dd><dt><span>compX_current_sg :</span></dt><dd>0</dd><dt><span>compX_final_current :</span></dt><dd>0.002</dd><dt><span>compX_initial_current :</span></dt><dd>0.005</dd><dt><span>compY_current :</span></dt><dd>0</dd><dt><span>compY_current_sg :</span></dt><dd>0</dd><dt><span>compY_final_current :</span></dt><dd>0</dd><dt><span>compY_initial_current :</span></dt><dd>0</dd><dt><span>compZ_current :</span></dt><dd>0</dd><dt><span>compZ_current_sg :</span></dt><dd>0.195</dd><dt><span>compZ_final_current :</span></dt><dd>0.287</dd><dt><span>compZ_initial_current :</span></dt><dd>0</dd><dt><span>default_camera :</span></dt><dd>0</dd><dt><span>evap_1_final_pow_1 :</span></dt><dd>4.8</dd><dt><span>evap_1_final_pow_2 :</span></dt><dd>2.2</dd><dt><span>evap_1_final_pow_3 :</span></dt><dd>1.2</dd><dt><span>evap_1_final_pow_4 :</span></dt><dd>0.526</dd><dt><span>evap_1_ramp_duration_1 :</span></dt><dd>0.15</dd><dt><span>evap_1_ramp_duration_2 :</span></dt><dd>0.3</dd><dt><span>evap_1_ramp_duration_3 :</span></dt><dd>0.2</dd><dt><span>evap_1_ramp_duration_4 :</span></dt><dd>0.5</dd><dt><span>evap_1_start_pow_1 :</span></dt><dd>7</dd><dt><span>evap_1_start_pow_2 :</span></dt><dd>4.8</dd><dt><span>evap_1_start_pow_3 :</span></dt><dd>2.2</dd><dt><span>evap_1_start_pow_4 :</span></dt><dd>1.2</dd><dt><span>evap_2_final_pow_1 :</span></dt><dd>0.35</dd><dt><span>evap_2_ramp_duration_1 :</span></dt><dd>0.5</dd><dt><span>evap_2_start_pow_1 :</span></dt><dd>0.526</dd><dt><span>evap_3_arm_1_final_pow :</span></dt><dd>0.037</dd><dt><span>evap_3_arm_1_start_pow :</span></dt><dd " 0.87 0.89 0.91 0.93 0.95 0.97 0.99 1. 0.8 0.83 0.85 0.87 0.89 0.91\n", " 0.93 0.95 0.97 0.99 1. 0.8 0.83 0.85 0.87 0.89 0.91 0.93 0.95 0.97\n", " 0.99 1. 0.8 0.83 0.85 0.87 0.89 0.91 0.93 0.95 0.97 0.99 1. ]</dd><dt><span>runs :</span></dt><dd>[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 2. 2.\n", " 2. 2. 2. 2. 2. 2. 2. 2. 2. 3. 3. 3. 3. 3. 3. 3. 3. 3. 3. 3. 4. 4. 4. 4.\n", " 4. 4. 4. 4. 4. 4. 4.]</dd><dt><span>scanAxis :</span></dt><dd>['runs' 'truncation_value']</dd><dt><span>scanAxisLength :</span></dt><dd>[55. 55.]</dd></dl></div></li></ul></div></div>" ], "text/plain": [ "<xarray.Dataset>\n", "Dimensions: (runs: 5, truncation_value: 11, y: 1200, x: 1920)\n", "Coordinates:\n", " * runs (runs) float64 0.0 1.0 2.0 3.0 4.0\n", " * truncation_value (truncation_value) float64 0.8 0.83 0.85 ... 0.97 0.99 1.0\n", "Dimensions without coordinates: y, x\n", "Data variables:\n", " atoms (runs, truncation_value, y, x) uint16 99 100 ... 126 129\n", " background (runs, truncation_value, y, x) uint16 103 100 ... 122 124\n", " dark (runs, truncation_value, y, x) uint16 51 52 52 ... 49 50\n", " shotNum (runs, truncation_value) <U2 '00' '01' '02' ... '53' '54'\n", "Attributes: (12/100)\n", " TOF_free: 0.02\n", " abs_img_freq: 110.866\n", " absorption_imaging_flag: True\n", " backup_data: True\n", " blink_off_time: nan\n", " blink_on_time: nan\n", " ... ...\n", " z_offset: 0.195\n", " z_offset_img: 0.195\n", " truncation_value: [0.8 0.83 0.85 0.87 0.89 0.91 0.93 0....\n", " runs: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1...\n", " scanAxis: ['runs' 'truncation_value']\n", " scanAxisLength: [55. 55.]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "shotNum = \"0058\"\n", "filePath = folderPath + \"/\" + shotNum + \"/*.h5\"\n", "\n", "dataSetDict = {\n", " dskey[groupList[i]]: read_hdf5_file(filePath, groupList[i])\n", " for i in [0] # range(len(groupList)) # uncommont to load data for all three cameras\n", "}\n", "dataSet = dataSetDict[\"camera_0\"]\n", "\n", "dataSet = swap_xy(dataSet)\n", "\n", "scanAxis = get_scanAxis(dataSet)\n", "\n", "dataSet = auto_rechunk(dataSet)\n", "\n", "dataSet.load()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Index and select data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since we use the xarray package, in fact, it already has a well developed function to index and select the data. Therefore, have a look of the following link\n", "\n", "https://docs.xarray.dev/en/stable/user-guide/indexing.html" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Modify the data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There are two ways to select an element in xarray and modify the value of it." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Select by value" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The first method is to select it by the value of coordiante.\n", "\n", "Here is an emaxple of selecting the element in 'ShotNum' at 'runs'=0, truncation_value=0.8, and change it to '-1'." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n", "<defs>\n", "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n", "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n", "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "</symbol>\n", "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n", "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n", "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "</symbol>\n", "</defs>\n", "</svg>\n", "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n", " *\n", " */\n", "\n", ":root {\n", " --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n", " --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n", " --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n", " --xr-border-color: var(--jp-border-color2, #e0e0e0);\n", " --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n", " --xr-background-color: var(--jp-layout-color0, white);\n", " --xr-background-color-row-even: var(--jp-layout-color1, white);\n", " --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n", "}\n", "\n", "html[theme=dark],\n", "body[data-theme=dark],\n", "body.vscode-dark {\n", " --xr-font-color0: rgba(255, 255, 255, 1);\n", " --xr-font-color2: rgba(255, 255, 255, 0.54);\n", " --xr-font-color3: rgba(255, 255, 255, 0.38);\n", " --xr-border-color: #1F1F1F;\n", " --xr-disabled-color: #515151;\n", " --xr-background-color: #111111;\n", " --xr-background-color-row-even: #111111;\n", " --xr-background-color-row-odd: #313131;\n", "}\n", "\n", ".xr-wrap {\n", " display: block !important;\n", " min-width: 300px;\n", " max-width: 700px;\n", "}\n", "\n", ".xr-text-repr-fallback {\n", " /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n", " display: none;\n", "}\n", "\n", ".xr-header {\n", " padding-top: 6px;\n", " padding-bottom: 6px;\n", " margin-bottom: 4px;\n", " border-bottom: solid 1px var(--xr-border-color);\n", "}\n", "\n", ".xr-header > div,\n", ".xr-header > ul {\n", " display: inline;\n", " margin-top: 0;\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-obj-type,\n", ".xr-array-name {\n", " margin-left: 2px;\n", " margin-right: 10px;\n", "}\n", "\n", ".xr-obj-type {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-sections {\n", " padding-left: 0 !important;\n", " display: grid;\n", " grid-template-columns: 150px auto auto 1fr 20px 20px;\n", "}\n", "\n", ".xr-section-item {\n", " display: contents;\n", "}\n", "\n", ".xr-section-item input {\n", " display: none;\n", "}\n", "\n", ".xr-section-item input + label {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-item input:enabled + label {\n", " cursor: pointer;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-item input:enabled + label:hover {\n", " color: var(--xr-font-color0);\n", "}\n", "\n", ".xr-section-summary {\n", " grid-column: 1;\n", " color: var(--xr-font-color2);\n", " font-weight: 500;\n", "}\n", "\n", ".xr-section-summary > span {\n", " display: inline-block;\n", " padding-left: 0.5em;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-summary-in + label:before {\n", " display: inline-block;\n", " content: '►';\n", " font-size: 11px;\n", " width: 15px;\n", " text-align: center;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label:before {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-summary-in:checked + label:before {\n", " content: '▼';\n", "}\n", "\n", ".xr-section-summary-in:checked + label > span {\n", " display: none;\n", "}\n", "\n", ".xr-section-summary,\n", ".xr-section-inline-details {\n", " padding-top: 4px;\n", " padding-bottom: 4px;\n", "}\n", "\n", ".xr-section-inline-details {\n", " grid-column: 2 / -1;\n", "}\n", "\n", ".xr-section-details {\n", " display: none;\n", " grid-column: 1 / -1;\n", " margin-bottom: 5px;\n", "}\n", "\n", ".xr-section-summary-in:checked ~ .xr-section-details {\n", " display: contents;\n", "}\n", "\n", ".xr-array-wrap {\n", " grid-column: 1 / -1;\n", " display: grid;\n", " grid-template-columns: 20px auto;\n", "}\n", "\n", ".xr-array-wrap > label {\n", " grid-column: 1;\n", " vertical-align: top;\n", "}\n", "\n", ".xr-preview {\n", " color: var(--xr-font-color3);\n", "}\n", "\n", ".xr-array-preview,\n", ".xr-array-data {\n", " padding: 0 5px !important;\n", " grid-column: 2;\n", "}\n", "\n", ".xr-array-data,\n", ".xr-array-in:checked ~ .xr-array-preview {\n", " display: none;\n", "}\n", "\n", ".xr-array-in:checked ~ .xr-array-data,\n", ".xr-array-preview {\n", " display: inline-block;\n", "}\n", "\n", ".xr-dim-list {\n", " display: inline-block !important;\n", " list-style: none;\n", " padding: 0 !important;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list li {\n", " display: inline-block;\n", " padding: 0;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list:before {\n", " content: '(';\n", "}\n", "\n", ".xr-dim-list:after {\n", " content: ')';\n", "}\n", "\n", ".xr-dim-list li:not(:last-child):after {\n", " content: ',';\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-has-index {\n", " font-weight: bold;\n", "}\n", "\n", ".xr-var-list,\n", ".xr-var-item {\n", " display: contents;\n", "}\n", "\n", ".xr-var-item > div,\n", ".xr-var-item label,\n", ".xr-var-item > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-even);\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-var-item > .xr-var-name:hover span {\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-var-list > li:nth-child(odd) > div,\n", ".xr-var-list > li:nth-child(odd) > label,\n", ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-odd);\n", "}\n", "\n", ".xr-var-name {\n", " grid-column: 1;\n", "}\n", "\n", ".xr-var-dims {\n", " grid-column: 2;\n", "}\n", "\n", ".xr-var-dtype {\n", " grid-column: 3;\n", " text-align: right;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-var-preview {\n", " grid-column: 4;\n", "}\n", "\n", ".xr-index-preview {\n", " grid-column: 2 / 5;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-var-name,\n", ".xr-var-dims,\n", ".xr-var-dtype,\n", ".xr-preview,\n", ".xr-attrs dt {\n", " white-space: nowrap;\n", " overflow: hidden;\n", " text-overflow: ellipsis;\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-var-name:hover,\n", ".xr-var-dims:hover,\n", ".xr-var-dtype:hover,\n", ".xr-attrs dt:hover {\n", " overflow: visible;\n", " width: auto;\n", " z-index: 1;\n", "}\n", "\n", ".xr-var-attrs,\n", ".xr-var-data,\n", ".xr-index-data {\n", " display: none;\n", " background-color: var(--xr-background-color) !important;\n", " padding-bottom: 5px !important;\n", "}\n", "\n", ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n", ".xr-var-data-in:checked ~ .xr-var-data,\n", ".xr-index-data-in:checked ~ .xr-index-data {\n", " display: block;\n", "}\n", "\n", ".xr-var-data > table {\n", " float: right;\n", "}\n", "\n", ".xr-var-name span,\n", ".xr-var-data,\n", ".xr-index-name div,\n", ".xr-index-data,\n", ".xr-attrs {\n", " padding-left: 25px !important;\n", "}\n", "\n", ".xr-attrs,\n", ".xr-var-attrs,\n", ".xr-var-data,\n", ".xr-index-data {\n", " grid-column: 1 / -1;\n", "}\n", "\n", "dl.xr-attrs {\n", " padding: 0;\n", " margin: 0;\n", " display: grid;\n", " grid-template-columns: 125px auto;\n", "}\n", "\n", ".xr-attrs dt,\n", ".xr-attrs dd {\n", " padding: 0;\n", " margin: 0;\n", " float: left;\n", " padding-right: 10px;\n", " width: auto;\n", "}\n", "\n", ".xr-attrs dt {\n", " font-weight: normal;\n", " grid-column: 1;\n", "}\n", "\n", ".xr-attrs dt:hover span {\n", " display: inline-block;\n", " background: var(--xr-background-color);\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-attrs dd {\n", " grid-column: 2;\n", " white-space: pre-wrap;\n", " word-break: break-all;\n", "}\n", "\n", ".xr-icon-database,\n", ".xr-icon-file-text2,\n", ".xr-no-icon {\n", " display: inline-block;\n", " vertical-align: middle;\n", " width: 1em;\n", " height: 1.5em !important;\n", " stroke-width: 0;\n", " stroke: currentColor;\n", " fill: currentColor;\n", "}\n", "</style><pre class='xr-text-repr-fallback'><xarray.DataArray 'shotNum' (runs: 5, truncation_value: 11)>\n", "array([['-1', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10'],\n", " ['11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'],\n", " ['22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32'],\n", " ['33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43'],\n", " ['44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54']],\n", " dtype='<U2')\n", "Coordinates:\n", " * runs (runs) float64 0.0 1.0 2.0 3.0 4.0\n", " * truncation_value (truncation_value) float64 0.8 0.83 0.85 ... 0.97 0.99 1.0</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'shotNum'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>runs</span>: 5</li><li><span class='xr-has-index'>truncation_value</span>: 11</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-d99314fe-ff17-44cb-b5f7-a182cc4128e0' class='xr-array-in' type='checkbox' checked><label for='section-d99314fe-ff17-44cb-b5f7-a182cc4128e0' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>'-1' '01' '02' '03' '04' '05' '06' ... '49' '50' '51' '52' '53' '54'</span></div><div class='xr-array-data'><pre>array([['-1', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10'],\n", " ['11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'],\n", " ['22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32'],\n", " ['33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43'],\n", " ['44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54']],\n", " dtype='<U2')</pre></div></div></li><li class='xr-section-item'><input id='section-072c487d-d002-4259-a01b-c08c9f7ea79b' class='xr-section-summary-in' type='checkbox' checked><label for='section-072c487d-d002-4259-a01b-c08c9f7ea79b' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>runs</span></div><div class='xr-var-dims'>(runs)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.0 1.0 2.0 3.0 4.0</div><input id='attrs-6385a017-4275-4e49-961d-e85d6ddf7cc7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6385a017-4275-4e49-961d-e85d6ddf7cc7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2d912bad-e388-4747-94fc-8e91e9ab1d65' class='xr-var-data-in' type='checkbox'><label for='data-2d912bad-e388-4747-94fc-8e91e9ab1d65' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0., 1., 2., 3., 4.])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>truncation_value</span></div><div class='xr-var-dims'>(truncation_value)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.8 0.83 0.85 ... 0.97 0.99 1.0</div><input id='attrs-09ed0bfd-14e3-4a30-adac-d71498309ce8' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-09ed0bfd-14e3-4a30-adac-d71498309ce8' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-62e5405a-da06-4a0f-bf31-e46024c03b81' class='xr-var-data-in' type='checkbox'><label for='data-62e5405a-da06-4a0f-bf31-e46024c03b81' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0.8 , 0.83, 0.85, 0.87, 0.89, 0.91, 0.93, 0.95, 0.97, 0.99, 1. ])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-e9b63c1f-c666-49cb-bdbb-1aa34bb6385e' class='xr-section-summary-in' type='checkbox' ><label for='section-e9b63c1f-c666-49cb-bdbb-1aa34bb6385e' class='xr-section-summary' >Indexes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>runs</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-6d6ac887-feed-4441-bca4-a789b1f3b61d' class='xr-index-data-in' type='checkbox'/><label for='index-6d6ac887-feed-4441-bca4-a789b1f3b61d' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([0.0, 1.0, 2.0, 3.0, 4.0], dtype='float64', name='runs'))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>truncation_value</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-db91c79a-99fe-4316-b8ef-b3092bceb87b' class='xr-index-data-in' type='checkbox'/><label for='index-db91c79a-99fe-4316-b8ef-b3092bceb87b' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([0.8, 0.83, 0.85, 0.87, 0.89, 0.91, 0.93, 0.95, 0.97, 0.99, 1.0], dtype='float64', name='truncation_value'))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-c91e228a-d7cb-4584-8e9f-4435a2481da5' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-c91e228a-d7cb-4584-8e9f-4435a2481da5' class='xr-section- ], "text/plain": [ "<xarray.DataArray 'shotNum' (runs: 5, truncation_value: 11)>\n", "array([['-1', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10'],\n", " ['11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'],\n", " ['22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32'],\n", " ['33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43'],\n", " ['44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54']],\n", " dtype='<U2')\n", "Coordinates:\n", " * runs (runs) float64 0.0 1.0 2.0 3.0 4.0\n", " * truncation_value (truncation_value) float64 0.8 0.83 0.85 ... 0.97 0.99 1.0" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dataSet.shotNum.loc[\n", " {\n", " 'runs': 0,\n", " 'truncation_value': 0.8,\n", " }\n", " ] = '-1'\n", "\n", "# Or wirte it in short\n", "dataSet.shotNum.loc[0, 0.8] = '-1'\n", "\n", "dataSet.shotNum" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Select by index" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The second method is to select it by index.\n", "\n", "Here is an emaxple of selecting the element in 'ShotNum' at (0, 1), and change it to '-2'." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n", "<defs>\n", "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n", "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n", "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "</symbol>\n", "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n", "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n", "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "</symbol>\n", "</defs>\n", "</svg>\n", "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n", " *\n", " */\n", "\n", ":root {\n", " --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n", " --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n", " --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n", " --xr-border-color: var(--jp-border-color2, #e0e0e0);\n", " --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n", " --xr-background-color: var(--jp-layout-color0, white);\n", " --xr-background-color-row-even: var(--jp-layout-color1, white);\n", " --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n", "}\n", "\n", "html[theme=dark],\n", "body[data-theme=dark],\n", "body.vscode-dark {\n", " --xr-font-color0: rgba(255, 255, 255, 1);\n", " --xr-font-color2: rgba(255, 255, 255, 0.54);\n", " --xr-font-color3: rgba(255, 255, 255, 0.38);\n", " --xr-border-color: #1F1F1F;\n", " --xr-disabled-color: #515151;\n", " --xr-background-color: #111111;\n", " --xr-background-color-row-even: #111111;\n", " --xr-background-color-row-odd: #313131;\n", "}\n", "\n", ".xr-wrap {\n", " display: block !important;\n", " min-width: 300px;\n", " max-width: 700px;\n", "}\n", "\n", ".xr-text-repr-fallback {\n", " /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n", " display: none;\n", "}\n", "\n", ".xr-header {\n", " padding-top: 6px;\n", " padding-bottom: 6px;\n", " margin-bottom: 4px;\n", " border-bottom: solid 1px var(--xr-border-color);\n", "}\n", "\n", ".xr-header > div,\n", ".xr-header > ul {\n", " display: inline;\n", " margin-top: 0;\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-obj-type,\n", ".xr-array-name {\n", " margin-left: 2px;\n", " margin-right: 10px;\n", "}\n", "\n", ".xr-obj-type {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-sections {\n", " padding-left: 0 !important;\n", " display: grid;\n", " grid-template-columns: 150px auto auto 1fr 20px 20px;\n", "}\n", "\n", ".xr-section-item {\n", " display: contents;\n", "}\n", "\n", ".xr-section-item input {\n", " display: none;\n", "}\n", "\n", ".xr-section-item input + label {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-item input:enabled + label {\n", " cursor: pointer;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-item input:enabled + label:hover {\n", " color: var(--xr-font-color0);\n", "}\n", "\n", ".xr-section-summary {\n", " grid-column: 1;\n", " color: var(--xr-font-color2);\n", " font-weight: 500;\n", "}\n", "\n", ".xr-section-summary > span {\n", " display: inline-block;\n", " padding-left: 0.5em;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-summary-in + label:before {\n", " display: inline-block;\n", " content: '►';\n", " font-size: 11px;\n", " width: 15px;\n", " text-align: center;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label:before {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-summary-in:checked + label:before {\n", " content: '▼';\n", "}\n", "\n", ".xr-section-summary-in:checked + label > span {\n", " display: none;\n", "}\n", "\n", ".xr-section-summary,\n", ".xr-section-inline-details {\n", " padding-top: 4px;\n", " padding-bottom: 4px;\n", "}\n", "\n", ".xr-section-inline-details {\n", " grid-column: 2 / -1;\n", "}\n", "\n", ".xr-section-details {\n", " display: none;\n", " grid-column: 1 / -1;\n", " margin-bottom: 5px;\n", "}\n", "\n", ".xr-section-summary-in:checked ~ .xr-section-details {\n", " display: contents;\n", "}\n", "\n", ".xr-array-wrap {\n", " grid-column: 1 / -1;\n", " display: grid;\n", " grid-template-columns: 20px auto;\n", "}\n", "\n", ".xr-array-wrap > label {\n", " grid-column: 1;\n", " vertical-align: top;\n", "}\n", "\n", ".xr-preview {\n", " color: var(--xr-font-color3);\n", "}\n", "\n", ".xr-array-preview,\n", ".xr-array-data {\n", " padding: 0 5px !important;\n", " grid-column: 2;\n", "}\n", "\n", ".xr-array-data,\n", ".xr-array-in:checked ~ .xr-array-preview {\n", " display: none;\n", "}\n", "\n", ".xr-array-in:checked ~ .xr-array-data,\n", ".xr-array-preview {\n", " display: inline-block;\n", "}\n", "\n", ".xr-dim-list {\n", " display: inline-block !important;\n", " list-style: none;\n", " padding: 0 !important;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list li {\n", " display: inline-block;\n", " padding: 0;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list:before {\n", " content: '(';\n", "}\n", "\n", ".xr-dim-list:after {\n", " content: ')';\n", "}\n", "\n", ".xr-dim-list li:not(:last-child):after {\n", " content: ',';\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-has-index {\n", " font-weight: bold;\n", "}\n", "\n", ".xr-var-list,\n", ".xr-var-item {\n", " display: contents;\n", "}\n", "\n", ".xr-var-item > div,\n", ".xr-var-item label,\n", ".xr-var-item > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-even);\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-var-item > .xr-var-name:hover span {\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-var-list > li:nth-child(odd) > div,\n", ".xr-var-list > li:nth-child(odd) > label,\n", ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-odd);\n", "}\n", "\n", ".xr-var-name {\n", " grid-column: 1;\n", "}\n", "\n", ".xr-var-dims {\n", " grid-column: 2;\n", "}\n", "\n", ".xr-var-dtype {\n", " grid-column: 3;\n", " text-align: right;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-var-preview {\n", " grid-column: 4;\n", "}\n", "\n", ".xr-index-preview {\n", " grid-column: 2 / 5;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-var-name,\n", ".xr-var-dims,\n", ".xr-var-dtype,\n", ".xr-preview,\n", ".xr-attrs dt {\n", " white-space: nowrap;\n", " overflow: hidden;\n", " text-overflow: ellipsis;\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-var-name:hover,\n", ".xr-var-dims:hover,\n", ".xr-var-dtype:hover,\n", ".xr-attrs dt:hover {\n", " overflow: visible;\n", " width: auto;\n", " z-index: 1;\n", "}\n", "\n", ".xr-var-attrs,\n", ".xr-var-data,\n", ".xr-index-data {\n", " display: none;\n", " background-color: var(--xr-background-color) !important;\n", " padding-bottom: 5px !important;\n", "}\n", "\n", ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n", ".xr-var-data-in:checked ~ .xr-var-data,\n", ".xr-index-data-in:checked ~ .xr-index-data {\n", " display: block;\n", "}\n", "\n", ".xr-var-data > table {\n", " float: right;\n", "}\n", "\n", ".xr-var-name span,\n", ".xr-var-data,\n", ".xr-index-name div,\n", ".xr-index-data,\n", ".xr-attrs {\n", " padding-left: 25px !important;\n", "}\n", "\n", ".xr-attrs,\n", ".xr-var-attrs,\n", ".xr-var-data,\n", ".xr-index-data {\n", " grid-column: 1 / -1;\n", "}\n", "\n", "dl.xr-attrs {\n", " padding: 0;\n", " margin: 0;\n", " display: grid;\n", " grid-template-columns: 125px auto;\n", "}\n", "\n", ".xr-attrs dt,\n", ".xr-attrs dd {\n", " padding: 0;\n", " margin: 0;\n", " float: left;\n", " padding-right: 10px;\n", " width: auto;\n", "}\n", "\n", ".xr-attrs dt {\n", " font-weight: normal;\n", " grid-column: 1;\n", "}\n", "\n", ".xr-attrs dt:hover span {\n", " display: inline-block;\n", " background: var(--xr-background-color);\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-attrs dd {\n", " grid-column: 2;\n", " white-space: pre-wrap;\n", " word-break: break-all;\n", "}\n", "\n", ".xr-icon-database,\n", ".xr-icon-file-text2,\n", ".xr-no-icon {\n", " display: inline-block;\n", " vertical-align: middle;\n", " width: 1em;\n", " height: 1.5em !important;\n", " stroke-width: 0;\n", " stroke: currentColor;\n", " fill: currentColor;\n", "}\n", "</style><pre class='xr-text-repr-fallback'><xarray.DataArray 'shotNum' (runs: 5, truncation_value: 11)>\n", "array([['-1', '-2', '02', '03', '04', '05', '06', '07', '08', '09', '10'],\n", " ['11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'],\n", " ['22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32'],\n", " ['33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43'],\n", " ['44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54']],\n", " dtype='<U2')\n", "Coordinates:\n", " * runs (runs) float64 0.0 1.0 2.0 3.0 4.0\n", " * truncation_value (truncation_value) float64 0.8 0.83 0.85 ... 0.97 0.99 1.0</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'shotNum'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>runs</span>: 5</li><li><span class='xr-has-index'>truncation_value</span>: 11</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-f8b88ce0-8467-4b1c-9e79-353a4f1ee8d2' class='xr-array-in' type='checkbox' checked><label for='section-f8b88ce0-8467-4b1c-9e79-353a4f1ee8d2' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>'-1' '-2' '02' '03' '04' '05' '06' ... '49' '50' '51' '52' '53' '54'</span></div><div class='xr-array-data'><pre>array([['-1', '-2', '02', '03', '04', '05', '06', '07', '08', '09', '10'],\n", " ['11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'],\n", " ['22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32'],\n", " ['33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43'],\n", " ['44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54']],\n", " dtype='<U2')</pre></div></div></li><li class='xr-section-item'><input id='section-6450436a-e28e-4f5a-8baa-2f7bea8f5d0e' class='xr-section-summary-in' type='checkbox' checked><label for='section-6450436a-e28e-4f5a-8baa-2f7bea8f5d0e' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>runs</span></div><div class='xr-var-dims'>(runs)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.0 1.0 2.0 3.0 4.0</div><input id='attrs-2c6597d1-ed15-407e-877c-b36c0fc5da74' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-2c6597d1-ed15-407e-877c-b36c0fc5da74' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-57bee2cd-3e7d-405e-9d55-58166d8d9006' class='xr-var-data-in' type='checkbox'><label for='data-57bee2cd-3e7d-405e-9d55-58166d8d9006' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0., 1., 2., 3., 4.])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>truncation_value</span></div><div class='xr-var-dims'>(truncation_value)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.8 0.83 0.85 ... 0.97 0.99 1.0</div><input id='attrs-14c52d66-3e94-4752-9639-a044fae05baa' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-14c52d66-3e94-4752-9639-a044fae05baa' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b106cb39-4a89-40cc-92e7-7fd915f1dfb0' class='xr-var-data-in' type='checkbox'><label for='data-b106cb39-4a89-40cc-92e7-7fd915f1dfb0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0.8 , 0.83, 0.85, 0.87, 0.89, 0.91, 0.93, 0.95, 0.97, 0.99, 1. ])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-46769c5f-0b89-4a91-a3af-775ee3df58b5' class='xr-section-summary-in' type='checkbox' ><label for='section-46769c5f-0b89-4a91-a3af-775ee3df58b5' class='xr-section-summary' >Indexes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>runs</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-250befeb-cc4a-4ded-af8b-15fbfc6fcc50' class='xr-index-data-in' type='checkbox'/><label for='index-250befeb-cc4a-4ded-af8b-15fbfc6fcc50' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([0.0, 1.0, 2.0, 3.0, 4.0], dtype='float64', name='runs'))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>truncation_value</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-0bb02b75-8d25-4632-be0d-ecb9c68cac4a' class='xr-index-data-in' type='checkbox'/><label for='index-0bb02b75-8d25-4632-be0d-ecb9c68cac4a' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([0.8, 0.83, 0.85, 0.87, 0.89, 0.91, 0.93, 0.95, 0.97, 0.99, 1.0], dtype='float64', name='truncation_value'))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-f616ad52-3d9b-44a5-b060-bb4c419037d0' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-f616ad52-3d9b-44a5-b060-bb4c419037d0' class='xr-section- ], "text/plain": [ "<xarray.DataArray 'shotNum' (runs: 5, truncation_value: 11)>\n", "array([['-1', '-2', '02', '03', '04', '05', '06', '07', '08', '09', '10'],\n", " ['11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'],\n", " ['22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32'],\n", " ['33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43'],\n", " ['44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54']],\n", " dtype='<U2')\n", "Coordinates:\n", " * runs (runs) float64 0.0 1.0 2.0 3.0 4.0\n", " * truncation_value (truncation_value) float64 0.8 0.83 0.85 ... 0.97 0.99 1.0" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dataSet.shotNum[0, 1] = '-2'\n", "dataSet.shotNum" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Remove the data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Simply remove element or variables" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For simply remove elements or variables in xarray, please read the introduction and examples from xarray package in the following link\n", "\n", " https://docs.xarray.dev/en/stable/generated/xarray.Dataset.drop_vars.html\n", " https://docs.xarray.dev/en/latest/generated/xarray.Dataset.drop_sel.html\n", " https://docs.xarray.dev/en/latest/generated/xarray.Dataset.drop_isel.html" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Remove bad shot" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "However, if one wants to remove the bad shot, it is highly recommended to set the value to 'np.nan', instead of directly delete it.\n", "\n", "In order to do that, except the two ways we demenstrate in the section 'Modify the data', we also implent a function to do it." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n", "<defs>\n", "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n", "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n", "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "</symbol>\n", "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n", "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n", "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "</symbol>\n", "</defs>\n", "</svg>\n", "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n", " *\n", " */\n", "\n", ":root {\n", " --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n", " --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n", " --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n", " --xr-border-color: var(--jp-border-color2, #e0e0e0);\n", " --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n", " --xr-background-color: var(--jp-layout-color0, white);\n", " --xr-background-color-row-even: var(--jp-layout-color1, white);\n", " --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n", "}\n", "\n", "html[theme=dark],\n", "body[data-theme=dark],\n", "body.vscode-dark {\n", " --xr-font-color0: rgba(255, 255, 255, 1);\n", " --xr-font-color2: rgba(255, 255, 255, 0.54);\n", " --xr-font-color3: rgba(255, 255, 255, 0.38);\n", " --xr-border-color: #1F1F1F;\n", " --xr-disabled-color: #515151;\n", " --xr-background-color: #111111;\n", " --xr-background-color-row-even: #111111;\n", " --xr-background-color-row-odd: #313131;\n", "}\n", "\n", ".xr-wrap {\n", " display: block !important;\n", " min-width: 300px;\n", " max-width: 700px;\n", "}\n", "\n", ".xr-text-repr-fallback {\n", " /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n", " display: none;\n", "}\n", "\n", ".xr-header {\n", " padding-top: 6px;\n", " padding-bottom: 6px;\n", " margin-bottom: 4px;\n", " border-bottom: solid 1px var(--xr-border-color);\n", "}\n", "\n", ".xr-header > div,\n", ".xr-header > ul {\n", " display: inline;\n", " margin-top: 0;\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-obj-type,\n", ".xr-array-name {\n", " margin-left: 2px;\n", " margin-right: 10px;\n", "}\n", "\n", ".xr-obj-type {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-sections {\n", " padding-left: 0 !important;\n", " display: grid;\n", " grid-template-columns: 150px auto auto 1fr 20px 20px;\n", "}\n", "\n", ".xr-section-item {\n", " display: contents;\n", "}\n", "\n", ".xr-section-item input {\n", " display: none;\n", "}\n", "\n", ".xr-section-item input + label {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-item input:enabled + label {\n", " cursor: pointer;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-item input:enabled + label:hover {\n", " color: var(--xr-font-color0);\n", "}\n", "\n", ".xr-section-summary {\n", " grid-column: 1;\n", " color: var(--xr-font-color2);\n", " font-weight: 500;\n", "}\n", "\n", ".xr-section-summary > span {\n", " display: inline-block;\n", " padding-left: 0.5em;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-summary-in + label:before {\n", " display: inline-block;\n", " content: '►';\n", " font-size: 11px;\n", " width: 15px;\n", " text-align: center;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label:before {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-summary-in:checked + label:before {\n", " content: '▼';\n", "}\n", "\n", ".xr-section-summary-in:checked + label > span {\n", " display: none;\n", "}\n", "\n", ".xr-section-summary,\n", ".xr-section-inline-details {\n", " padding-top: 4px;\n", " padding-bottom: 4px;\n", "}\n", "\n", ".xr-section-inline-details {\n", " grid-column: 2 / -1;\n", "}\n", "\n", ".xr-section-details {\n", " display: none;\n", " grid-column: 1 / -1;\n", " margin-bottom: 5px;\n", "}\n", "\n", ".xr-section-summary-in:checked ~ .xr-section-details {\n", " display: contents;\n", "}\n", "\n", ".xr-array-wrap {\n", " grid-column: 1 / -1;\n", " display: grid;\n", " grid-template-columns: 20px auto;\n", "}\n", "\n", ".xr-array-wrap > label {\n", " grid-column: 1;\n", " vertical-align: top;\n", "}\n", "\n", ".xr-preview {\n", " color: var(--xr-font-color3);\n", "}\n", "\n", ".xr-array-preview,\n", ".xr-array-data {\n", " padding: 0 5px !important;\n", " grid-column: 2;\n", "}\n", "\n", ".xr-array-data,\n", ".xr-array-in:checked ~ .xr-array-preview {\n", " display: none;\n", "}\n", "\n", ".xr-array-in:checked ~ .xr-array-data,\n", ".xr-array-preview {\n", " display: inline-block;\n", "}\n", "\n", ".xr-dim-list {\n", " display: inline-block !important;\n", " list-style: none;\n", " padding: 0 !important;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list li {\n", " display: inline-block;\n", " padding: 0;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list:before {\n", " content: '(';\n", "}\n", "\n", ".xr-dim-list:after {\n", " content: ')';\n", "}\n", "\n", ".xr-dim-list li:not(:last-child):after {\n", " content: ',';\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-has-index {\n", " font-weight: bold;\n", "}\n", "\n", ".xr-var-list,\n", ".xr-var-item {\n", " display: contents;\n", "}\n", "\n", ".xr-var-item > div,\n", ".xr-var-item label,\n", ".xr-var-item > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-even);\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-var-item > .xr-var-name:hover span {\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-var-list > li:nth-child(odd) > div,\n", ".xr-var-list > li:nth-child(odd) > label,\n", ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-odd);\n", "}\n", "\n", ".xr-var-name {\n", " grid-column: 1;\n", "}\n", "\n", ".xr-var-dims {\n", " grid-column: 2;\n", "}\n", "\n", ".xr-var-dtype {\n", " grid-column: 3;\n", " text-align: right;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-var-preview {\n", " grid-column: 4;\n", "}\n", "\n", ".xr-index-preview {\n", " grid-column: 2 / 5;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-var-name,\n", ".xr-var-dims,\n", ".xr-var-dtype,\n", ".xr-preview,\n", ".xr-attrs dt {\n", " white-space: nowrap;\n", " overflow: hidden;\n", " text-overflow: ellipsis;\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-var-name:hover,\n", ".xr-var-dims:hover,\n", ".xr-var-dtype:hover,\n", ".xr-attrs dt:hover {\n", " overflow: visible;\n", " width: auto;\n", " z-index: 1;\n", "}\n", "\n", ".xr-var-attrs,\n", ".xr-var-data,\n", ".xr-index-data {\n", " display: none;\n", " background-color: var(--xr-background-color) !important;\n", " padding-bottom: 5px !important;\n", "}\n", "\n", ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n", ".xr-var-data-in:checked ~ .xr-var-data,\n", ".xr-index-data-in:checked ~ .xr-index-data {\n", " display: block;\n", "}\n", "\n", ".xr-var-data > table {\n", " float: right;\n", "}\n", "\n", ".xr-var-name span,\n", ".xr-var-data,\n", ".xr-index-name div,\n", ".xr-index-data,\n", ".xr-attrs {\n", " padding-left: 25px !important;\n", "}\n", "\n", ".xr-attrs,\n", ".xr-var-attrs,\n", ".xr-var-data,\n", ".xr-index-data {\n", " grid-column: 1 / -1;\n", "}\n", "\n", "dl.xr-attrs {\n", " padding: 0;\n", " margin: 0;\n", " display: grid;\n", " grid-template-columns: 125px auto;\n", "}\n", "\n", ".xr-attrs dt,\n", ".xr-attrs dd {\n", " padding: 0;\n", " margin: 0;\n", " float: left;\n", " padding-right: 10px;\n", " width: auto;\n", "}\n", "\n", ".xr-attrs dt {\n", " font-weight: normal;\n", " grid-column: 1;\n", "}\n", "\n", ".xr-attrs dt:hover span {\n", " display: inline-block;\n", " background: var(--xr-background-color);\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-attrs dd {\n", " grid-column: 2;\n", " white-space: pre-wrap;\n", " word-break: break-all;\n", "}\n", "\n", ".xr-icon-database,\n", ".xr-icon-file-text2,\n", ".xr-no-icon {\n", " display: inline-block;\n", " vertical-align: middle;\n", " width: 1em;\n", " height: 1.5em !important;\n", " stroke-width: 0;\n", " stroke: currentColor;\n", " fill: currentColor;\n", "}\n", "</style><pre class='xr-text-repr-fallback'><xarray.DataArray 'atoms' (runs: 5, truncation_value: 11, y: 1200, x: 1920)>\n", "array([[[[ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan]],\n", "\n", " [[102., 103., 100., ..., 155., 154., 142.],\n", " [ 97., 100., 101., ..., 146., 146., 156.],\n", " [ 91., 93., 97., ..., 142., 136., 151.],\n", " ...,\n", " [105., 103., 103., ..., 144., 134., 142.],\n", " [102., 104., 112., ..., 133., 134., 135.],\n", " [114., 115., 113., ..., 119., 126., 122.]],\n", "\n", " [[101., 105., 103., ..., 148., 152., 146.],\n", " [101., 102., 98., ..., 143., 146., 149.],\n", " [ 97., 98., 98., ..., 139., 137., 146.],\n", " ...,\n", "...\n", " ...,\n", " [100., 102., 109., ..., 135., 141., 140.],\n", " [106., 103., 105., ..., 128., 140., 132.],\n", " [114., 107., 108., ..., 121., 123., 126.]],\n", "\n", " [[101., 102., 101., ..., 153., 153., 146.],\n", " [101., 103., 100., ..., 148., 143., 149.],\n", " [ 96., 95., 98., ..., 145., 138., 144.],\n", " ...,\n", " [ 98., 107., 103., ..., 140., 142., 145.],\n", " [106., 100., 103., ..., 133., 133., 136.],\n", " [115., 103., 102., ..., 123., 125., 128.]],\n", "\n", " [[103., 100., 102., ..., 154., 147., 153.],\n", " [ 96., 103., 97., ..., 150., 150., 152.],\n", " [ 96., 100., 96., ..., 141., 142., 144.],\n", " ...,\n", " [101., 102., 101., ..., 139., 142., 140.],\n", " [105., 105., 98., ..., 132., 135., 131.],\n", " [109., 111., 107., ..., 125., 126., 129.]]]])\n", "Coordinates:\n", " * runs (runs) float64 0.0 1.0 2.0 3.0 4.0\n", " * truncation_value (truncation_value) float64 0.8 0.83 0.85 ... 0.97 0.99 1.0\n", "Dimensions without coordinates: y, x\n", "Attributes:\n", " IMAGE_SUBCLASS: IMAGE_GRAYSCALE\n", " IMAGE_VERSION: 1.2\n", " IMAGE_WHITE_IS_ZERO: 0</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'atoms'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>runs</span>: 5</li><li><span class='xr-has-index'>truncation_value</span>: 11</li><li><span>y</span>: 1200</li><li><span>x</span>: 1920</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-96fcd01b-3091-424c-960e-87b40148b49e' class='xr-array-in' type='checkbox' checked><label for='section-96fcd01b-3091-424c-960e-87b40148b49e' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>nan nan nan nan nan nan nan ... 132.0 129.0 130.0 125.0 126.0 129.0</span></div><div class='xr-array-data'><pre>array([[[[ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan]],\n", "\n", " [[102., 103., 100., ..., 155., 154., 142.],\n", " [ 97., 100., 101., ..., 146., 146., 156.],\n", " [ 91., 93., 97., ..., 142., 136., 151.],\n", " ...,\n", " [105., 103., 103., ..., 144., 134., 142.],\n", " [102., 104., 112., ..., 133., 134., 135.],\n", " [114., 115., 113., ..., 119., 126., 122.]],\n", "\n", " [[101., 105., 103., ..., 148., 152., 146.],\n", " [101., 102., 98., ..., 143., 146., 149.],\n", " [ 97., 98., 98., ..., 139., 137., 146.],\n", " ...,\n", "...\n", " ...,\n", " [100., 102., 109., ..., 135., 141., 140.],\n", " [106., 103., 105., ..., 128., 140., 132.],\n", " [114., 107., 108., ..., 121., 123., 126.]],\n", "\n", " [[101., 102., 101., ..., 153., 153., 146.],\n", " [101., 103., 100., ..., 148., 143., 149.],\n", " [ 96., 95., 98., ..., 145., 138., 144.],\n", " ...,\n", " [ 98., 107., 103., ..., 140., 142., 145.],\n", " [106., 100., 103., ..., 133., 133., 136.],\n", " [115., 103., 102., ..., 123., 125., 128.]],\n", "\n", " [[103., 100., 102., ..., 154., 147., 153.],\n", " [ 96., 103., 97., ..., 150., 150., 152.],\n", " [ 96., 100., 96., ..., 141., 142., 144.],\n", " ...,\n", " [101., 102., 101., ..., 139., 142., 140.],\n", " [105., 105., 98., ..., 132., 135., 131.],\n", " [109., 111., 107., ..., 125., 126., 129.]]]])</pre></div></div></li><li class='xr-section-item'><input id='section-eead7289-9142-4668-b985-10b192d24f32' class='xr-section-summary-in' type='checkbox' checked><label for='section-eead7289-9142-4668-b985-10b192d24f32' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>runs</span></div><div class='xr-var-dims'>(runs)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.0 1.0 2.0 3.0 4.0</div><input id='attrs-5297672f-0b3f-404c-a9f3-3d450736770c' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-5297672f-0b3f-404c-a9f3-3d450736770c' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-0b2f5a69-9f4e-4e01-b6a6-697a8cb9e145' class='xr-var-data-in' type='checkbox'><label for='data-0b2f5a69-9f4e-4e01-b6a6-697a8cb9e145' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0., 1., 2., 3., 4.])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>truncation_value</span></div><div class='xr-var-dims'>(truncation_value)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>0.8 0.83 0.85 ... 0.97 0.99 1.0</div><input id='attrs-62c03571-880f-4bc3-b4cc-760a0ea23177' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-62c03571-880f-4bc3-b4cc-760a0ea23177' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-f846df74-48be-4f5d-b406-33b1c7beae76' class='xr-var-data-in' type='checkbox'><label for='data-f846df74-48be-4f5d-b406-33b1c7beae76' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0.8 , 0.83, 0.85, 0.87, 0.89, 0.91, 0.93, 0.95, 0.97, 0.99, 1. ])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-39aa964f-5d61-486f-993a-cbd5937e2d40' class='xr-section-summary-in' type='checkbox' ><label for='section-39aa964f-5d61-486f-993a-cbd5937e2d40' class='xr-section-summary' >Indexes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>runs</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-5a7cf4d5-d1c5-422b-a5a2-65901ab1a718' class='xr-index-data-in' type='checkbox'/><label for='index-5a7cf4d5-d1c5-422b-a5a2-65901ab1a718' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([0.0, 1.0, 2.0, 3.0, 4.0], dtype='float64', name='runs'))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>truncation_value</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-3e10ed60-13d7-40dc-893e-174d6b9a4a86' class='xr-index-data-in' type='checkbox'/><label for='index-3e10ed60-13d7-40dc-893e-174d6b9a4a86' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([0.8, 0.83, 0.85, 0.87, 0.89, 0.91, 0.93, 0.95, 0.97, 0.99, 1.0], dtype='float64', name='truncation_value'))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-e0bee93d-d684-4ff0-aeb6-6c44853eea65' class='xr-section-summary-in' type='checkbox' checked><label for='section-e0bee93d-d684-4ff0-aeb6-6c44853eea ], "text/plain": [ "<xarray.DataArray 'atoms' (runs: 5, truncation_value: 11, y: 1200, x: 1920)>\n", "array([[[[ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " ...,\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan],\n", " [ nan, nan, nan, ..., nan, nan, nan]],\n", "\n", " [[102., 103., 100., ..., 155., 154., 142.],\n", " [ 97., 100., 101., ..., 146., 146., 156.],\n", " [ 91., 93., 97., ..., 142., 136., 151.],\n", " ...,\n", " [105., 103., 103., ..., 144., 134., 142.],\n", " [102., 104., 112., ..., 133., 134., 135.],\n", " [114., 115., 113., ..., 119., 126., 122.]],\n", "\n", " [[101., 105., 103., ..., 148., 152., 146.],\n", " [101., 102., 98., ..., 143., 146., 149.],\n", " [ 97., 98., 98., ..., 139., 137., 146.],\n", " ...,\n", "...\n", " ...,\n", " [100., 102., 109., ..., 135., 141., 140.],\n", " [106., 103., 105., ..., 128., 140., 132.],\n", " [114., 107., 108., ..., 121., 123., 126.]],\n", "\n", " [[101., 102., 101., ..., 153., 153., 146.],\n", " [101., 103., 100., ..., 148., 143., 149.],\n", " [ 96., 95., 98., ..., 145., 138., 144.],\n", " ...,\n", " [ 98., 107., 103., ..., 140., 142., 145.],\n", " [106., 100., 103., ..., 133., 133., 136.],\n", " [115., 103., 102., ..., 123., 125., 128.]],\n", "\n", " [[103., 100., 102., ..., 154., 147., 153.],\n", " [ 96., 103., 97., ..., 150., 150., 152.],\n", " [ 96., 100., 96., ..., 141., 142., 144.],\n", " ...,\n", " [101., 102., 101., ..., 139., 142., 140.],\n", " [105., 105., 98., ..., 132., 135., 131.],\n", " [109., 111., 107., ..., 125., 126., 129.]]]])\n", "Coordinates:\n", " * runs (runs) float64 0.0 1.0 2.0 3.0 4.0\n", " * truncation_value (truncation_value) float64 0.8 0.83 0.85 ... 0.97 0.99 1.0\n", "Dimensions without coordinates: y, x\n", "Attributes:\n", " IMAGE_SUBCLASS: IMAGE_GRAYSCALE\n", " IMAGE_VERSION: 1.2\n", " IMAGE_WHITE_IS_ZERO: 0" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = copy.deepcopy(dataSet.atoms)\n", "# we first need to change the dtype from unsign 16-bit integer (uint16) to float, \n", "# since the uint16 doesn't support to store nan value.\n", "data = data.astype(float)\n", "data = remove_bad_shots(data, runs=0, truncation_value=0.8)\n", "data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "base", "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.9.12" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }
|